diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-24 12:02:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-24 12:02:53 -0500 |
commit | 855a85f704026d5fe7de94fb1b765fe03404507f (patch) | |
tree | 553817c0f7230e104623dc7e8a900bbbcc881d3e /fs/btrfs/file.c | |
parent | ee3253241a928f6c5c40960629d7071eb6a4b23c (diff) | |
parent | e77266e4c4be6f9dc91bf688bce015a8babd5fe0 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Quoth Chris:
"This is later than I wanted because I got backed up running through
btrfs bugs from the Oracle QA teams. But they are all bug fixes that
we've queued and tested since rc1.
Nothing in particular stands out, this just reflects bug fixing and QA
done in parallel by all the btrfs developers. The most user visible
of these is:
Btrfs: clear the extent uptodate bits during parent transid failures
Because that helps deal with out of date drives (say an iscsi disk
that has gone away and come back). The old code wasn't always
properly retrying the other mirror for this type of failure."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (24 commits)
Btrfs: fix compiler warnings on 32 bit systems
Btrfs: increase the global block reserve estimates
Btrfs: clear the extent uptodate bits during parent transid failures
Btrfs: add extra sanity checks on the path names in btrfs_mksubvol
Btrfs: make sure we update latest_bdev
Btrfs: improve error handling for btrfs_insert_dir_item callers
Btrfs: be less strict on finding next node in clear_extent_bit
Btrfs: fix a bug on overcommit stuff
Btrfs: kick out redundant stuff in convert_extent_bit
Btrfs: skip states when they does not contain bits to clear
Btrfs: check return value of lookup_extent_mapping() correctly
Btrfs: fix deadlock on page lock when doing auto-defragment
Btrfs: fix return value check of extent_io_ops
btrfs: honor umask when creating subvol root
btrfs: silence warning in raid array setup
btrfs: fix structs where bitfields and spinlock/atomic share 8B word
btrfs: delalloc for page dirtied out-of-band in fixup worker
Btrfs: fix memory leak in load_free_space_cache()
btrfs: don't check DUP chunks twice
Btrfs: fix trim 0 bytes after a device delete
...
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 859ba2dd8890..e8d06b6b9194 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1605,6 +1605,14 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1605 | return -EOPNOTSUPP; | 1605 | return -EOPNOTSUPP; |
1606 | 1606 | ||
1607 | /* | 1607 | /* |
1608 | * Make sure we have enough space before we do the | ||
1609 | * allocation. | ||
1610 | */ | ||
1611 | ret = btrfs_check_data_free_space(inode, len); | ||
1612 | if (ret) | ||
1613 | return ret; | ||
1614 | |||
1615 | /* | ||
1608 | * wait for ordered IO before we have any locks. We'll loop again | 1616 | * wait for ordered IO before we have any locks. We'll loop again |
1609 | * below with the locks held. | 1617 | * below with the locks held. |
1610 | */ | 1618 | */ |
@@ -1667,27 +1675,12 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1667 | if (em->block_start == EXTENT_MAP_HOLE || | 1675 | if (em->block_start == EXTENT_MAP_HOLE || |
1668 | (cur_offset >= inode->i_size && | 1676 | (cur_offset >= inode->i_size && |
1669 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { | 1677 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { |
1670 | |||
1671 | /* | ||
1672 | * Make sure we have enough space before we do the | ||
1673 | * allocation. | ||
1674 | */ | ||
1675 | ret = btrfs_check_data_free_space(inode, last_byte - | ||
1676 | cur_offset); | ||
1677 | if (ret) { | ||
1678 | free_extent_map(em); | ||
1679 | break; | ||
1680 | } | ||
1681 | |||
1682 | ret = btrfs_prealloc_file_range(inode, mode, cur_offset, | 1678 | ret = btrfs_prealloc_file_range(inode, mode, cur_offset, |
1683 | last_byte - cur_offset, | 1679 | last_byte - cur_offset, |
1684 | 1 << inode->i_blkbits, | 1680 | 1 << inode->i_blkbits, |
1685 | offset + len, | 1681 | offset + len, |
1686 | &alloc_hint); | 1682 | &alloc_hint); |
1687 | 1683 | ||
1688 | /* Let go of our reservation. */ | ||
1689 | btrfs_free_reserved_data_space(inode, last_byte - | ||
1690 | cur_offset); | ||
1691 | if (ret < 0) { | 1684 | if (ret < 0) { |
1692 | free_extent_map(em); | 1685 | free_extent_map(em); |
1693 | break; | 1686 | break; |
@@ -1715,6 +1708,8 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1715 | &cached_state, GFP_NOFS); | 1708 | &cached_state, GFP_NOFS); |
1716 | out: | 1709 | out: |
1717 | mutex_unlock(&inode->i_mutex); | 1710 | mutex_unlock(&inode->i_mutex); |
1711 | /* Let go of our reservation. */ | ||
1712 | btrfs_free_reserved_data_space(inode, len); | ||
1718 | return ret; | 1713 | return ret; |
1719 | } | 1714 | } |
1720 | 1715 | ||
@@ -1761,7 +1756,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | |||
1761 | start - root->sectorsize, | 1756 | start - root->sectorsize, |
1762 | root->sectorsize, 0); | 1757 | root->sectorsize, 0); |
1763 | if (IS_ERR(em)) { | 1758 | if (IS_ERR(em)) { |
1764 | ret = -ENXIO; | 1759 | ret = PTR_ERR(em); |
1765 | goto out; | 1760 | goto out; |
1766 | } | 1761 | } |
1767 | last_end = em->start + em->len; | 1762 | last_end = em->start + em->len; |
@@ -1773,7 +1768,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | |||
1773 | while (1) { | 1768 | while (1) { |
1774 | em = btrfs_get_extent_fiemap(inode, NULL, 0, start, len, 0); | 1769 | em = btrfs_get_extent_fiemap(inode, NULL, 0, start, len, 0); |
1775 | if (IS_ERR(em)) { | 1770 | if (IS_ERR(em)) { |
1776 | ret = -ENXIO; | 1771 | ret = PTR_ERR(em); |
1777 | break; | 1772 | break; |
1778 | } | 1773 | } |
1779 | 1774 | ||