Skip to contentSkip to conversation

check bh->b_blocknr only if BH_Mapped is set

PATCH In review Nikanth Karthikesan 2 participants 3 messages Feb 9, 2009 – Feb 11, 2009 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check bh->b_blocknr only if BH_Mapped is set

check bh->b_blocknr only if BH_Mapped is set

---

fs/buffer.c +0 -0
index 665d446..782c365 100644
@@ -344,13 +344,13 @@ __find_get_block_slow(struct block_device *bdev, 

sector_t block)
head = page_buffers(page);
bh = head;
do {
- if (bh->b_blocknr == block) {
+ if (!buffer_mapped(bh))
+ all_mapped = 0;
+ else if (bh->b_blocknr == block) {
ret = bh;
get_bh(bh);
goto out_unlock;
}
- if (!buffer_mapped(bh))
- all_mapped = 0;
bh = bh->b_this_page;
} while (bh != head);

#1 lore raw
Quoted 1 line · On Mon, 9 Feb 2009 17:48:11 +0530 Nikanth Karthikesan <[email protected]> wrote:

check bh->b_blocknr only if BH_Mapped is set

Why?

Quoted 11 lines
fs/buffer.c +1 -1
index 665d446..782c365 100644
@@ -344,13 +344,13 @@ __find_get_block_slow(struct block_device *bdev, 
 sector_t block)
 	head = page_buffers(page);
 	bh = head;
 	do {
-		if (bh->b_blocknr == block) {
+		if (!buffer_mapped(bh))

fs/buffer.c __find_get_block_slow(struct block_device *bdev, · line 356

Quoted 10 lines
fs/buffer.c +2 -2
+			all_mapped = 0;
+		else if (bh->b_blocknr == block) {
 			ret = bh;
 			get_bh(bh);
 			goto out_unlock;
 		}
-		if (!buffer_mapped(bh))
-			all_mapped = 0;
 		bh = bh->b_this_page;
 	} while (bh != head);

Does this fix some user-visible misbehaviour? If so, what was that behaviour?

Please write good changelogs. This is not some pointless book-keeping exercise. People will make decisions about which kernel versions patches should be merged into, and they will want to know if a particular patch addresses a particular problem which they are experiencing. For this, they need information.

Thanks.

#2 lore raw
Quoted 7 lines · On Wednesday 11 February 2009 02:16:40 Andrew Morton wrote:

On Mon, 9 Feb 2009 17:48:11 +0530

Quoted 1 line · Nikanth Karthikesan

check bh->b_blocknr only if BH_Mapped is set

Why?

b_blocknr will have a valid blocknr only when BH_Mapped is set.

Quoted 16 lines
Quoted 16 lines
fs/buffer.c +3 -1
index 665d446..782c365 100644
@@ -344,13 +344,13 @@ __find_get_block_slow(struct block_device *bdev,
 sector_t block)
 	head = page_buffers(page);
 	bh = head;
 	do {
-		if (bh->b_blocknr == block) {
+		if (!buffer_mapped(bh))
+			all_mapped = 0;
+		else if (bh->b_blocknr == block) {
 			ret = bh;
 			get_bh(bh);
 			goto out_unlock;
Quoted 9 lines

fs/buffer.c __find_get_block_slow(struct block_device *bdev, · line 356

Quoted 5 lines
fs/buffer.c +0 -2
 		}
-		if (!buffer_mapped(bh))
-			all_mapped = 0;
 		bh = bh->b_this_page;
 	} while (bh != head);

Does this fix some user-visible misbehaviour? If so, what was that behaviour?

No. I was looking at the "Bug 12593 - __find_get_block_slow while using parted." Even though this may not be the cause of that bug, I think this could be a potential problem elsewhere.

Quoted 6 lines

Please write good changelogs. This is not some pointless book-keeping exercise. People will make decisions about which kernel versions patches should be merged into, and they will want to know if a particular patch addresses a particular problem which they are experiencing. For this, they need information.

Sorry for the bad changelog. Thanks for pointing it out.

Thanks
Nikanth