All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL] [PATCH 00/11] Cleanups for 4.1
@ 2015-02-25 18:24 David Sterba
  2015-02-25 18:24 ` [PATCH 01/11] btrfs: need_resched not needed with cond_resched David Sterba
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba, clm

Hi,

a few cleanups that accumulated over time. No real fixes but there are changes
that may touch functionality (no fstests complaints though).

  git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanups-for-4.1

all merged together, but are also available in the following topic branches
based on current for-linus branch.

cleanup/sched
cleanup/divs
cleanup/kmalloc-array
cleanup/shadow-vars
cleanup/initializers

David Sterba (11):
  btrfs: need_resched not needed with cond_resched
  btrfs: use cond_resched_lock where possible
  btrfs: cleanup 64bit/32bit divs, compile time constants
  btrfs: cleanup 64bit/32bit divs, provably bounded values
  btrfs: replace remaining do_div calls with div_u64 variants
  btrfs: cleanup, use correct type in div_u64_rem
  btrfs: cleanup, use kmalloc_array/kcalloc array helpers
  btrfs: remove shadowing variables in __btrfs_buffered_write
  btrfs: switch helper macros to static inlines in sysfs.h
  btrfs: remove shadowing variables in __btrfs_map_block
  btrfs: use explicit initializer for seq_elem

 fs/btrfs/backref.c          |  4 +--
 fs/btrfs/check-integrity.c  |  4 +--
 fs/btrfs/compression.c      |  2 +-
 fs/btrfs/ctree.c            |  9 +++--
 fs/btrfs/ctree.h            |  2 ++
 fs/btrfs/dev-replace.c      |  6 ++--
 fs/btrfs/disk-io.c          |  4 +--
 fs/btrfs/extent-tree.c      | 21 ++++++------
 fs/btrfs/file-item.c        |  4 +--
 fs/btrfs/file.c             | 12 +++----
 fs/btrfs/free-space-cache.c | 34 ++++++++-----------
 fs/btrfs/inode.c            |  2 +-
 fs/btrfs/ioctl.c            |  4 +--
 fs/btrfs/math.h             |  6 ++--
 fs/btrfs/qgroup.c           |  6 ++--
 fs/btrfs/raid56.c           |  3 +-
 fs/btrfs/scrub.c            | 23 ++++++-------
 fs/btrfs/super.c            |  2 +-
 fs/btrfs/sysfs.h            | 22 ++++++++++---
 fs/btrfs/transaction.c      |  7 ++--
 fs/btrfs/volumes.c          | 80 ++++++++++++++++++++++-----------------------
 21 files changed, 125 insertions(+), 132 deletions(-)

-- 
2.1.3


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/11] btrfs: need_resched not needed with cond_resched
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 02/11] btrfs: use cond_resched_lock where possible David Sterba
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Cleanup, no special reason to do

if (need_resched())
        cond_resched();

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/volumes.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8222f6f74147..50bb7b8b17e8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -366,8 +366,8 @@ loop_lock:
 		btrfsic_submit_bio(cur->bi_rw, cur);
 		num_run++;
 		batch_run++;
-		if (need_resched())
-			cond_resched();
+
+		cond_resched();
 
 		/*
 		 * we made progress, there is more work to do and the bdi
@@ -400,8 +400,7 @@ loop_lock:
 				 * against it before looping
 				 */
 				last_waited = ioc->last_waited;
-				if (need_resched())
-					cond_resched();
+				cond_resched();
 				continue;
 			}
 			spin_lock(&device->io_lock);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/11] btrfs: use cond_resched_lock where possible
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
  2015-02-25 18:24 ` [PATCH 01/11] btrfs: need_resched not needed with cond_resched David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 03/11] btrfs: cleanup 64bit/32bit divs, compile time constants David Sterba
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Clean the opencoded variant, cond_resched_lock also checks the lock for
contention so it might help in some cases that were not covered by
simple need_resched().

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/file.c             |  6 +-----
 fs/btrfs/free-space-cache.c | 14 ++++----------
 fs/btrfs/transaction.c      |  7 ++-----
 3 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index e4090259569b..1e34bc00249f 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -273,11 +273,7 @@ void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info)
 		defrag = rb_entry(node, struct inode_defrag, rb_node);
 		kmem_cache_free(btrfs_inode_defrag_cachep, defrag);
 
-		if (need_resched()) {
-			spin_unlock(&fs_info->defrag_inodes_lock);
-			cond_resched();
-			spin_lock(&fs_info->defrag_inodes_lock);
-		}
+		cond_resched_lock(&fs_info->defrag_inodes_lock);
 
 		node = rb_first(&fs_info->defrag_inodes);
 	}
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index a71978578fa7..96611fed552f 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2402,11 +2402,8 @@ static void __btrfs_remove_free_space_cache_locked(
 		} else {
 			free_bitmap(ctl, info);
 		}
-		if (need_resched()) {
-			spin_unlock(&ctl->tree_lock);
-			cond_resched();
-			spin_lock(&ctl->tree_lock);
-		}
+
+		cond_resched_lock(&ctl->tree_lock);
 	}
 }
 
@@ -2431,11 +2428,8 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group)
 
 		WARN_ON(cluster->block_group != block_group);
 		__btrfs_return_cluster_to_free_space(block_group, cluster);
-		if (need_resched()) {
-			spin_unlock(&ctl->tree_lock);
-			cond_resched();
-			spin_lock(&ctl->tree_lock);
-		}
+
+		cond_resched_lock(&ctl->tree_lock);
 	}
 	__btrfs_remove_free_space_cache_locked(ctl);
 	spin_unlock(&ctl->tree_lock);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 038fcf6051e0..efc5ebffa7ea 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -93,11 +93,8 @@ static void clear_btree_io_tree(struct extent_io_tree *tree)
 		 */
 		ASSERT(!waitqueue_active(&state->wq));
 		free_extent_state(state);
-		if (need_resched()) {
-			spin_unlock(&tree->lock);
-			cond_resched();
-			spin_lock(&tree->lock);
-		}
+
+		cond_resched_lock(&tree->lock);
 	}
 	spin_unlock(&tree->lock);
 }
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/11] btrfs: cleanup 64bit/32bit divs, compile time constants
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
  2015-02-25 18:24 ` [PATCH 01/11] btrfs: need_resched not needed with cond_resched David Sterba
  2015-02-25 18:24 ` [PATCH 02/11] btrfs: use cond_resched_lock where possible David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 04/11] btrfs: cleanup 64bit/32bit divs, provably bounded values David Sterba
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Switch to div_u64 if the divisor is a numeric constant or sum of
sizeof()s. We can remove a few instances of do_div that has the hidden
semtantics of changing the 1st argument.

Small power-of-two divisors are converted to bitshifts, large values are
kept intact for clarity.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/dev-replace.c      |  6 +++---
 fs/btrfs/disk-io.c          |  2 +-
 fs/btrfs/extent-tree.c      | 15 +++++++--------
 fs/btrfs/free-space-cache.c |  8 ++++----
 fs/btrfs/math.h             |  6 ++----
 fs/btrfs/super.c            |  2 +-
 6 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 5ec03d999c37..0573848c7333 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -670,8 +670,8 @@ void btrfs_dev_replace_status(struct btrfs_fs_info *fs_info,
 	case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:
 	case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
 		srcdev = dev_replace->srcdev;
-		args->status.progress_1000 = div64_u64(dev_replace->cursor_left,
-			div64_u64(btrfs_device_get_total_bytes(srcdev), 1000));
+		args->status.progress_1000 = div_u64(dev_replace->cursor_left,
+			div_u64(btrfs_device_get_total_bytes(srcdev), 1000));
 		break;
 	}
 	btrfs_dev_replace_unlock(dev_replace);
@@ -806,7 +806,7 @@ static int btrfs_dev_replace_kthread(void *data)
 		btrfs_dev_replace_status(fs_info, status_args);
 		progress = status_args->status.progress_1000;
 		kfree(status_args);
-		do_div(progress, 10);
+		progress = div_u64(progress, 10);
 		printk_in_rcu(KERN_INFO
 			"BTRFS: continuing dev_replace from %s (devid %llu) to %s @%u%%\n",
 			dev_replace->srcdev->missing ? "<missing disk>" :
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 41b320e235d7..73b152138221 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2277,7 +2277,7 @@ int open_ctree(struct super_block *sb,
 	fs_info->free_chunk_space = 0;
 	fs_info->tree_mod_log = RB_ROOT;
 	fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
-	fs_info->avg_delayed_ref_runtime = div64_u64(NSEC_PER_SEC, 64);
+	fs_info->avg_delayed_ref_runtime = NSEC_PER_SEC >> 6; /* div by 64 */
 	/* readahead state */
 	INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_WAIT);
 	spin_lock_init(&fs_info->reada_lock);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 28ce5c8004d4..2cb32bc45bcc 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2561,8 +2561,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 		 */
 		spin_lock(&delayed_refs->lock);
 		avg = fs_info->avg_delayed_ref_runtime * 3 + runtime;
-		avg = div64_u64(avg, 4);
-		fs_info->avg_delayed_ref_runtime = avg;
+		fs_info->avg_delayed_ref_runtime = avg >> 2;	/* div by 4 */
 		spin_unlock(&delayed_refs->lock);
 	}
 	return 0;
@@ -2624,7 +2623,7 @@ static inline u64 heads_to_leaves(struct btrfs_root *root, u64 heads)
 	 * We don't ever fill up leaves all the way so multiply by 2 just to be
 	 * closer to what we're really going to want to ouse.
 	 */
-	return div64_u64(num_bytes, BTRFS_LEAF_DATA_SIZE(root));
+	return div_u64(num_bytes, BTRFS_LEAF_DATA_SIZE(root));
 }
 
 int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans,
@@ -3193,7 +3192,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
 	struct inode *inode = NULL;
 	u64 alloc_hint = 0;
 	int dcs = BTRFS_DC_ERROR;
-	int num_pages = 0;
+	u64 num_pages = 0;
 	int retries = 0;
 	int ret = 0;
 
@@ -3277,7 +3276,7 @@ again:
 	 * taking up quite a bit since it's not folded into the other space
 	 * cache.
 	 */
-	num_pages = (int)div64_u64(block_group->key.offset, 256 * 1024 * 1024);
+	num_pages = div_u64(block_group->key.offset, 256 * 1024 * 1024);
 	if (!num_pages)
 		num_pages = 1;
 
@@ -4770,10 +4769,10 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info)
 
 	num_bytes = (data_used >> fs_info->sb->s_blocksize_bits) *
 		    csum_size * 2;
-	num_bytes += div64_u64(data_used + meta_used, 50);
+	num_bytes += div_u64(data_used + meta_used, 50);
 
 	if (num_bytes * 3 > meta_used)
-		num_bytes = div64_u64(meta_used, 3);
+		num_bytes = div_u64(meta_used, 3);
 
 	return ALIGN(num_bytes, fs_info->extent_root->nodesize << 10);
 }
@@ -5039,7 +5038,7 @@ static u64 calc_csum_metadata_size(struct inode *inode, u64 num_bytes,
 	else
 		BTRFS_I(inode)->csum_bytes -= num_bytes;
 	csum_size = BTRFS_LEAF_DATA_SIZE(root) - sizeof(struct btrfs_item);
-	num_csums_per_leaf = (int)div64_u64(csum_size,
+	num_csums_per_leaf = (int)div_u64(csum_size,
 					    sizeof(struct btrfs_csum_item) +
 					    sizeof(struct btrfs_disk_key));
 	num_csums = (int)div64_u64(BTRFS_I(inode)->csum_bytes, root->sectorsize);
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 96611fed552f..cb84923561e4 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1537,7 +1537,7 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
 		max_bytes = MAX_CACHE_BYTES_PER_GIG;
 	else
 		max_bytes = MAX_CACHE_BYTES_PER_GIG *
-			div64_u64(size, 1024 * 1024 * 1024);
+			div_u64(size, 1024 * 1024 * 1024);
 
 	/*
 	 * we want to account for 1 more bitmap than what we have so we can make
@@ -1552,14 +1552,14 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
 	}
 
 	/*
-	 * we want the extent entry threshold to always be at most 1/2 the maxw
+	 * we want the extent entry threshold to always be at most 1/2 the max
 	 * bytes we can have, or whatever is less than that.
 	 */
 	extent_bytes = max_bytes - bitmap_bytes;
-	extent_bytes = min_t(u64, extent_bytes, div64_u64(max_bytes, 2));
+	extent_bytes = min_t(u64, extent_bytes, max_bytes >> 1);
 
 	ctl->extents_thresh =
-		div64_u64(extent_bytes, (sizeof(struct btrfs_free_space)));
+		div_u64(extent_bytes, sizeof(struct btrfs_free_space));
 }
 
 static inline void __bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
diff --git a/fs/btrfs/math.h b/fs/btrfs/math.h
index b7816cefbd13..1b10a3cd1195 100644
--- a/fs/btrfs/math.h
+++ b/fs/btrfs/math.h
@@ -28,8 +28,7 @@ static inline u64 div_factor(u64 num, int factor)
 	if (factor == 10)
 		return num;
 	num *= factor;
-	do_div(num, 10);
-	return num;
+	return div_u64(num, 10);
 }
 
 static inline u64 div_factor_fine(u64 num, int factor)
@@ -37,8 +36,7 @@ static inline u64 div_factor_fine(u64 num, int factor)
 	if (factor == 100)
 		return num;
 	num *= factor;
-	do_div(num, 100);
-	return num;
+	return div_u64(num, 100);
 }
 
 #endif
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 100a0442c413..530a0baa7c71 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1704,7 +1704,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes)
 		avail_space = device->total_bytes - device->bytes_used;
 
 		/* align with stripe_len */
-		do_div(avail_space, BTRFS_STRIPE_LEN);
+		avail_space = div_u64(avail_space, BTRFS_STRIPE_LEN);
 		avail_space *= BTRFS_STRIPE_LEN;
 
 		/*
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/11] btrfs: cleanup 64bit/32bit divs, provably bounded values
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (2 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 03/11] btrfs: cleanup 64bit/32bit divs, compile time constants David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 05/11] btrfs: replace remaining do_div calls with div_u64 variants David Sterba
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The divisor is derived from nodesize or PAGE_SIZE, fits into 32bit type.
Get rid of a few more do_div instances.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/extent-tree.c      |  4 ++--
 fs/btrfs/free-space-cache.c |  8 ++++----
 fs/btrfs/ioctl.c            |  2 +-
 fs/btrfs/scrub.c            |  8 +++-----
 fs/btrfs/volumes.c          | 26 +++++++++++++-------------
 5 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 2cb32bc45bcc..4ccc3397c644 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5032,7 +5032,7 @@ static u64 calc_csum_metadata_size(struct inode *inode, u64 num_bytes,
 	    BTRFS_I(inode)->csum_bytes == 0)
 		return 0;
 
-	old_csums = (int)div64_u64(BTRFS_I(inode)->csum_bytes, root->sectorsize);
+	old_csums = (int)div_u64(BTRFS_I(inode)->csum_bytes, root->sectorsize);
 	if (reserve)
 		BTRFS_I(inode)->csum_bytes += num_bytes;
 	else
@@ -5041,7 +5041,7 @@ static u64 calc_csum_metadata_size(struct inode *inode, u64 num_bytes,
 	num_csums_per_leaf = (int)div_u64(csum_size,
 					    sizeof(struct btrfs_csum_item) +
 					    sizeof(struct btrfs_disk_key));
-	num_csums = (int)div64_u64(BTRFS_I(inode)->csum_bytes, root->sectorsize);
+	num_csums = (int)div_u64(BTRFS_I(inode)->csum_bytes, root->sectorsize);
 	num_csums = num_csums + num_csums_per_leaf - 1;
 	num_csums = num_csums / num_csums_per_leaf;
 
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index cb84923561e4..16cc62b87ba5 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1298,11 +1298,11 @@ static inline u64 offset_to_bitmap(struct btrfs_free_space_ctl *ctl,
 				   u64 offset)
 {
 	u64 bitmap_start;
-	u64 bytes_per_bitmap;
+	u32 bytes_per_bitmap;
 
 	bytes_per_bitmap = BITS_PER_BITMAP * ctl->unit;
 	bitmap_start = offset - ctl->start;
-	bitmap_start = div64_u64(bitmap_start, bytes_per_bitmap);
+	bitmap_start = div_u64(bitmap_start, bytes_per_bitmap);
 	bitmap_start *= bytes_per_bitmap;
 	bitmap_start += ctl->start;
 
@@ -1521,8 +1521,8 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
 	u64 bitmap_bytes;
 	u64 extent_bytes;
 	u64 size = block_group->key.offset;
-	u64 bytes_per_bg = BITS_PER_BITMAP * ctl->unit;
-	int max_bitmaps = div64_u64(size + bytes_per_bg - 1, bytes_per_bg);
+	u32 bytes_per_bg = BITS_PER_BITMAP * ctl->unit;
+	u32 max_bitmaps = div_u64(size + bytes_per_bg - 1, bytes_per_bg);
 
 	max_bitmaps = max(max_bitmaps, 1);
 
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d49fe8a0f6b5..5544a79dc2ba 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1564,7 +1564,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 		goto out_free;
 	}
 
-	do_div(new_size, root->sectorsize);
+	new_size = div_u64(new_size, root->sectorsize);
 	new_size *= root->sectorsize;
 
 	printk_in_rcu(KERN_INFO "BTRFS: new size for %s is %llu\n",
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index db21f17df996..07be15d4ce7b 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2624,9 +2624,8 @@ static int get_raid56_logic_offset(u64 physical, int num,
 	for (i = 0; i < nr_data_stripes(map); i++) {
 		*offset = last_offset + i * map->stripe_len;
 
-		stripe_nr = *offset;
-		do_div(stripe_nr, map->stripe_len);
-		do_div(stripe_nr, nr_data_stripes(map));
+		stripe_nr = div_u64(*offset, map->stripe_len);
+		stripe_nr = div_u64(stripe_nr, nr_data_stripes(map));
 
 		/* Work out the disk rotation on this stripe-set */
 		rot = do_div(stripe_nr, map->num_stripes);
@@ -2995,10 +2994,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 	int extent_mirror_num;
 	int stop_loop = 0;
 
-	nstripes = length;
 	physical = map->stripes[num].physical;
 	offset = 0;
-	do_div(nstripes, map->stripe_len);
+	nstripes = div_u64(length, map->stripe_len);
 	if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
 		offset = map->stripe_len * num;
 		increment = map->stripe_len * map->num_stripes;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 50bb7b8b17e8..446e4b24fc14 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3021,7 +3021,7 @@ static int chunk_drange_filter(struct extent_buffer *leaf,
 
 		stripe_offset = btrfs_stripe_offset(leaf, stripe);
 		stripe_length = btrfs_chunk_length(leaf, chunk);
-		do_div(stripe_length, factor);
+		stripe_length = div_u64(stripe_length, factor);
 
 		if (stripe_offset < bargs->pend &&
 		    stripe_offset + stripe_length > bargs->pstart)
@@ -4399,8 +4399,8 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 	 */
 	if (stripe_size * data_stripes > max_chunk_size) {
 		u64 mask = (1ULL << 24) - 1;
-		stripe_size = max_chunk_size;
-		do_div(stripe_size, data_stripes);
+
+		stripe_size = div_u64(max_chunk_size, data_stripes);
 
 		/* bump the answer up to a 16MB boundary */
 		stripe_size = (stripe_size + mask) & ~mask;
@@ -4412,10 +4412,10 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 			stripe_size = devices_info[ndevs-1].max_avail;
 	}
 
-	do_div(stripe_size, dev_stripes);
+	stripe_size = div_u64(stripe_size, dev_stripes);
 
 	/* align to BTRFS_STRIPE_LEN */
-	do_div(stripe_size, raid_stripe_len);
+	stripe_size = div_u64(stripe_size, raid_stripe_len);
 	stripe_size *= raid_stripe_len;
 
 	map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS);
@@ -5135,7 +5135,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	stripe_index = 0;
 	stripe_nr_orig = stripe_nr;
 	stripe_nr_end = ALIGN(offset + *length, map->stripe_len);
-	do_div(stripe_nr_end, map->stripe_len);
+	stripe_nr_end = div_u64(stripe_nr_end, map->stripe_len);
 	stripe_end_offset = stripe_nr_end * map->stripe_len -
 			    (offset + *length);
 
@@ -5197,8 +5197,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 		    ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
 		     mirror_num > 1)) {
 			/* push stripe_nr back to the start of the full stripe */
-			stripe_nr = raid56_full_stripe_start;
-			do_div(stripe_nr, stripe_len * nr_data_stripes(map));
+			stripe_nr = div_u64(raid56_full_stripe_start,
+					stripe_len * nr_data_stripes(map));
 
 			/* RAID[56] write or recovery. Return all stripes */
 			num_stripes = map->num_stripes;
@@ -5534,11 +5534,11 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
 	rmap_len = map->stripe_len;
 
 	if (map->type & BTRFS_BLOCK_GROUP_RAID10)
-		do_div(length, map->num_stripes / map->sub_stripes);
+		length = div_u64(length, map->num_stripes / map->sub_stripes);
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID0)
-		do_div(length, map->num_stripes);
+		length = div_u64(length, map->num_stripes);
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
-		do_div(length, nr_data_stripes(map));
+		length = div_u64(length, nr_data_stripes(map));
 		rmap_len = map->stripe_len * nr_data_stripes(map);
 	}
 
@@ -5553,11 +5553,11 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
 			continue;
 
 		stripe_nr = physical - map->stripes[i].physical;
-		do_div(stripe_nr, map->stripe_len);
+		stripe_nr = div_u64(stripe_nr, map->stripe_len);
 
 		if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
 			stripe_nr = stripe_nr * map->num_stripes + i;
-			do_div(stripe_nr, map->sub_stripes);
+			stripe_nr = div_u64(stripe_nr, map->sub_stripes);
 		} else if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
 			stripe_nr = stripe_nr * map->num_stripes + i;
 		} /* else if RAID[56], multiply by nr_data_stripes().
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/11] btrfs: replace remaining do_div calls with div_u64 variants
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (3 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 04/11] btrfs: cleanup 64bit/32bit divs, provably bounded values David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 06/11] btrfs: cleanup, use correct type in div_u64_rem David Sterba
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Switch to div_u64_rem that does type checking and has more obvious
semantics than do_div.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/extent-tree.c      |  2 +-
 fs/btrfs/free-space-cache.c |  2 +-
 fs/btrfs/scrub.c            |  4 ++--
 fs/btrfs/volumes.c          | 29 ++++++++++++++++-------------
 4 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4ccc3397c644..5840afe5e5f9 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -8670,7 +8670,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)
 		min_free <<= 1;
 	} else if (index == BTRFS_RAID_RAID0) {
 		dev_min = fs_devices->rw_devices;
-		do_div(min_free, dev_min);
+		min_free = div64_u64(min_free, dev_min);
 	}
 
 	/* We need to do this so that we can look at pending chunks */
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 16cc62b87ba5..63219ba3a6c1 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1673,7 +1673,7 @@ find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
 		 */
 		if (*bytes >= align) {
 			tmp = entry->offset - ctl->start + align - 1;
-			do_div(tmp, align);
+			tmp = div64_u64(tmp, align);
 			tmp = tmp * align + ctl->start;
 			align_off = tmp - entry->offset;
 		} else {
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 07be15d4ce7b..4cdf739c7a47 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2329,7 +2329,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
 	}
 
 	start -= sparity->logic_start;
-	offset = (int)do_div(start, sparity->stripe_len);
+	start = div_u64_rem(start, sparity->stripe_len, &offset);
 	offset /= sectorsize;
 	nsectors = (int)len / sectorsize;
 
@@ -2628,7 +2628,7 @@ static int get_raid56_logic_offset(u64 physical, int num,
 		stripe_nr = div_u64(stripe_nr, nr_data_stripes(map));
 
 		/* Work out the disk rotation on this stripe-set */
-		rot = do_div(stripe_nr, map->num_stripes);
+		stripe_nr = div_u64_rem(stripe_nr, map->num_stripes, &rot);
 		/* calculate which stripe this data locates */
 		rot += i;
 		stripe_index = rot % map->num_stripes;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 446e4b24fc14..b7755924bc7f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4994,7 +4994,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	 * stripe_nr counts the total number of stripes we have to stride
 	 * to get to this block
 	 */
-	do_div(stripe_nr, stripe_len);
+	stripe_nr = div64_u64(stripe_nr, stripe_len);
 
 	stripe_offset = stripe_nr * stripe_len;
 	BUG_ON(offset < stripe_offset);
@@ -5010,7 +5010,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 		/* allow a write of a full stripe, but make sure we don't
 		 * allow straddling of stripes
 		 */
-		do_div(raid56_full_stripe_start, full_stripe_len);
+		raid56_full_stripe_start = div64_u64(raid56_full_stripe_start,
+				full_stripe_len);
 		raid56_full_stripe_start *= full_stripe_len;
 	}
 
@@ -5143,7 +5144,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 		if (rw & REQ_DISCARD)
 			num_stripes = min_t(u64, map->num_stripes,
 					    stripe_nr_end - stripe_nr_orig);
-		stripe_index = do_div(stripe_nr, map->num_stripes);
+		stripe_nr = div_u64_rem(stripe_nr, map->num_stripes,
+				&stripe_index);
 		if (!(rw & (REQ_WRITE | REQ_DISCARD | REQ_GET_READ_MIRRORS)))
 			mirror_num = 1;
 	} else if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
@@ -5171,7 +5173,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
 		int factor = map->num_stripes / map->sub_stripes;
 
-		stripe_index = do_div(stripe_nr, factor);
+		stripe_nr = div_u64_rem(stripe_nr, factor, &stripe_index);
 		stripe_index *= map->sub_stripes;
 
 		if (rw & (REQ_WRITE | REQ_GET_READ_MIRRORS))
@@ -5215,25 +5217,27 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 			 * Mirror #2 is RAID5 parity block.
 			 * Mirror #3 is RAID6 Q block.
 			 */
-			stripe_index = do_div(stripe_nr, nr_data_stripes(map));
+			stripe_nr = div_u64_rem(stripe_nr,
+					nr_data_stripes(map), &stripe_index);
 			if (mirror_num > 1)
 				stripe_index = nr_data_stripes(map) +
 						mirror_num - 2;
 
 			/* We distribute the parity blocks across stripes */
-			tmp = stripe_nr + stripe_index;
-			stripe_index = do_div(tmp, map->num_stripes);
+			div_u64_rem(stripe_nr + stripe_index, map->num_stripes,
+					&stripe_index);
 			if (!(rw & (REQ_WRITE | REQ_DISCARD |
 				    REQ_GET_READ_MIRRORS)) && mirror_num <= 1)
 				mirror_num = 1;
 		}
 	} else {
 		/*
-		 * after this do_div call, stripe_nr is the number of stripes
-		 * on this device we have to walk to find the data, and
-		 * stripe_index is the number of our device in the stripe array
+		 * after this, stripe_nr is the number of stripes on this
+		 * device we have to walk to find the data, and stripe_index is
+		 * the number of our device in the stripe array
 		 */
-		stripe_index = do_div(stripe_nr, map->num_stripes);
+		stripe_nr = div_u64_rem(stripe_nr, map->num_stripes,
+				&stripe_index);
 		mirror_num = stripe_index + 1;
 	}
 	BUG_ON(stripe_index >= map->num_stripes);
@@ -5268,8 +5272,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 				 sizeof(int) * tgtdev_indexes);
 
 		/* Work out the disk rotation on this stripe-set */
-		tmp = stripe_nr;
-		rot = do_div(tmp, num_stripes);
+		div_u64_rem(stripe_nr, num_stripes, &rot);
 
 		/* Fill in the logical address of each stripe */
 		tmp = stripe_nr * nr_data_stripes(map);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/11] btrfs: cleanup, use correct type in div_u64_rem
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (4 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 05/11] btrfs: replace remaining do_div calls with div_u64 variants David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 07/11] btrfs: cleanup, use kmalloc_array/kcalloc array helpers David Sterba
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

div_u64_rem expects u32 for divisior and reminder.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/scrub.c   |  6 +++---
 fs/btrfs/volumes.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 4cdf739c7a47..5c3ca68b1fb4 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2319,7 +2319,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
 				       unsigned long *bitmap,
 				       u64 start, u64 len)
 {
-	int offset;
+	u32 offset;
 	int nsectors;
 	int sectorsize = sparity->sctx->dev_root->sectorsize;
 
@@ -2612,8 +2612,8 @@ static int get_raid56_logic_offset(u64 physical, int num,
 	int j = 0;
 	u64 stripe_nr;
 	u64 last_offset;
-	int stripe_index;
-	int rot;
+	u32 stripe_index;
+	u32 rot;
 
 	last_offset = (physical - map->stripes[num].physical) *
 		      nr_data_stripes(map);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b7755924bc7f..5f3133e5390b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4953,7 +4953,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	u64 stripe_nr_orig;
 	u64 stripe_nr_end;
 	u64 stripe_len;
-	int stripe_index;
+	u32 stripe_index;
 	int i;
 	int ret = 0;
 	int num_stripes;
@@ -5171,7 +5171,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 		}
 
 	} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
-		int factor = map->num_stripes / map->sub_stripes;
+		u32 factor = map->num_stripes / map->sub_stripes;
 
 		stripe_nr = div_u64_rem(stripe_nr, factor, &stripe_index);
 		stripe_index *= map->sub_stripes;
@@ -5264,7 +5264,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	    need_raid_map && ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
 	    mirror_num > 1)) {
 		u64 tmp;
-		int i, rot;
+		int i;
+		unsigned rot;
 
 		bbio->raid_map = (u64 *)((void *)bbio->stripes +
 				 sizeof(struct btrfs_bio_stripe) *
@@ -5287,8 +5288,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	}
 
 	if (rw & REQ_DISCARD) {
-		int factor = 0;
-		int sub_stripes = 0;
+		u32 factor = 0;
+		u32 sub_stripes = 0;
 		u64 stripes_per_dev = 0;
 		u32 remaining_stripes = 0;
 		u32 last_stripe = 0;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/11] btrfs: cleanup, use kmalloc_array/kcalloc array helpers
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (5 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 06/11] btrfs: cleanup, use correct type in div_u64_rem David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:24 ` [PATCH 08/11] btrfs: remove shadowing variables in __btrfs_buffered_write David Sterba
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Convert kmalloc(nr * size, ..) to kmalloc_array that does additional
overflow checks, the zeroing variant is kcalloc.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/check-integrity.c  | 4 ++--
 fs/btrfs/compression.c      | 2 +-
 fs/btrfs/ctree.c            | 9 ++++-----
 fs/btrfs/disk-io.c          | 2 +-
 fs/btrfs/file-item.c        | 4 ++--
 fs/btrfs/file.c             | 2 +-
 fs/btrfs/free-space-cache.c | 2 +-
 fs/btrfs/inode.c            | 2 +-
 fs/btrfs/raid56.c           | 3 +--
 fs/btrfs/scrub.c            | 5 ++---
 fs/btrfs/volumes.c          | 4 ++--
 11 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index d897ef803b3b..089d6fac01a7 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2990,8 +2990,8 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio)
 			       (unsigned long long)bio->bi_iter.bi_sector,
 			       dev_bytenr, bio->bi_bdev);
 
-		mapped_datav = kmalloc(sizeof(*mapped_datav) * bio->bi_vcnt,
-				       GFP_NOFS);
+		mapped_datav = kmalloc_array(bio->bi_vcnt,
+					     sizeof(*mapped_datav), GFP_NOFS);
 		if (!mapped_datav)
 			goto leave;
 		cur_bytenr = dev_bytenr;
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index e9df8862012c..ecacb7a2d422 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -622,7 +622,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 	cb->orig_bio = bio;
 
 	nr_pages = DIV_ROUND_UP(compressed_len, PAGE_CACHE_SIZE);
-	cb->compressed_pages = kzalloc(sizeof(struct page *) * nr_pages,
+	cb->compressed_pages = kcalloc(nr_pages, sizeof(struct page *),
 				       GFP_NOFS);
 	if (!cb->compressed_pages)
 		goto fail1;
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 993642199326..8595fdd50a22 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -578,7 +578,7 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
 	if (!tree_mod_need_log(fs_info, eb))
 		return 0;
 
-	tm_list = kzalloc(nr_items * sizeof(struct tree_mod_elem *), flags);
+	tm_list = kcalloc(nr_items, sizeof(struct tree_mod_elem *), flags);
 	if (!tm_list)
 		return -ENOMEM;
 
@@ -677,7 +677,7 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info,
 
 	if (log_removal && btrfs_header_level(old_root) > 0) {
 		nritems = btrfs_header_nritems(old_root);
-		tm_list = kzalloc(nritems * sizeof(struct tree_mod_elem *),
+		tm_list = kcalloc(nritems, sizeof(struct tree_mod_elem *),
 				  flags);
 		if (!tm_list) {
 			ret = -ENOMEM;
@@ -814,7 +814,7 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct extent_buffer *dst,
 	if (btrfs_header_level(dst) == 0 && btrfs_header_level(src) == 0)
 		return 0;
 
-	tm_list = kzalloc(nr_items * 2 * sizeof(struct tree_mod_elem *),
+	tm_list = kcalloc(nr_items * 2, sizeof(struct tree_mod_elem *),
 			  GFP_NOFS);
 	if (!tm_list)
 		return -ENOMEM;
@@ -905,8 +905,7 @@ tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
 		return 0;
 
 	nritems = btrfs_header_nritems(eb);
-	tm_list = kzalloc(nritems * sizeof(struct tree_mod_elem *),
-			  GFP_NOFS);
+	tm_list = kcalloc(nritems, sizeof(struct tree_mod_elem *), GFP_NOFS);
 	if (!tm_list)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 73b152138221..14e4a3e0f9b2 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -302,7 +302,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
 		offset += cur_len;
 	}
 	if (csum_size > sizeof(inline_result)) {
-		result = kzalloc(csum_size * sizeof(char), GFP_NOFS);
+		result = kzalloc(csum_size, GFP_NOFS);
 		if (!result)
 			return 1;
 	} else {
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 84a2d1868271..3a4a7924fa38 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -185,8 +185,8 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
 	nblocks = bio->bi_iter.bi_size >> inode->i_sb->s_blocksize_bits;
 	if (!dst) {
 		if (nblocks * csum_size > BTRFS_BIO_INLINE_CSUM_SIZE) {
-			btrfs_bio->csum_allocated = kmalloc(nblocks * csum_size,
-							    GFP_NOFS);
+			btrfs_bio->csum_allocated = kmalloc_array(nblocks,
+					csum_size, GFP_NOFS);
 			if (!btrfs_bio->csum_allocated) {
 				btrfs_free_path(path);
 				return -ENOMEM;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 1e34bc00249f..e74abb3018d4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1481,7 +1481,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
 			PAGE_CACHE_SIZE / (sizeof(struct page *)));
 	nrptrs = min(nrptrs, current->nr_dirtied_pause - current->nr_dirtied);
 	nrptrs = max(nrptrs, 8);
-	pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);
+	pages = kmalloc_array(nrptrs, sizeof(struct page *), GFP_KERNEL);
 	if (!pages)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 63219ba3a6c1..df550eb5cddd 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -298,7 +298,7 @@ static int io_ctl_init(struct io_ctl *io_ctl, struct inode *inode,
 
 	memset(io_ctl, 0, sizeof(struct io_ctl));
 
-	io_ctl->pages = kzalloc(sizeof(struct page *) * num_pages, GFP_NOFS);
+	io_ctl->pages = kcalloc(num_pages, sizeof(struct page *), GFP_NOFS);
 	if (!io_ctl->pages)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8564d8ce03de..21e4affafa3e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -463,7 +463,7 @@ again:
 	 */
 	if (inode_need_compress(inode)) {
 		WARN_ON(pages);
-		pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
+		pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
 		if (!pages) {
 			/* just bail out to the uncompressed code */
 			goto cont;
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 5264858ed768..b4634c30981e 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1807,8 +1807,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
 	int err;
 	int i;
 
-	pointers = kzalloc(rbio->real_stripes * sizeof(void *),
-			   GFP_NOFS);
+	pointers = kcalloc(rbio->real_stripes, sizeof(void *), GFP_NOFS);
 	if (!pointers) {
 		err = -ENOMEM;
 		goto cleanup_io;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 5c3ca68b1fb4..0d1414659bc1 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -964,9 +964,8 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
 	 * the statistics.
 	 */
 
-	sblocks_for_recheck = kzalloc(BTRFS_MAX_MIRRORS *
-				     sizeof(*sblocks_for_recheck),
-				     GFP_NOFS);
+	sblocks_for_recheck = kcalloc(BTRFS_MAX_MIRRORS,
+				      sizeof(*sblocks_for_recheck), GFP_NOFS);
 	if (!sblocks_for_recheck) {
 		spin_lock(&sctx->stat_lock);
 		sctx->stat.malloc_errors++;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5f3133e5390b..11bd47ba6a48 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4288,7 +4288,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 	max_chunk_size = min(div_factor(fs_devices->total_rw_bytes, 1),
 			     max_chunk_size);
 
-	devices_info = kzalloc(sizeof(*devices_info) * fs_devices->rw_devices,
+	devices_info = kcalloc(fs_devices->rw_devices, sizeof(*devices_info),
 			       GFP_NOFS);
 	if (!devices_info)
 		return -ENOMEM;
@@ -5546,7 +5546,7 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
 		rmap_len = map->stripe_len * nr_data_stripes(map);
 	}
 
-	buf = kzalloc(sizeof(u64) * map->num_stripes, GFP_NOFS);
+	buf = kcalloc(map->num_stripes, sizeof(u64), GFP_NOFS);
 	BUG_ON(!buf); /* -ENOMEM */
 
 	for (i = 0; i < map->num_stripes; i++) {
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/11] btrfs: remove shadowing variables in __btrfs_buffered_write
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (6 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 07/11] btrfs: cleanup, use kmalloc_array/kcalloc array helpers David Sterba
@ 2015-02-25 18:24 ` David Sterba
  2015-02-25 18:25 ` [PATCH 09/11] btrfs: switch helper macros to static inlines in sysfs.h David Sterba
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

There are lockstart and lockend defined in the function and not used
after their duplicate definition scope ends, it's safe to reuse them.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index e74abb3018d4..a3c2bd77c74b 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1631,8 +1631,8 @@ again:
 			btrfs_end_write_no_snapshoting(root);
 
 		if (only_release_metadata && copied > 0) {
-			u64 lockstart = round_down(pos, root->sectorsize);
-			u64 lockend = lockstart +
+			lockstart = round_down(pos, root->sectorsize);
+			lockend = lockstart +
 				(dirty_pages << PAGE_CACHE_SHIFT) - 1;
 
 			set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/11] btrfs: switch helper macros to static inlines in sysfs.h
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (7 preceding siblings ...)
  2015-02-25 18:24 ` [PATCH 08/11] btrfs: remove shadowing variables in __btrfs_buffered_write David Sterba
@ 2015-02-25 18:25 ` David Sterba
  2015-02-25 18:25 ` [PATCH 10/11] btrfs: remove shadowing variables in __btrfs_map_block David Sterba
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The conversion macros use nested container_of that leads to a warning

fs/btrfs/sysfs.c: In function 'btrfs_feature_visible':
fs/btrfs/sysfs.c:183:8: warning: declaration of '__mptr' shadows a previous local
fs/btrfs/sysfs.c:183:8: warning: shadowed declaration is here

Use of functions will add proper type checking.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/sysfs.h | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index f7dd298b3cf6..63f21a2d1366 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -61,11 +61,23 @@ static struct btrfs_feature_attr btrfs_attr_##_name = {			     \
 	BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature)
 
 /* convert from attribute */
-#define to_btrfs_feature_attr(a) \
-			container_of(a, struct btrfs_feature_attr, kobj_attr)
-#define attr_to_btrfs_attr(a) container_of(a, struct kobj_attribute, attr)
-#define attr_to_btrfs_feature_attr(a) \
-			to_btrfs_feature_attr(attr_to_btrfs_attr(a))
+static inline struct btrfs_feature_attr*
+to_btrfs_feature_attr(struct kobj_attribute *a)
+{
+	return container_of(a, struct btrfs_feature_attr, kobj_attr);
+}
+
+static inline struct kobj_attribute* attr_to_btrfs_attr(struct attribute *attr)
+{
+	return container_of(attr, struct kobj_attribute, attr);
+}
+
+static inline struct btrfs_feature_attr*
+attr_to_btrfs_feature_attr(struct attribute *attr)
+{
+	return to_btrfs_feature_attr(attr_to_btrfs_attr(attr));
+}
+
 char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags);
 extern const char * const btrfs_feature_set_names[3];
 extern struct kobj_type space_info_ktype;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/11] btrfs: remove shadowing variables in __btrfs_map_block
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (8 preceding siblings ...)
  2015-02-25 18:25 ` [PATCH 09/11] btrfs: switch helper macros to static inlines in sysfs.h David Sterba
@ 2015-02-25 18:25 ` David Sterba
  2015-02-25 18:25 ` [PATCH 11/11] btrfs: use explicit initializer for seq_elem David Sterba
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

1) We can safely use the function's 'i'. Fixes warning

fs/btrfs/volumes.c:5257:7: warning: declaration of 'i' shadows a previous local
fs/btrfs/volumes.c:4951:6: warning: shadowed declaration is here

2) A local variable duplicates name of an argument, we can use the value
directly. Fixes warning

fs/btrfs/volumes.c:5433:8: warning: declaration of 'length' shadows a parameter
fs/btrfs/volumes.c:4935:27: warning: shadowed declaration is here

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/volumes.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 11bd47ba6a48..0ac03e4f962a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5264,7 +5264,6 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	    need_raid_map && ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
 	    mirror_num > 1)) {
 		u64 tmp;
-		int i;
 		unsigned rot;
 
 		bbio->raid_map = (u64 *)((void *)bbio->stripes +
@@ -5440,9 +5439,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 			}
 		}
 		if (found) {
-			u64 length = map->stripe_len;
-
-			if (physical_of_found + length <=
+			if (physical_of_found + map->stripe_len <=
 			    dev_replace->cursor_left) {
 				struct btrfs_bio_stripe *tgtdev_stripe =
 					bbio->stripes + num_stripes;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/11] btrfs: use explicit initializer for seq_elem
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (9 preceding siblings ...)
  2015-02-25 18:25 ` [PATCH 10/11] btrfs: remove shadowing variables in __btrfs_map_block David Sterba
@ 2015-02-25 18:25 ` David Sterba
  2015-02-26  1:39 ` [PULL] [PATCH 00/11] Cleanups for 4.1 Zhao Lei
  2015-03-03 16:30 ` David Sterba
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-25 18:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Using {} as initializer for struct seq_elem does not properly initialize
the list_head member, but it currently works because it gets set through
btrfs_get_tree_mod_seq if 'seq' is 0.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/backref.c | 4 ++--
 fs/btrfs/ctree.h   | 2 ++
 fs/btrfs/ioctl.c   | 2 +-
 fs/btrfs/qgroup.c  | 6 +++---
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index f55721ff9385..9de772ee0031 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1206,7 +1206,7 @@ int btrfs_check_shared(struct btrfs_trans_handle *trans,
 	struct ulist *roots = NULL;
 	struct ulist_iterator uiter;
 	struct ulist_node *node;
-	struct seq_list elem = {};
+	struct seq_list elem = SEQ_LIST_INIT(elem);
 	int ret = 0;
 
 	tmp = ulist_alloc(GFP_NOFS);
@@ -1610,7 +1610,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
 	struct ulist *roots = NULL;
 	struct ulist_node *ref_node = NULL;
 	struct ulist_node *root_node = NULL;
-	struct seq_list tree_mod_seq_elem = {};
+	struct seq_list tree_mod_seq_elem = SEQ_LIST_INIT(tree_mod_seq_elem);
 	struct ulist_iterator ref_uiter;
 	struct ulist_iterator root_uiter;
 
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b3dd55f52f71..36e009ebab47 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1328,6 +1328,8 @@ struct seq_list {
 	u64 seq;
 };
 
+#define SEQ_LIST_INIT(name)	{ .list = LIST_HEAD_INIT((name).list), .seq = 0 }
+
 enum btrfs_orphan_cleanup_state {
 	ORPHAN_CLEANUP_STARTED	= 1,
 	ORPHAN_CLEANUP_DONE	= 2,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 5544a79dc2ba..4a5524c2713a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3039,7 +3039,7 @@ out:
 static int check_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		     u64 disko)
 {
-	struct seq_list tree_mod_seq_elem = {};
+	struct seq_list tree_mod_seq_elem = SEQ_LIST_INIT(tree_mod_seq_elem);
 	struct ulist *roots;
 	struct ulist_iterator uiter;
 	struct ulist_node *root_node = NULL;
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 97159a8e91d4..7f7eb399a347 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1845,7 +1845,7 @@ static int qgroup_shared_accounting(struct btrfs_trans_handle *trans,
 	struct ulist *roots = NULL;
 	struct ulist *qgroups, *tmp;
 	struct btrfs_qgroup *qgroup;
-	struct seq_list elem = {};
+	struct seq_list elem = SEQ_LIST_INIT(elem);
 	u64 seq;
 	int old_roots = 0;
 	int new_roots = 0;
@@ -1967,7 +1967,7 @@ static int qgroup_subtree_accounting(struct btrfs_trans_handle *trans,
 	int err;
 	struct btrfs_qgroup *qg;
 	u64 root_obj = 0;
-	struct seq_list elem = {};
+	struct seq_list elem = SEQ_LIST_INIT(elem);
 
 	parents = ulist_alloc(GFP_NOFS);
 	if (!parents)
@@ -2522,7 +2522,7 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 {
 	struct btrfs_key found;
 	struct ulist *roots = NULL;
-	struct seq_list tree_mod_seq_elem = {};
+	struct seq_list tree_mod_seq_elem = SEQ_LIST_INIT(tree_mod_seq_elem);
 	u64 num_bytes;
 	u64 seq;
 	int new_roots;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* RE: [PULL] [PATCH 00/11] Cleanups for 4.1
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (10 preceding siblings ...)
  2015-02-25 18:25 ` [PATCH 11/11] btrfs: use explicit initializer for seq_elem David Sterba
@ 2015-02-26  1:39 ` Zhao Lei
  2015-02-26 17:46   ` David Sterba
  2015-03-03 16:30 ` David Sterba
  12 siblings, 1 reply; 15+ messages in thread
From: Zhao Lei @ 2015-02-26  1:39 UTC (permalink / raw)
  To: 'David Sterba', linux-btrfs; +Cc: clm

Hi, David

* From: linux-btrfs-owner@vger.kernel.org
> Subject: [PULL] [PATCH 00/11] Cleanups for 4.1
> 
> Hi,
> 
> a few cleanups that accumulated over time. No real fixes but there are changes
> that may touch functionality (no fstests complaints though).
> 
I like these cleanups.

But it cause following build warnings:
  fs/btrfs/volumes.c: In function ‘__btrfs_map_block’:
  fs/btrfs/volumes.c:5206: warning: unused variable ‘tmp’

  fs/btrfs/free-space-cache.c: In function ‘recalculate_thresholds’:
  fs/btrfs/free-space-cache.c:1527: warning: comparison of distinct pointer types lacks a cast

And little checkpatch notice:
  ERROR: "foo* bar" should be "foo *bar"
  #41: FILE: fs/btrfs/sysfs.h:70:
  +static inline struct kobj_attribute* attr_to_btrfs_attr(struct attribute *attr)
In [PATCH 09/11].

Could you fix it?

Thanks
Zhaolei

>   git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanups-for-4.1
> 
> all merged together, but are also available in the following topic branches
> based on current for-linus branch.
> 
> cleanup/sched
> cleanup/divs
> cleanup/kmalloc-array
> cleanup/shadow-vars
> cleanup/initializers
> 
> David Sterba (11):
>   btrfs: need_resched not needed with cond_resched
>   btrfs: use cond_resched_lock where possible
>   btrfs: cleanup 64bit/32bit divs, compile time constants
>   btrfs: cleanup 64bit/32bit divs, provably bounded values
>   btrfs: replace remaining do_div calls with div_u64 variants
>   btrfs: cleanup, use correct type in div_u64_rem
>   btrfs: cleanup, use kmalloc_array/kcalloc array helpers
>   btrfs: remove shadowing variables in __btrfs_buffered_write
>   btrfs: switch helper macros to static inlines in sysfs.h
>   btrfs: remove shadowing variables in __btrfs_map_block
>   btrfs: use explicit initializer for seq_elem
> 
>  fs/btrfs/backref.c          |  4 +--
>  fs/btrfs/check-integrity.c  |  4 +--
>  fs/btrfs/compression.c      |  2 +-
>  fs/btrfs/ctree.c            |  9 +++--
>  fs/btrfs/ctree.h            |  2 ++
>  fs/btrfs/dev-replace.c      |  6 ++--
>  fs/btrfs/disk-io.c          |  4 +--
>  fs/btrfs/extent-tree.c      | 21 ++++++------
>  fs/btrfs/file-item.c        |  4 +--
>  fs/btrfs/file.c             | 12 +++----
>  fs/btrfs/free-space-cache.c | 34 ++++++++-----------
>  fs/btrfs/inode.c            |  2 +-
>  fs/btrfs/ioctl.c            |  4 +--
>  fs/btrfs/math.h             |  6 ++--
>  fs/btrfs/qgroup.c           |  6 ++--
>  fs/btrfs/raid56.c           |  3 +-
>  fs/btrfs/scrub.c            | 23 ++++++-------
>  fs/btrfs/super.c            |  2 +-
>  fs/btrfs/sysfs.h            | 22 ++++++++++---
>  fs/btrfs/transaction.c      |  7 ++--
>  fs/btrfs/volumes.c          | 80
> ++++++++++++++++++++++-----------------------
>  21 files changed, 125 insertions(+), 132 deletions(-)
> 
> --
> 2.1.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body
> of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PULL] [PATCH 00/11] Cleanups for 4.1
  2015-02-26  1:39 ` [PULL] [PATCH 00/11] Cleanups for 4.1 Zhao Lei
@ 2015-02-26 17:46   ` David Sterba
  0 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-26 17:46 UTC (permalink / raw)
  To: Zhao Lei; +Cc: 'David Sterba', linux-btrfs, clm

On Thu, Feb 26, 2015 at 09:39:57AM +0800, Zhao Lei wrote:
> I like these cleanups.
> 
> But it cause following build warnings:
>   fs/btrfs/volumes.c: In function ‘__btrfs_map_block’:
>   fs/btrfs/volumes.c:5206: warning: unused variable ‘tmp’
> 
>   fs/btrfs/free-space-cache.c: In function ‘recalculate_thresholds’:
>   fs/btrfs/free-space-cache.c:1527: warning: comparison of distinct pointer types lacks a cast
> 
> And little checkpatch notice:
>   ERROR: "foo* bar" should be "foo *bar"
>   #41: FILE: fs/btrfs/sysfs.h:70:
>   +static inline struct kobj_attribute* attr_to_btrfs_attr(struct attribute *attr)
> In [PATCH 09/11].
> 
> Could you fix it?

Will do.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PULL] [PATCH 00/11] Cleanups for 4.1
  2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
                   ` (11 preceding siblings ...)
  2015-02-26  1:39 ` [PULL] [PATCH 00/11] Cleanups for 4.1 Zhao Lei
@ 2015-03-03 16:30 ` David Sterba
  12 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-03-03 16:30 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, clm, zhaolei

On Wed, Feb 25, 2015 at 07:24:31PM +0100, David Sterba wrote:
> Hi,
> 
> a few cleanups that accumulated over time. No real fixes but there are changes
> that may touch functionality (no fstests complaints though).
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanups-for-4.1

Fixups pointed out by Zhao Lei are now incorporated into

   git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanups-for-4.1-v2

(top commit 258ece02126a67af263746e1ae5f8ddf0d492e14)

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-03-03 16:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 18:24 [PULL] [PATCH 00/11] Cleanups for 4.1 David Sterba
2015-02-25 18:24 ` [PATCH 01/11] btrfs: need_resched not needed with cond_resched David Sterba
2015-02-25 18:24 ` [PATCH 02/11] btrfs: use cond_resched_lock where possible David Sterba
2015-02-25 18:24 ` [PATCH 03/11] btrfs: cleanup 64bit/32bit divs, compile time constants David Sterba
2015-02-25 18:24 ` [PATCH 04/11] btrfs: cleanup 64bit/32bit divs, provably bounded values David Sterba
2015-02-25 18:24 ` [PATCH 05/11] btrfs: replace remaining do_div calls with div_u64 variants David Sterba
2015-02-25 18:24 ` [PATCH 06/11] btrfs: cleanup, use correct type in div_u64_rem David Sterba
2015-02-25 18:24 ` [PATCH 07/11] btrfs: cleanup, use kmalloc_array/kcalloc array helpers David Sterba
2015-02-25 18:24 ` [PATCH 08/11] btrfs: remove shadowing variables in __btrfs_buffered_write David Sterba
2015-02-25 18:25 ` [PATCH 09/11] btrfs: switch helper macros to static inlines in sysfs.h David Sterba
2015-02-25 18:25 ` [PATCH 10/11] btrfs: remove shadowing variables in __btrfs_map_block David Sterba
2015-02-25 18:25 ` [PATCH 11/11] btrfs: use explicit initializer for seq_elem David Sterba
2015-02-26  1:39 ` [PULL] [PATCH 00/11] Cleanups for 4.1 Zhao Lei
2015-02-26 17:46   ` David Sterba
2015-03-03 16:30 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.