Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67d2433e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix reservations in btrfs_page_mkwrite
  Btrfs: advance window_start if we're using a bitmap
  btrfs: mask out gfp flags in releasepage
  Btrfs: fix enospc error caused by wrong checks of the chunk
  Btrfs: do not defrag a file partially
  Btrfs: fix warning for 32-bit build of fs/btrfs/check-integrity.c
  Btrfs: use cluster->window_start when allocating from a cluster bitmap
  Btrfs: Check for NULL page in extent_range_uptodate
  btrfs: Fix busyloops in transaction waiting code
  Btrfs: make sure a bitmap has enough bytes
  Btrfs: fix uninit warning in backref.c
parents 1c36ab1a 9998eb70
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -297,7 +297,7 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
	struct rb_node *n = &head->node.rb_node;
	struct rb_node *n = &head->node.rb_node;
	int sgn;
	int sgn;
	int ret;
	int ret = 0;


	if (extent_op && extent_op->update_key)
	if (extent_op && extent_op->update_key)
		btrfs_disk_key_to_cpu(info_key, &extent_op->key);
		btrfs_disk_key_to_cpu(info_key, &extent_op->key);
@@ -392,7 +392,7 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
			     struct btrfs_key *info_key, int *info_level,
			     struct btrfs_key *info_key, int *info_level,
			     struct list_head *prefs)
			     struct list_head *prefs)
{
{
	int ret;
	int ret = 0;
	int slot;
	int slot;
	struct extent_buffer *leaf;
	struct extent_buffer *leaf;
	struct btrfs_key key;
	struct btrfs_key key;
+6 −5
Original line number Original line Diff line number Diff line
@@ -1662,7 +1662,7 @@ static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state,
	block = btrfsic_block_hashtable_lookup(bdev, dev_bytenr,
	block = btrfsic_block_hashtable_lookup(bdev, dev_bytenr,
					       &state->block_hashtable);
					       &state->block_hashtable);
	if (NULL != block) {
	if (NULL != block) {
		u64 bytenr;
		u64 bytenr = 0;
		struct list_head *elem_ref_to;
		struct list_head *elem_ref_to;
		struct list_head *tmp_ref_to;
		struct list_head *tmp_ref_to;


@@ -2777,9 +2777,10 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
			printk(KERN_INFO
			printk(KERN_INFO
			       "submit_bh(rw=0x%x, blocknr=%lu (bytenr %llu),"
			       "submit_bh(rw=0x%x, blocknr=%lu (bytenr %llu),"
			       " size=%lu, data=%p, bdev=%p)\n",
			       " size=%lu, data=%p, bdev=%p)\n",
			       rw, bh->b_blocknr,
			       rw, (unsigned long)bh->b_blocknr,
			       (unsigned long long)dev_bytenr, bh->b_size,
			       (unsigned long long)dev_bytenr,
			       bh->b_data, bh->b_bdev);
			       (unsigned long)bh->b_size, bh->b_data,
			       bh->b_bdev);
		btrfsic_process_written_block(dev_state, dev_bytenr,
		btrfsic_process_written_block(dev_state, dev_bytenr,
					      bh->b_data, bh->b_size, NULL,
					      bh->b_data, bh->b_size, NULL,
					      NULL, bh, rw);
					      NULL, bh, rw);
@@ -2844,7 +2845,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
			printk(KERN_INFO
			printk(KERN_INFO
			       "submit_bio(rw=0x%x, bi_vcnt=%u,"
			       "submit_bio(rw=0x%x, bi_vcnt=%u,"
			       " bi_sector=%lu (bytenr %llu), bi_bdev=%p)\n",
			       " bi_sector=%lu (bytenr %llu), bi_bdev=%p)\n",
			       rw, bio->bi_vcnt, bio->bi_sector,
			       rw, bio->bi_vcnt, (unsigned long)bio->bi_sector,
			       (unsigned long long)dev_bytenr,
			       (unsigned long long)dev_bytenr,
			       bio->bi_bdev);
			       bio->bi_bdev);


+7 −0
Original line number Original line Diff line number Diff line
@@ -962,6 +962,13 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
	tree = &BTRFS_I(page->mapping->host)->io_tree;
	tree = &BTRFS_I(page->mapping->host)->io_tree;
	map = &BTRFS_I(page->mapping->host)->extent_tree;
	map = &BTRFS_I(page->mapping->host)->extent_tree;


	/*
	 * We need to mask out eg. __GFP_HIGHMEM and __GFP_DMA32 as we're doing
	 * slab allocation from alloc_extent_state down the callchain where
	 * it'd hit a BUG_ON as those flags are not allowed.
	 */
	gfp_flags &= ~GFP_SLAB_BUG_MASK;

	ret = try_release_extent_state(map, tree, page, gfp_flags);
	ret = try_release_extent_state(map, tree, page, gfp_flags);
	if (!ret)
	if (!ret)
		return 0;
		return 0;
+27 −22
Original line number Original line Diff line number Diff line
@@ -34,23 +34,24 @@
#include "locking.h"
#include "locking.h"
#include "free-space-cache.h"
#include "free-space-cache.h"


/* control flags for do_chunk_alloc's force field
/*
 * control flags for do_chunk_alloc's force field
 * CHUNK_ALLOC_NO_FORCE means to only allocate a chunk
 * CHUNK_ALLOC_NO_FORCE means to only allocate a chunk
 * if we really need one.
 * if we really need one.
 *
 *
 * CHUNK_ALLOC_FORCE means it must try to allocate one
 *
 * CHUNK_ALLOC_LIMITED means to only try and allocate one
 * CHUNK_ALLOC_LIMITED means to only try and allocate one
 * if we have very few chunks already allocated.  This is
 * if we have very few chunks already allocated.  This is
 * used as part of the clustering code to help make sure
 * used as part of the clustering code to help make sure
 * we have a good pool of storage to cluster in, without
 * we have a good pool of storage to cluster in, without
 * filling the FS with empty chunks
 * filling the FS with empty chunks
 *
 *
 * CHUNK_ALLOC_FORCE means it must try to allocate one
 *
 */
 */
enum {
enum {
	CHUNK_ALLOC_NO_FORCE = 0,
	CHUNK_ALLOC_NO_FORCE = 0,
	CHUNK_ALLOC_FORCE = 1,
	CHUNK_ALLOC_LIMITED = 1,
	CHUNK_ALLOC_LIMITED = 2,
	CHUNK_ALLOC_FORCE = 2,
};
};


/*
/*
@@ -3414,7 +3415,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,


again:
again:
	spin_lock(&space_info->lock);
	spin_lock(&space_info->lock);
	if (space_info->force_alloc)
	if (force < space_info->force_alloc)
		force = space_info->force_alloc;
		force = space_info->force_alloc;
	if (space_info->full) {
	if (space_info->full) {
		spin_unlock(&space_info->lock);
		spin_unlock(&space_info->lock);
@@ -5794,6 +5795,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
			 u64 search_end, struct btrfs_key *ins,
			 u64 search_end, struct btrfs_key *ins,
			 u64 data)
			 u64 data)
{
{
	bool final_tried = false;
	int ret;
	int ret;
	u64 search_start = 0;
	u64 search_start = 0;


@@ -5813,15 +5815,17 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
			       search_start, search_end, hint_byte,
			       search_start, search_end, hint_byte,
			       ins, data);
			       ins, data);


	if (ret == -ENOSPC && num_bytes > min_alloc_size) {
	if (ret == -ENOSPC) {
		if (!final_tried) {
			num_bytes = num_bytes >> 1;
			num_bytes = num_bytes >> 1;
			num_bytes = num_bytes & ~(root->sectorsize - 1);
			num_bytes = num_bytes & ~(root->sectorsize - 1);
			num_bytes = max(num_bytes, min_alloc_size);
			num_bytes = max(num_bytes, min_alloc_size);
			do_chunk_alloc(trans, root->fs_info->extent_root,
			do_chunk_alloc(trans, root->fs_info->extent_root,
				       num_bytes, data, CHUNK_ALLOC_FORCE);
				       num_bytes, data, CHUNK_ALLOC_FORCE);
			if (num_bytes == min_alloc_size)
				final_tried = true;
			goto again;
			goto again;
	}
		} else if (btrfs_test_opt(root, ENOSPC_DEBUG)) {
	if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) {
			struct btrfs_space_info *sinfo;
			struct btrfs_space_info *sinfo;


			sinfo = __find_space_info(root->fs_info, data);
			sinfo = __find_space_info(root->fs_info, data);
@@ -5830,6 +5834,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
			       (unsigned long long)num_bytes);
			       (unsigned long long)num_bytes);
			dump_space_info(sinfo, num_bytes, 1);
			dump_space_info(sinfo, num_bytes, 1);
		}
		}
	}


	trace_btrfs_reserved_extent_alloc(root, ins->objectid, ins->offset);
	trace_btrfs_reserved_extent_alloc(root, ins->objectid, ins->offset);


+2 −0
Original line number Original line Diff line number Diff line
@@ -3909,6 +3909,8 @@ int extent_range_uptodate(struct extent_io_tree *tree,
	while (start <= end) {
	while (start <= end) {
		index = start >> PAGE_CACHE_SHIFT;
		index = start >> PAGE_CACHE_SHIFT;
		page = find_get_page(tree->mapping, index);
		page = find_get_page(tree->mapping, index);
		if (!page)
			return 1;
		uptodate = PageUptodate(page);
		uptodate = PageUptodate(page);
		page_cache_release(page);
		page_cache_release(page);
		if (!uptodate) {
		if (!uptodate) {
Loading