Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166684
b: refs/heads/master
c: ab93dbe
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Oct 1, 2009
1 parent 23eadd7 commit dce80d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 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: 35d62a942db5ae03104929fe7397835b572c4bc4
refs/heads/master: ab93dbecfba72bbc04b7036343d180aaff1b61a3
25 changes: 17 additions & 8 deletions trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,26 +920,35 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
start_pos = pos;

vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);

/* do the reserve before the mutex lock in case we have to do some
* flushing. We wouldn't deadlock, but this is more polite.
*/
err = btrfs_reserve_metadata_for_delalloc(root, inode, 1);
if (err)
goto out_nolock;

mutex_lock(&inode->i_mutex);

current->backing_dev_info = inode->i_mapping->backing_dev_info;
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
if (err)
goto out_nolock;
goto out;

if (count == 0)
goto out_nolock;
goto out;

err = file_remove_suid(file);
if (err)
goto out_nolock;

err = btrfs_reserve_metadata_for_delalloc(root, inode, 1);
if (err)
goto out_nolock;
goto out;

file_update_time(file);

pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);

mutex_lock(&inode->i_mutex);
/* generic_write_checks can change our pos */
start_pos = pos;

BTRFS_I(inode)->sequence++;
first_index = pos >> PAGE_CACHE_SHIFT;
last_index = (pos + count) >> PAGE_CACHE_SHIFT;
Expand Down

0 comments on commit dce80d6

Please sign in to comment.