mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (114 commits) Btrfs: check for a null fs root when writing to the backup root log Btrfs: fix race during transaction joins Btrfs: fix a potential btrfs_bio leak on scrub fixups Btrfs: rename btrfs_bio multi -> bbio for consistency Btrfs: stop leaking btrfs_bios on readahead Btrfs: stop the readahead threads on failed mount Btrfs: fix extent_buffer leak in the metadata IO error handling Btrfs: fix the new inspection ioctls for 32 bit compat Btrfs: fix delayed insertion reservation Btrfs: ClearPageError during writepage and clean_tree_block Btrfs: be smarter about committing the transaction in reserve_metadata_bytes Btrfs: make a delayed_block_rsv for the delayed item insertion Btrfs: add a log of past tree roots btrfs: separate superblock items out of fs_info Btrfs: use the global reserve when truncating the free space cache inode Btrfs: release metadata from global reserve if we have to fallback for unlink Btrfs: make sure to flush queued bios if write_cache_pages waits Btrfs: fix extent pinning bugs in the tree log Btrfs: make sure btrfs_remove_free_space doesn't leak EAGAIN Btrfs: don't wait as long for more batches during SSD log commit ...
This commit is contained in:
commit
6a6662ced4
31 changed files with 5435 additions and 1615 deletions
|
@ -1069,6 +1069,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
|
|||
int i;
|
||||
unsigned long index = pos >> PAGE_CACHE_SHIFT;
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
|
||||
int err = 0;
|
||||
int faili = 0;
|
||||
u64 start_pos;
|
||||
|
@ -1080,7 +1081,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
|
|||
again:
|
||||
for (i = 0; i < num_pages; i++) {
|
||||
pages[i] = find_or_create_page(inode->i_mapping, index + i,
|
||||
GFP_NOFS);
|
||||
mask);
|
||||
if (!pages[i]) {
|
||||
faili = i - 1;
|
||||
err = -ENOMEM;
|
||||
|
@ -1615,10 +1616,6 @@ static long btrfs_fallocate(struct file *file, int mode,
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
locked_end = alloc_end - 1;
|
||||
while (1) {
|
||||
struct btrfs_ordered_extent *ordered;
|
||||
|
@ -1664,11 +1661,27 @@ static long btrfs_fallocate(struct file *file, int mode,
|
|||
if (em->block_start == EXTENT_MAP_HOLE ||
|
||||
(cur_offset >= inode->i_size &&
|
||||
!test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) {
|
||||
|
||||
/*
|
||||
* Make sure we have enough space before we do the
|
||||
* allocation.
|
||||
*/
|
||||
ret = btrfs_check_data_free_space(inode, last_byte -
|
||||
cur_offset);
|
||||
if (ret) {
|
||||
free_extent_map(em);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = btrfs_prealloc_file_range(inode, mode, cur_offset,
|
||||
last_byte - cur_offset,
|
||||
1 << inode->i_blkbits,
|
||||
offset + len,
|
||||
&alloc_hint);
|
||||
|
||||
/* Let go of our reservation. */
|
||||
btrfs_free_reserved_data_space(inode, last_byte -
|
||||
cur_offset);
|
||||
if (ret < 0) {
|
||||
free_extent_map(em);
|
||||
break;
|
||||
|
@ -1694,8 +1707,6 @@ static long btrfs_fallocate(struct file *file, int mode,
|
|||
}
|
||||
unlock_extent_cached(&BTRFS_I(inode)->io_tree, alloc_start, locked_end,
|
||||
&cached_state, GFP_NOFS);
|
||||
|
||||
btrfs_free_reserved_data_space(inode, alloc_end - alloc_start);
|
||||
out:
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue