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).
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(-)
Signature · 1 line
2.1.3
PATCH 1/11 btrfs: need_resched not needed with cond_resched
Cleanup, no special reason to do
if (need_resched())
cond_resched();
--- fs/btrfs/volumes.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/volumes.c +3 -4
@@ -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);
Signature · 1 line
2.1.3
PATCH 2/11 btrfs: use cond_resched_lock where possible
In reply to David SterbaClean 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().
--- fs/btrfs/file.c | 6 +----- fs/btrfs/free-space-cache.c | 14 ++++---------- fs/btrfs/transaction.c | 7 ++----- 3 files changed, 7 insertions(+), 20 deletions(-)
fs/btrfs/file.c +1 -5
@@ -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); }
fs/btrfs/free-space-cache.c +4 -10
@@ -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);
fs/btrfs/transaction.c +2 -5
@@ -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); }
Signature · 1 line
2.1.3
PATCH 3/11 btrfs: cleanup 64bit/32bit divs, compile time constants
In reply to David SterbaSwitch 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.
--- 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(-)
fs/btrfs/dev-replace.c +3 -3
@@ -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>" :
fs/btrfs/disk-io.c +1 -1
@@ -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);
fs/btrfs/extent-tree.c +7 -8
@@ -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);
fs/btrfs/free-space-cache.c +4 -4
@@ -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,
fs/btrfs/math.h +2 -4
@@ -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
fs/btrfs/super.c +1 -1
@@ -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 ;/*
Signature · 1 line
2.1.3
PATCH 4/11 btrfs: cleanup 64bit/32bit divs, provably bounded values
In reply to David SterbaThe divisor is derived from nodesize or PAGE_SIZE, fits into 32bit type. Get rid of a few more do_div instances.
--- 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(-)
fs/btrfs/extent-tree.c +2 -2
@@ -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;
fs/btrfs/free-space-cache.c +4 -4
@@ -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 );
fs/btrfs/ioctl.c +1 -1
@@ -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",
fs/btrfs/scrub.c +3 -5
@@ -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;
fs/btrfs/volumes.c +13 -13
@@ -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().
Signature · 1 line
2.1.3
PATCH 5/11 btrfs: replace remaining do_div calls with div_u64 variants
In reply to David SterbaSwitch to div_u64_rem that does type checking and has more obvious semantics than do_div.
--- 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(-)
fs/btrfs/extent-tree.c +1 -1
@@ -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 */
fs/btrfs/free-space-cache.c +1 -1
@@ -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 {
fs/btrfs/scrub.c +2 -2
@@ -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;
fs/btrfs/volumes.c +16 -13
@@ -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);
Signature · 1 line
2.1.3
PATCH 6/11 btrfs: cleanup, use correct type in div_u64_rem
In reply to David Sterbadiv_u64_rem expects u32 for divisior and reminder.
--- fs/btrfs/scrub.c | 6 +++--- fs/btrfs/volumes.c | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-)
fs/btrfs/scrub.c +3 -3
@@ -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);
fs/btrfs/volumes.c +6 -5
@@ -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 ;
Signature · 1 line
2.1.3
PATCH 7/11 btrfs: cleanup, use kmalloc_array/kcalloc array helpers
In reply to David SterbaConvert kmalloc(nr * size, ..) to kmalloc_array that does additional overflow checks, the zeroing variant is kcalloc.
--- 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(-)
fs/btrfs/check-integrity.c +2 -2
@@ -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;
fs/btrfs/compression.c +1 -1
@@ -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;
fs/btrfs/ctree.c +4 -5
@@ -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 ;
fs/btrfs/disk-io.c +1 -1
@@ -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 {
fs/btrfs/file-item.c +2 -2
@@ -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 ;
fs/btrfs/file.c +1 -1
@@ -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 ;
fs/btrfs/free-space-cache.c +1 -1
@@ -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 ;
fs/btrfs/inode.c +1 -1
@@ -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;
fs/btrfs/raid56.c +1 -2
@@ -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;
fs/btrfs/scrub.c +2 -3
@@ -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++;
fs/btrfs/volumes.c +2 -2
@@ -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++) {
Signature · 1 line
2.1.3
PATCH 8/11 btrfs: remove shadowing variables in __btrfs_buffered_write
In reply to David SterbaThere are lockstart and lockend defined in the function and not used after their duplicate definition scope ends, it's safe to reuse them.
--- fs/btrfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/file.c +2 -2
@@ -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,
Signature · 1 line
2.1.3
PATCH 9/11 btrfs: switch helper macros to static inlines in sysfs.h
In reply to David SterbaThe 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.
--- fs/btrfs/sysfs.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
fs/btrfs/sysfs.h +17 -5
@@ -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;
Signature · 1 line
2.1.3
PATCH 10/11 btrfs: remove shadowing variables in __btrfs_map_block
In reply to David Sterba1) 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
--- fs/btrfs/volumes.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/btrfs/volumes.c +1 -4
@@ -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;
Signature · 1 line
2.1.3
PATCH 11/11 btrfs: use explicit initializer for seq_elem
In reply to David SterbaUsing {} 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.
--- 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(-)
fs/btrfs/backref.c +2 -2
@@ -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;
fs/btrfs/ctree.h +2 -0
@@ -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 ,
fs/btrfs/ioctl.c +1 -1
@@ -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 ;
fs/btrfs/qgroup.c +3 -3
@@ -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;
Signature · 1 line
2.1.3
Hi, David
* From: [email protected]
Quoted 7 lines
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
Quoted 55 lines
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.gitcleanups-for-4.1all 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/initializersDavid Sterba (11):
btrfs:need_reschednot needed withcond_resched
btrfs: usecond_resched_lockwhere possible
btrfs: cleanup 64bit/32bit divs, compile time constants
btrfs: cleanup 64bit/32bit divs, provably bounded values
btrfs: replace remainingdo_divcalls withdiv_u64variants
btrfs: cleanup, use correct type indiv_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 insysfs.h
btrfs: remove shadowing variables in__btrfs_map_block
btrfs: use explicit initializer forseq_elemfs/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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Zhao Lei
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
Quoted 7 lines
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.
Quoted 6 lines · David Sterba
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.gitcleanups-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)