Skip to contentSkip to conversation

writeback: account BDI's min_ratio for unregistered device

PATCH Superseded Akinobu Mita 2 participants 2 messages Aug 17, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 writeback: account BDI's min_ratio for unregistered device

Quoted 1 line

From mm/page-writeback.c:

	/*
	 * bdi_min_ratio keeps the sum of the minimum dirty shares of all
	 * registered backing devices, which, for obvious reasons, can not
	 * exceed 100%.
	 */
	static unsigned int bdi_min_ratio;

But when a backing device is unregistered, the BDI's min_ratio is not subtracted from bdi_min_ratio. So the second attempt to set min_ratio in the following commands will fail.

	# modprobe null_blk
	# echo 50 > /sys/block/nullb0/bdi/min_ratio
	# modprobe -r null_blk
	# modprobe null_blk
	# echo 50 > /sys/block/nullb0/bdi/min_ratio
---
 mm/backing-dev.c | 1 +
 1 file changed, 1 insertion(+)
mm/backing-dev.c +1 -0
index 42e0a63..92eefe3 100644
@@ -849,6 +849,7 @@ void bdi_destroy(struct backing_dev_info *bdi)
 	}
 
 	wb_exit(&bdi->wb);
+	bdi_set_min_ratio(bdi, 0);
 }
 EXPORT_SYMBOL(bdi_destroy);
 
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Akinobu Mita

From mm/page-writeback.c:

	/*
	 * bdi_min_ratio keeps the sum of the minimum dirty shares of all
	 * registered backing devices, which, for obvious reasons, can not
	 * exceed 100%.
	 */
	static unsigned int bdi_min_ratio;

But when a backing device is unregistered, the BDI's min_ratio is not subtracted from bdi_min_ratio. So the second attempt to set min_ratio in the following commands will fail.

	# modprobe null_blk
	# echo 50 > /sys/block/nullb0/bdi/min_ratio
	# modprobe -r null_blk
	# modprobe null_blk
	# echo 50 > /sys/block/nullb0/bdi/min_ratio
Quoted 3 lines

We probably want to cc stable too.

Thanks.

Signature · 1 line
tejun