[U-Boot] [PATCH 1/3] Revert "blk: Invalidate block cache when switching hwpart"

Weijie Gao weijie.gao at mediatek.com
Tue Aug 27 07:32:18 UTC 2019


This reverts commit 0ebe112d09b48230ba4be833cd3504b06997d9a4.

Most block devices have only one hwpart. Multiple hwparts only found used
by eMMC devices in u-boot. The mmc driver do blk_dselect_hwpart() at the
beginning of mmc_bread() which causes block cache being invalidated too
frequently and makes block cache useless.

So it's not a good idea to put blkcache_invalidate() in the common
functions. It should be called inside mmc_select_hwpart().

Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
---
 drivers/block/blk-uclass.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index c23b6682a6..baaf431e5e 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -208,11 +208,7 @@ int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
 	if (ret)
 		return ret;
 
-	ret = blk_select_hwpart(dev, hwpart);
-	if (!ret)
-		blkcache_invalidate(if_type, devnum);
-
-	return ret;
+	return blk_select_hwpart(dev, hwpart);
 }
 
 int blk_list_part(enum if_type if_type)
@@ -352,13 +348,7 @@ int blk_select_hwpart(struct udevice *dev, int hwpart)
 
 int blk_dselect_hwpart(struct blk_desc *desc, int hwpart)
 {
-	int ret;
-
-	ret = blk_select_hwpart(desc->bdev, hwpart);
-	if (!ret)
-		blkcache_invalidate(desc->if_type, desc->devnum);
-
-	return ret;
+	return blk_select_hwpart(desc->bdev, hwpart);
 }
 
 int blk_first_device(int if_type, struct udevice **devp)
-- 
2.17.1



More information about the U-Boot mailing list