Merge branch 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs cleanups and fixes from Chris Mason: "We have another round of fixes and a few cleanups. I have a fix for short returns from btrfs_copy_from_user, which finally nails down a very hard to find regression we added in v4.6. Dave is pushing around gfp parameters, mostly to cleanup internal apis and make it a little more consistent. The rest are smaller fixes, and one speelling fixup patch" * 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (22 commits) Btrfs: fix handling of faults from btrfs_copy_from_user btrfs: fix string and comment grammatical issues and typos btrfs: scrub: Set bbio to NULL before calling btrfs_map_block Btrfs: fix unexpected return value of fiemap Btrfs: free sys_array eb as soon as possible btrfs: sink gfp parameter to convert_extent_bit btrfs: make state preallocation more speculative in __set_extent_bit btrfs: untangle gotos a bit in convert_extent_bit btrfs: untangle gotos a bit in __clear_extent_bit btrfs: untangle gotos a bit in __set_extent_bit btrfs: sink gfp parameter to set_record_extent_bits btrfs: sink gfp parameter to set_extent_new btrfs: sink gfp parameter to set_extent_defrag btrfs: sink gfp parameter to set_extent_delalloc btrfs: sink gfp parameter to clear_extent_dirty btrfs: sink gfp parameter to clear_record_extent_bits btrfs: sink gfp parameter to clear_extent_bits btrfs: sink gfp parameter to set_extent_bits btrfs: make find_workspace warn if there are no workspaces btrfs: make find_workspace always succeed ...
This commit is contained in:
@@ -1596,6 +1596,13 @@ again:
|
||||
|
||||
copied = btrfs_copy_from_user(pos, write_bytes, pages, i);
|
||||
|
||||
num_sectors = BTRFS_BYTES_TO_BLKS(root->fs_info,
|
||||
reserve_bytes);
|
||||
dirty_sectors = round_up(copied + sector_offset,
|
||||
root->sectorsize);
|
||||
dirty_sectors = BTRFS_BYTES_TO_BLKS(root->fs_info,
|
||||
dirty_sectors);
|
||||
|
||||
/*
|
||||
* if we have trouble faulting in the pages, fall
|
||||
* back to one page at a time
|
||||
@@ -1605,6 +1612,7 @@ again:
|
||||
|
||||
if (copied == 0) {
|
||||
force_page_uptodate = true;
|
||||
dirty_sectors = 0;
|
||||
dirty_pages = 0;
|
||||
} else {
|
||||
force_page_uptodate = false;
|
||||
@@ -1615,20 +1623,19 @@ again:
|
||||
/*
|
||||
* If we had a short copy we need to release the excess delaloc
|
||||
* bytes we reserved. We need to increment outstanding_extents
|
||||
* because btrfs_delalloc_release_space will decrement it, but
|
||||
* because btrfs_delalloc_release_space and
|
||||
* btrfs_delalloc_release_metadata will decrement it, but
|
||||
* we still have an outstanding extent for the chunk we actually
|
||||
* managed to copy.
|
||||
*/
|
||||
num_sectors = BTRFS_BYTES_TO_BLKS(root->fs_info,
|
||||
reserve_bytes);
|
||||
dirty_sectors = round_up(copied + sector_offset,
|
||||
root->sectorsize);
|
||||
dirty_sectors = BTRFS_BYTES_TO_BLKS(root->fs_info,
|
||||
dirty_sectors);
|
||||
|
||||
if (num_sectors > dirty_sectors) {
|
||||
release_bytes = (write_bytes - copied)
|
||||
& ~((u64)root->sectorsize - 1);
|
||||
/*
|
||||
* we round down because we don't want to count
|
||||
* any partial blocks actually sent through the
|
||||
* IO machines
|
||||
*/
|
||||
release_bytes = round_down(release_bytes - copied,
|
||||
root->sectorsize);
|
||||
if (copied > 0) {
|
||||
spin_lock(&BTRFS_I(inode)->lock);
|
||||
BTRFS_I(inode)->outstanding_extents++;
|
||||
@@ -2022,7 +2029,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
|
||||
BTRFS_I(inode)->last_trans
|
||||
<= root->fs_info->last_trans_committed)) {
|
||||
/*
|
||||
* We'v had everything committed since the last time we were
|
||||
* We've had everything committed since the last time we were
|
||||
* modified so clear this flag in case it was set for whatever
|
||||
* reason, it's no longer relevant.
|
||||
*/
|
||||
@@ -2370,7 +2377,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
|
||||
|
||||
/* Check the aligned pages after the first unaligned page,
|
||||
* if offset != orig_start, which means the first unaligned page
|
||||
* including serveral following pages are already in holes,
|
||||
* including several following pages are already in holes,
|
||||
* the extra check can be skipped */
|
||||
if (offset == orig_start) {
|
||||
/* after truncate page, check hole again */
|
||||
|
Reference in New Issue
Block a user