Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360480
b: refs/heads/master
c: 172a504
h: refs/heads/master
v: v3
  • Loading branch information
Miao Xie authored and Chris Mason committed Feb 21, 2013
1 parent de80d9d commit fbd3052
Show file tree
Hide file tree
Showing 2 changed files with 10 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: 38c227d87c49ad5d173cb5d4374d49acec6a495d
refs/heads/master: 172a50497ffaf84d60dff37fbeb03894268fe5c2
20 changes: 9 additions & 11 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6708,12 +6708,9 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
int unlock_bits = EXTENT_LOCKED;
int ret = 0;

if (create) {
spin_lock(&BTRFS_I(inode)->lock);
BTRFS_I(inode)->outstanding_extents++;
spin_unlock(&BTRFS_I(inode)->lock);
if (create)
unlock_bits |= EXTENT_DELALLOC | EXTENT_DIRTY;
} else
else
len = min_t(u64, len, root->sectorsize);

lockstart = start;
Expand Down Expand Up @@ -6855,6 +6852,10 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
if (start + len > i_size_read(inode))
i_size_write(inode, start + len);

spin_lock(&BTRFS_I(inode)->lock);
BTRFS_I(inode)->outstanding_extents++;
spin_unlock(&BTRFS_I(inode)->lock);

ret = set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
lockstart + len - 1, EXTENT_DELALLOC, NULL,
&cached_state, GFP_NOFS);
Expand Down Expand Up @@ -7362,14 +7363,11 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
if (rw & WRITE) {
if (ret < 0 && ret != -EIOCBQUEUED)
btrfs_delalloc_release_space(inode, count);
else if (ret > 0 && (size_t)ret < count) {
spin_lock(&BTRFS_I(inode)->lock);
BTRFS_I(inode)->outstanding_extents++;
spin_unlock(&BTRFS_I(inode)->lock);
else if (ret >= 0 && (size_t)ret < count)
btrfs_delalloc_release_space(inode,
count - (size_t)ret);
}
btrfs_delalloc_release_metadata(inode, 0);
else
btrfs_delalloc_release_metadata(inode, 0);
}
out:
if (wakeup)
Expand Down

0 comments on commit fbd3052

Please sign in to comment.