Skip to contentSkip to conversation

-Wshadow: 'map_bh' and 'wbc' shadow fixes

RFC PATCH In review Jesper Juhl 2 participants 2 messages Jul 10, 2006 – Jul 11, 2006 VFS

lore
Share & tools
lore
#0 lore raw

RFC PATCH 6/9 -Wshadow: 'map_bh' and 'wbc' shadow fixes

(please see the mail titled
"[RFC][PATCH 0/9] -Wshadow: Making the kernel build clean with -Wshadow" for an explanation of why I'm doing this)

Fixes for the following -Wshadow warnings :

fs/buffer.c:2377: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/mpage.c:177: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/mpage.c:393: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/mpage.c:431: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/mpage.c:479: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/mpage.c:706: warning: declaration of 'wbc' shadows a parameter fs/mpage.c:699: warning: shadowed declaration is here fs/direct-io.c:515: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here fs/direct-io.c:802: warning: declaration of 'map_bh' shadows a global declaration include/linux/buffer_head.h:279: warning: shadowed declaration is here

---

 fs/buffer.c    |   28 +++++++--------
 fs/direct-io.c |   24 ++++++-------
 fs/mpage.c     |   84 +++++++++++++++++++++++------------------------
 3 files changed, 68 insertions(+), 68 deletions(-)
fs/buffer.c +14 -14
@@ -2374,7 +2374,7 @@ int nobh_prepare_write(struct page *page
 	struct inode *inode = page->mapping->host;
 	const unsigned blkbits = inode->i_blkbits;
 	const unsigned blocksize = 1 << blkbits;
-	struct buffer_head map_bh;
+	struct buffer_head bh_map;
 	struct buffer_head *read_bh[MAX_BUF_PER_PAGE];
 	unsigned block_in_page;
 	unsigned block_start;
@@ -2390,7 +2390,7 @@ int nobh_prepare_write(struct page *page
 		return 0;
 
 	block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
-	map_bh.b_page = page;
+	bh_map.b_page = page;
 
 	/*
 	 * We loop across all blocks in the page, whether or not they are
@@ -2403,23 +2403,23 @@ int nobh_prepare_write(struct page *page
 		unsigned block_end = block_start + blocksize;
 		int create;
 
-		map_bh.b_state = 0;
+		bh_map.b_state = 0;
 		create = 1;
 		if (block_start >= to)
 			create = 0;
-		map_bh.b_size = blocksize;
+		bh_map.b_size = blocksize;
 		ret = get_block(inode, block_in_file + block_in_page,
-					&map_bh, create);
+					&bh_map, create);
 		if (ret)
 			goto failed;
-		if (!buffer_mapped(&map_bh))
+		if (!buffer_mapped(&bh_map))
 			is_mapped_to_disk = 0;
-		if (buffer_new(&map_bh))
-			unmap_underlying_metadata(map_bh.b_bdev,
-							map_bh.b_blocknr);
+		if (buffer_new(&bh_map))
+			unmap_underlying_metadata(bh_map.b_bdev,
+							bh_map.b_blocknr);
 		if (PageUptodate(page))
 			continue;
-		if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
+		if (buffer_new(&bh_map) || !buffer_mapped(&bh_map)) {
 			kaddr = kmap_atomic(page, KM_USER0);
 			if (block_start < from) {
 				memset(kaddr+block_start, 0, from-block_start);
@@ -2433,7 +2433,7 @@ int nobh_prepare_write(struct page *page
 			kunmap_atomic(kaddr, KM_USER0);
 			continue;
 		}
-		if (buffer_uptodate(&map_bh))
+		if (buffer_uptodate(&bh_map))
 			continue;	/* reiserfs does this */
 		if (block_start < from || block_end > to) {
 			struct buffer_head *bh = alloc_buffer_head(GFP_NOFS);
@@ -2442,14 +2442,14 @@ int nobh_prepare_write(struct page *page
 				ret = -ENOMEM;
 				goto failed;
 			}
-			bh->b_state = map_bh.b_state;
+			bh->b_state = bh_map.b_state;
 			atomic_set(&bh->b_count, 0);
 			bh->b_this_page = NULL;
 			bh->b_page = page;
-			bh->b_blocknr = map_bh.b_blocknr;
+			bh->b_blocknr = bh_map.b_blocknr;
 			bh->b_size = blocksize;
 			bh->b_data = (char *)(long)block_start;
-			bh->b_bdev = map_bh.b_bdev;
+			bh->b_bdev = bh_map.b_bdev;
 			bh->b_private = NULL;
 			read_bh[nr_reads++] = bh;
 		}
fs/mpage.c +42 -42

196 lines not on this page · raw message

fs/direct-io.c +12 -12
@@ -512,7 +512,7 @@ static int dio_bio_reap(struct dio *dio)
 static int get_more_blocks(struct dio *dio)
 {
 	int ret;
-	struct buffer_head *map_bh = &dio->map_bh;
+	struct buffer_head *bh_map = &dio->map_bh;
 	sector_t fs_startblk;	/* Into file, in filesystem-sized blocks */
 	unsigned long fs_count;	/* Number of filesystem-sized blocks */
 	unsigned long dio_count;/* Number of dio_block-sized blocks */
@@ -533,8 +533,8 @@ static int get_more_blocks(struct dio *d
 		if (dio_count & blkmask)	
 			fs_count++;
 
-		map_bh->b_state = 0;
-		map_bh->b_size = fs_count << dio->inode->i_blkbits;
+		bh_map->b_state = 0;
+		bh_map->b_size = fs_count << dio->inode->i_blkbits;
 
 		create = dio->rw & WRITE;
 		if (dio->lock_type == DIO_LOCKING) {
@@ -552,7 +552,7 @@ static int get_more_blocks(struct dio *d
 		 * writes.
 		 */
 		ret = (*dio->get_block)(dio->inode, fs_startblk,
-						map_bh, create);
+						bh_map, create);
 	}
 	return ret;
 }
@@ -799,7 +799,7 @@ static int do_direct_IO(struct dio *dio)
 	const unsigned blocks_per_page = PAGE_SIZE >> blkbits;
 	struct page *page;
 	unsigned block_in_page;
-	struct buffer_head *map_bh = &dio->map_bh;
+	struct buffer_head *bh_map = &dio->map_bh;
 	int ret = 0;
 
 	/* The I/O can start at any block offset within the first page */
@@ -830,14 +830,14 @@ static int do_direct_IO(struct dio *dio)
 					page_cache_release(page);
 					goto out;
 				}
-				if (!buffer_mapped(map_bh))
+				if (!buffer_mapped(bh_map))
 					goto do_holes;
 
 				dio->blocks_available =
-						map_bh->b_size >> dio->blkbits;
+						bh_map->b_size >> dio->blkbits;
 				dio->next_block_for_io =
-					map_bh->b_blocknr << dio->blkfactor;
-				if (buffer_new(map_bh))
+					bh_map->b_blocknr << dio->blkfactor;
+				if (buffer_new(bh_map))
 					clean_blockdev_aliases(dio);
 
 				if (!dio->blkfactor)
@@ -857,13 +857,13 @@ static int do_direct_IO(struct dio *dio)
 				 * the start of the fs block must be zeroed out
 				 * on-disk
 				 */
-				if (!buffer_new(map_bh))
+				if (!buffer_new(bh_map))
 					dio->next_block_for_io += dio_remainder;
 				dio->blocks_available -= dio_remainder;
 			}
 do_holes:
 			/* Handle holes */
-			if (!buffer_mapped(map_bh)) {
+			if (!buffer_mapped(bh_map)) {
 				char *kaddr;
 				loff_t i_size_aligned;
 
@@ -917,7 +917,7 @@ do_holes:
 			this_chunk_bytes = this_chunk_blocks << blkbits;
 			BUG_ON(this_chunk_bytes == 0);
 
-			dio->boundary = buffer_boundary(map_bh);
+			dio->boundary = buffer_boundary(bh_map);
 			ret = submit_page_section(dio, page, offset_in_page,
 				this_chunk_bytes, dio->next_block_for_io);
 			if (ret) {
#1 lore raw
Quoted 7 lines · Jesper Juhl

(please see the mail titled
"[RFC][PATCH 0/9] -Wshadow: Making the kernel build clean with -Wshadow" for an explanation of why I'm doing this)

Fixes for the following -Wshadow warnings :

[...]

Quoted 2 lines

fs/mpage.c:706: warning: declaration of 'wbc' shadows a parameter fs/mpage.c:699: warning: shadowed declaration is here

That chunk seems to be missing from the patch.

Nikita.