Commit d2236f62 authored by Colin Ian King's avatar Colin Ian King Committed by Miquel Raynal
Browse files

mtdblock: make warning messages ratelimited



When exercising various dev interfaces with stress-ng the mtdblock drivers
can be (ab)used to generate a lot of warning messages. Make these rate
limited to reduce the kernel log from being spammed with the same messages.

Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230719103354.2829366-1-colin.i.king@gmail.com
parent c2fc6b69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
	}

	if (mtd_type_is_nand(mbd->mtd))
		pr_warn("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n",
		pr_warn_ratelimited("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n",
			mbd->tr->name, mbd->mtd->name);

	/* OK, it's not open. Create cache info for it */
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
	dev->readonly = 1;

	if (mtd_type_is_nand(mtd))
		pr_warn("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n",
		pr_warn_ratelimited("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n",
			tr->name, mtd->name);

	if (add_mtd_blktrans_dev(dev))