diff options
author | Christoph Hellwig <hch@tuxera.com> | 2010-11-23 08:38:06 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-11-23 08:38:06 -0500 |
commit | 281469766bdde2d14bc73e1fec347e6dd7f63319 (patch) | |
tree | 32b00c29067aa60fc7ad3277816bd86900a1c81d /fs/hfsplus | |
parent | f02e26f8d90f8cde98314c72c2e890bc281a8346 (diff) |
hfsplus: simplify fsync
Remove lots of code we don't need from fsync, we just need to call
->write_inode on the inode if it's dirty, for which sync_inode_metadata
is a lot more efficient than write_inode_now, and we need to write
out the various metadata inodes, which we now do explicitly instead
of by calling ->sync_fs.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/inode.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 8afd7e84f98d..be68961da997 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -302,29 +302,28 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) | |||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
305 | static int hfsplus_file_fsync(struct file *filp, int datasync) | 305 | static int hfsplus_file_fsync(struct file *file, int datasync) |
306 | { | 306 | { |
307 | struct inode *inode = filp->f_mapping->host; | 307 | struct inode *inode = file->f_mapping->host; |
308 | struct super_block * sb; | 308 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); |
309 | int ret, err; | 309 | int error, error2; |
310 | |||
311 | /* sync the inode to buffers */ | ||
312 | ret = write_inode_now(inode, 0); | ||
313 | |||
314 | /* sync the superblock to buffers */ | ||
315 | sb = inode->i_sb; | ||
316 | if (sb->s_dirt) { | ||
317 | if (!(sb->s_flags & MS_RDONLY)) | ||
318 | hfsplus_sync_fs(sb, 1); | ||
319 | else | ||
320 | sb->s_dirt = 0; | ||
321 | } | ||
322 | 310 | ||
323 | /* .. finally sync the buffers to disk */ | 311 | /* |
324 | err = sync_blockdev(sb->s_bdev); | 312 | * Sync inode metadata into the catalog and extent trees. |
325 | if (!ret) | 313 | */ |
326 | ret = err; | 314 | sync_inode_metadata(inode, 1); |
327 | return ret; | 315 | |
316 | /* | ||
317 | * And explicitly write out the btrees. | ||
318 | */ | ||
319 | error = filemap_write_and_wait(sbi->cat_tree->inode->i_mapping); | ||
320 | error2 = filemap_write_and_wait(sbi->ext_tree->inode->i_mapping); | ||
321 | if (!error) | ||
322 | error = error2; | ||
323 | error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping); | ||
324 | if (!error) | ||
325 | error = error2; | ||
326 | return error; | ||
328 | } | 327 | } |
329 | 328 | ||
330 | static const struct inode_operations hfsplus_file_inode_operations = { | 329 | static const struct inode_operations hfsplus_file_inode_operations = { |