Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309721
b: refs/heads/master
c: 1147597
h: refs/heads/master
i:
  309719: f80a8ae
v: v3
  • Loading branch information
Ryusuke Konishi authored and Linus Torvalds committed Jun 1, 2012
1 parent 289ca9e commit 8a93389
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1d494495c69ef0810cd008f59310d2b9db28e36
refs/heads/master: 11475975dd3c0a8e639f1544ef6530373de5979e
24 changes: 14 additions & 10 deletions trunk/fs/nilfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* This function should be implemented when the writeback function
* will be implemented.
*/
struct the_nilfs *nilfs;
struct inode *inode = file->f_mapping->host;
int err;

Expand All @@ -45,18 +46,21 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
return err;
mutex_lock(&inode->i_mutex);

if (!nilfs_inode_dirty(inode)) {
mutex_unlock(&inode->i_mutex);
return 0;
if (nilfs_inode_dirty(inode)) {
if (datasync)
err = nilfs_construct_dsync_segment(inode->i_sb, inode,
0, LLONG_MAX);
else
err = nilfs_construct_segment(inode->i_sb);
}

if (datasync)
err = nilfs_construct_dsync_segment(inode->i_sb, inode, 0,
LLONG_MAX);
else
err = nilfs_construct_segment(inode->i_sb);

mutex_unlock(&inode->i_mutex);

nilfs = inode->i_sb->s_fs_info;
if (!err && nilfs_test_opt(nilfs, BARRIER)) {
err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
if (err != -EIO)
err = 0;
}
return err;
}

Expand Down
8 changes: 7 additions & 1 deletion trunk/fs/nilfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,14 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
if (ret < 0)
return ret;

nilfs = inode->i_sb->s_fs_info;
if (nilfs_test_opt(nilfs, BARRIER)) {
ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
if (ret == -EIO)
return ret;
}

if (argp != NULL) {
nilfs = inode->i_sb->s_fs_info;
down_read(&nilfs->ns_segctor_sem);
cno = nilfs->ns_cno - 1;
up_read(&nilfs->ns_segctor_sem);
Expand Down

0 comments on commit 8a93389

Please sign in to comment.