Cache device stores data in a log structure. We need record the log start. Here we override md superblock recovery_offset for this purpose. This field of a cache device is meaningless otherwise. Signed-off-by: Shaohua Li <shli@xxxxxx> --- drivers/md/md.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index fd84f16..9861f34 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1664,6 +1664,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) "cache feature, ignoring the device\n"); return -EINVAL; } + rdev->recovery_offset = le64_to_cpu(sb->recovery_offset); set_bit(WriteCache, &rdev->flags); break; default: @@ -1830,6 +1831,9 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev) sb->dev_roles[i] = cpu_to_le16(0xffff); } + if (test_bit(WriteCache, &rdev->flags)) + sb->recovery_offset = cpu_to_le64(rdev->recovery_offset); + sb->sb_csum = calc_sb_1_csum(sb); } -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html