aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/file.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2010-05-31 11:02:39 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2010-08-04 06:17:56 -0400
commitb2848349296f3428850eb34c3a52d586f48d4b04 (patch)
tree481c44078de9425495fbd7201d6d39f89e35d206 /fs/exofs/file.c
parent85dc7878c6c2277de2eda2c4d1b11ea5c5b1068a (diff)
exofs: exofs_file_fsync and exofs_file_flush correctness
As per Christoph advise: no need to call filemap_write_and_wait(). In exofs all metadata is at the inode so just writing the inode is all is needed. ->fsync implies this must be done synchronously. But now exofs_file_fsync can not be used by exofs_file_flush. vfs_fsync() should do that job correctly. FIXME: remove the sb_sync and fix that sb_update better. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/file.c')
-rw-r--r--fs/exofs/file.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index fef6899be397..aa1fd1a372cf 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -30,9 +30,6 @@
30 * along with exofs; if not, write to the Free Software 30 * along with exofs; if not, write to the Free Software
31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 */ 32 */
33
34#include <linux/buffer_head.h>
35
36#include "exofs.h" 33#include "exofs.h"
37 34
38static int exofs_release_file(struct inode *inode, struct file *filp) 35static int exofs_release_file(struct inode *inode, struct file *filp)
@@ -40,19 +37,27 @@ static int exofs_release_file(struct inode *inode, struct file *filp)
40 return 0; 37 return 0;
41} 38}
42 39
40/* exofs_file_fsync - flush the inode to disk
41 *
42 * Note, in exofs all metadata is written as part of inode, regardless.
43 * The writeout is synchronous
44 */
43static int exofs_file_fsync(struct file *filp, int datasync) 45static int exofs_file_fsync(struct file *filp, int datasync)
44{ 46{
45 int ret; 47 int ret;
46 struct address_space *mapping = filp->f_mapping; 48 struct inode *inode = filp->f_mapping->host;
47 struct inode *inode = mapping->host; 49 struct writeback_control wbc = {
50 .sync_mode = WB_SYNC_ALL,
51 .nr_to_write = 0, /* metadata-only; caller takes care of data */
52 };
48 struct super_block *sb; 53 struct super_block *sb;
49 54
50 ret = filemap_write_and_wait(mapping); 55 if (!(inode->i_state & I_DIRTY))
51 if (ret) 56 return 0;
52 return ret; 57 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
58 return 0;
53 59
54 /* sync the inode attributes */ 60 ret = sync_inode(inode, &wbc);
55 ret = write_inode_now(inode, 1);
56 61
57 /* This is a good place to write the sb */ 62 /* This is a good place to write the sb */
58 /* TODO: Sechedule an sb-sync on create */ 63 /* TODO: Sechedule an sb-sync on create */
@@ -65,9 +70,9 @@ static int exofs_file_fsync(struct file *filp, int datasync)
65 70
66static int exofs_flush(struct file *file, fl_owner_t id) 71static int exofs_flush(struct file *file, fl_owner_t id)
67{ 72{
68 exofs_file_fsync(file, 1); 73 int ret = vfs_fsync(file, 0);
69 /* TODO: Flush the OSD target */ 74 /* TODO: Flush the OSD target */
70 return 0; 75 return ret;
71} 76}
72 77
73const struct file_operations exofs_file_operations = { 78const struct file_operations exofs_file_operations = {