diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7d4f948bc22a..13a17477c4f4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1502,6 +1502,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1502 | struct btrfs_trans_handle *trans; | 1502 | struct btrfs_trans_handle *trans; |
1503 | struct btrfs_ordered_extent *ordered_extent; | 1503 | struct btrfs_ordered_extent *ordered_extent; |
1504 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 1504 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
1505 | struct btrfs_path *path; | ||
1505 | int compressed = 0; | 1506 | int compressed = 0; |
1506 | int ret; | 1507 | int ret; |
1507 | 1508 | ||
@@ -1509,6 +1510,23 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1509 | if (!ret) | 1510 | if (!ret) |
1510 | return 0; | 1511 | return 0; |
1511 | 1512 | ||
1513 | /* | ||
1514 | * before we join the transaction, try to do some of our IO. | ||
1515 | * This will limit the amount of IO that we have to do with | ||
1516 | * the transaction running. We're unlikely to need to do any | ||
1517 | * IO if the file extents are new, the disk_i_size checks | ||
1518 | * covers the most common case. | ||
1519 | */ | ||
1520 | if (start < BTRFS_I(inode)->disk_i_size) { | ||
1521 | path = btrfs_alloc_path(); | ||
1522 | if (path) { | ||
1523 | ret = btrfs_lookup_file_extent(NULL, root, path, | ||
1524 | inode->i_ino, | ||
1525 | start, 0); | ||
1526 | btrfs_free_path(path); | ||
1527 | } | ||
1528 | } | ||
1529 | |||
1512 | trans = btrfs_join_transaction(root, 1); | 1530 | trans = btrfs_join_transaction(root, 1); |
1513 | 1531 | ||
1514 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); | 1532 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); |