2008-10-27 17:37:02 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005, 2006
|
2009-06-14 16:23:09 +02:00
|
|
|
* Avishay Traeger (avishay@gmail.com)
|
2008-10-27 17:37:02 +01:00
|
|
|
* Copyright (C) 2008, 2009
|
2014-10-19 18:38:58 +02:00
|
|
|
* Boaz Harrosh <ooo@electrozaur.com>
|
2008-10-27 17:37:02 +01:00
|
|
|
*
|
|
|
|
* Copyrights for code taken from ext2:
|
|
|
|
* Copyright (C) 1992, 1993, 1994, 1995
|
|
|
|
* Remy Card (card@masi.ibp.fr)
|
|
|
|
* Laboratoire MASI - Institut Blaise Pascal
|
|
|
|
* Universite Pierre et Marie Curie (Paris VI)
|
|
|
|
* from
|
|
|
|
* linux/fs/minix/inode.c
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*
|
|
|
|
* This file is part of exofs.
|
|
|
|
*
|
|
|
|
* exofs is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation. Since it is based on ext2, and the only
|
|
|
|
* valid version of GPL for the Linux kernel is version 2, the only valid
|
|
|
|
* version of GPL for exofs is version 2.
|
|
|
|
*
|
|
|
|
* exofs is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with exofs; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
#include "exofs.h"
|
|
|
|
|
|
|
|
static int exofs_release_file(struct inode *inode, struct file *filp)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-31 17:02:39 +02:00
|
|
|
/* exofs_file_fsync - flush the inode to disk
|
|
|
|
*
|
|
|
|
* Note, in exofs all metadata is written as part of inode, regardless.
|
|
|
|
* The writeout is synchronous
|
|
|
|
*/
|
2011-07-17 02:44:56 +02:00
|
|
|
static int exofs_file_fsync(struct file *filp, loff_t start, loff_t end,
|
|
|
|
int datasync)
|
2008-10-27 17:37:02 +01:00
|
|
|
{
|
2011-07-17 02:44:56 +02:00
|
|
|
struct inode *inode = filp->f_mapping->host;
|
2008-10-27 17:37:02 +01:00
|
|
|
int ret;
|
2009-06-14 15:52:10 +02:00
|
|
|
|
2017-07-07 21:20:52 +02:00
|
|
|
ret = file_write_and_wait_range(filp, start, end);
|
2011-07-17 02:44:56 +02:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2016-01-22 21:40:57 +01:00
|
|
|
inode_lock(inode);
|
2011-02-03 16:53:25 +01:00
|
|
|
ret = sync_inode_metadata(filp->f_mapping->host, 1);
|
2016-01-22 21:40:57 +01:00
|
|
|
inode_unlock(inode);
|
2009-06-14 15:52:10 +02:00
|
|
|
return ret;
|
2008-10-27 17:37:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int exofs_flush(struct file *file, fl_owner_t id)
|
|
|
|
{
|
2010-05-31 17:02:39 +02:00
|
|
|
int ret = vfs_fsync(file, 0);
|
2008-10-27 17:37:02 +01:00
|
|
|
/* TODO: Flush the OSD target */
|
2010-05-31 17:02:39 +02:00
|
|
|
return ret;
|
2008-10-27 17:37:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const struct file_operations exofs_file_operations = {
|
|
|
|
.llseek = generic_file_llseek,
|
2014-04-02 20:33:16 +02:00
|
|
|
.read_iter = generic_file_read_iter,
|
2014-04-03 09:17:43 +02:00
|
|
|
.write_iter = generic_file_write_iter,
|
2008-10-27 17:37:02 +01:00
|
|
|
.mmap = generic_file_mmap,
|
|
|
|
.open = generic_file_open,
|
|
|
|
.release = exofs_release_file,
|
|
|
|
.fsync = exofs_file_fsync,
|
|
|
|
.flush = exofs_flush,
|
|
|
|
.splice_read = generic_file_splice_read,
|
2014-04-05 10:27:08 +02:00
|
|
|
.splice_write = iter_file_splice_write,
|
2008-10-27 17:37:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct inode_operations exofs_file_inode_operations = {
|
|
|
|
.setattr = exofs_setattr,
|
|
|
|
};
|