Skip to contentSkip to conversation

block: fix logging on capacity change

PATCH Applied Ming Lei 3 participants 3 messages Feb 23, 2021 – Feb 24, 2021 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: fix logging on capacity change

Local variable of 'capacity' stores the previous disk capacity, and 'size' variable records the latest disk capacity, so swap them for fixing logging on capacity change.

Cc Christoph Hellwig <[email protected]>
Fixes a782483cc1f8 ("block: remove the nr_sects field in struct hd_struct")
---
 block/genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/genhd.c +1 -1
index 36ff45bbaaaf..dbb92e24ef65 100644
@@ -74,7 +74,7 @@ bool set_capacity_and_notify(struct gendisk *disk, sector_t size)
 		return false;
 
 	pr_info("%s: detected capacity change from %lld to %lld\n",
-		disk->disk_name, size, capacity);
+		disk->disk_name, capacity, size);
 
 	/*
 	 * Historically we did not send a uevent for changes to/from an empty
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Ming Lei

Local variable of 'capacity' stores the previous disk capacity, and 'size' variable records the latest disk capacity, so swap them for fixing logging on capacity change.

Ok, looks like we're racing for fixes a lot lately. I have the same fix commited locally since this morning..

Looks good:

maintainer Applied
#2 lore raw
In reply to Ming Lei
Quoted 3 lines · Ming Lei

Local variable of 'capacity' stores the previous disk capacity, and 'size' variable records the latest disk capacity, so swap them for fixing logging on capacity change.

Applied, thanks.

Signature · 1 line
Jens Axboe