Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332565
b: refs/heads/master
c: 90abccf
h: refs/heads/master
i:
  332563: b141493
v: v3
  • Loading branch information
Miao Xie authored and Chris Mason committed Oct 1, 2012
1 parent da43f3e commit df69d53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 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: 698d0082c4875a2ccc10b52ee8f415faad46b754
refs/heads/master: 90abccf2c6e6e9c5a5d519eaed95292afa30aa11
14 changes: 11 additions & 3 deletions trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,12 +1544,20 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)

trace_btrfs_sync_file(file, datasync);

/*
* We write the dirty pages in the range and wait until they complete
* out of the ->i_mutex. If so, we can flush the dirty pages by
* multi-task, and make the performance up.
*/
ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (ret)
return ret;

mutex_lock(&inode->i_mutex);

/*
* we wait first, since the writeback may change the inode, also wait
* ordered range does a filemape_write_and_wait_range which is why we
* don't do it above like other file systems.
* We flush the dirty pages again to avoid some dirty pages in the
* range being left.
*/
atomic_inc(&root->log_batch);
btrfs_wait_ordered_range(inode, start, end);
Expand Down

0 comments on commit df69d53

Please sign in to comment.