From: Coly Li Date: Wed, 13 Nov 2019 08:03:18 +0000 (+0800) Subject: bcache: add more accurate error messages in read_super() X-Git-Tag: v5.15~5119^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaf8dbeab5865720c66db60ae8329309e81a0c9c;p=platform%2Fkernel%2Flinux-starfive.git bcache: add more accurate error messages in read_super() Previous code only returns "Not a bcache superblock" for both bcache super block offset and magic error. This patch addss more accurate error messages, - for super block unmatched offset: "Not a bcache superblock (bad offset)" - for super block unmatched magic number: "Not a bcache superblock (bad magic)" Signed-off-by: Coly Li Signed-off-by: Jens Axboe --- diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 7becced..623fdaf 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -92,10 +92,11 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev, pr_debug("read sb version %llu, flags %llu, seq %llu, journal size %u", sb->version, sb->flags, sb->seq, sb->keys); - err = "Not a bcache superblock"; + err = "Not a bcache superblock (bad offset)"; if (sb->offset != SB_SECTOR) goto err; + err = "Not a bcache superblock (bad magic)"; if (memcmp(sb->magic, bcache_magic, 16)) goto err;