Skip to content

Commit 5424a0b

Browse files
Mikulas Patockasnitm
authored andcommitted
dm: don't report "detected capacity change" on device creation
When a DM device is first created it doesn't yet have an established capacity, therefore the use of set_capacity_and_notify() should be conditional given the potential for needless pr_info "detected capacity change" noise even if capacity is 0. One could argue that the pr_info() in set_capacity_and_notify() is misplaced, but that position is not held uniformly. Signed-off-by: Mikulas Patocka <[email protected]> Fixes: f64d9b2 ("dm: use set_capacity_and_notify") Cc: [email protected] Signed-off-by: Mike Snitzer <[email protected]>
1 parent 2d669ce commit 5424a0b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/md/dm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
20362036
if (size != dm_get_size(md))
20372037
memset(&md->geometry, 0, sizeof(md->geometry));
20382038

2039-
set_capacity_and_notify(md->disk, size);
2039+
if (!get_capacity(md->disk))
2040+
set_capacity(md->disk, size);
2041+
else
2042+
set_capacity_and_notify(md->disk, size);
20402043

20412044
dm_table_event_callback(t, event_callback, md);
20422045

0 commit comments

Comments
 (0)