diff options
Diffstat (limited to 'fs/exofs/file.c')
-rw-r--r-- | fs/exofs/file.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/exofs/file.c b/fs/exofs/file.c index f9bfe2b501d..68cb23e3bb9 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 | ||
38 | static int exofs_release_file(struct inode *inode, struct file *filp) | 35 | static 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 | */ | ||
43 | static int exofs_file_fsync(struct file *filp, int datasync) | 45 | static 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 | ||
66 | static int exofs_flush(struct file *file, fl_owner_t id) | 71 | static 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 | ||
73 | const struct file_operations exofs_file_operations = { | 78 | const struct file_operations exofs_file_operations = { |