Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: fix trivial -Wshadow warnings

When compiling with -Wshadow (also in 'make W=2' build) there are
several reports of shadowed variables that seem to be harmless:

- btrfs_do_encoded_write() - we can reuse 'ordered', there's no previous
value that would need to be preserved

- scrub_write_endio() - we need a standalone 'i' for bio iteration

- scrub_stripe() - duplicate ret2 for errors that must not overwrite 'ret'

- btrfs_subpage_set_writeback() - 'flags' is used for another irqsave lock
but is not overwritten when reused for xarray
due to scoping, but for clarity let's rename it

- process_dir_items_leaf() - duplicate 'ret', used only for immediate checks

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

+4 -11
-2
fs/btrfs/inode.c
··· 9826 9826 } 9827 9827 9828 9828 for (;;) { 9829 - struct btrfs_ordered_extent *ordered; 9830 - 9831 9829 ret = btrfs_wait_ordered_range(inode, start, num_bytes); 9832 9830 if (ret) 9833 9831 goto out_folios;
+1 -3
fs/btrfs/scrub.c
··· 1284 1284 bitmap_set(&stripe->write_error_bitmap, sector_nr, 1285 1285 bio_size >> fs_info->sectorsize_bits); 1286 1286 spin_unlock_irqrestore(&stripe->write_error_lock, flags); 1287 - for (int i = 0; i < (bio_size >> fs_info->sectorsize_bits); i++) 1287 + for (i = 0; i < (bio_size >> fs_info->sectorsize_bits); i++) 1288 1288 btrfs_dev_stat_inc_and_print(stripe->dev, 1289 1289 BTRFS_DEV_STAT_WRITE_ERRS); 1290 1290 } ··· 2529 2529 } 2530 2530 2531 2531 if (sctx->is_dev_replace && ret >= 0) { 2532 - int ret2; 2533 - 2534 2532 ret2 = sync_write_pointer_for_zoned(sctx, 2535 2533 chunk_logical + offset, 2536 2534 map->stripes[stripe_index].physical,
+3 -3
fs/btrfs/subpage.c
··· 460 460 if (!folio_test_dirty(folio)) { 461 461 struct address_space *mapping = folio_mapping(folio); 462 462 XA_STATE(xas, &mapping->i_pages, folio->index); 463 - unsigned long flags; 463 + unsigned long xa_flags; 464 464 465 - xas_lock_irqsave(&xas, flags); 465 + xas_lock_irqsave(&xas, xa_flags); 466 466 xas_load(&xas); 467 467 xas_clear_mark(&xas, PAGECACHE_TAG_TOWRITE); 468 - xas_unlock_irqrestore(&xas, flags); 468 + xas_unlock_irqrestore(&xas, xa_flags); 469 469 } 470 470 spin_unlock_irqrestore(&bfs->lock, flags); 471 471 }
-3
fs/btrfs/tree-log.c
··· 4154 4154 for (int i = path->slots[0]; i < nritems; i++) { 4155 4155 struct btrfs_dir_item *di; 4156 4156 struct btrfs_key key; 4157 - int ret; 4158 4157 4159 4158 btrfs_item_key_to_cpu(src, &key, i); 4160 4159 ··· 4223 4224 } 4224 4225 4225 4226 if (batch_size > 0) { 4226 - int ret; 4227 - 4228 4227 ret = flush_dir_items_batch(trans, inode, src, dst_path, 4229 4228 batch_start, batch_size); 4230 4229 if (ret < 0)