md-bitmap: set BITMAP_WRITE_ERROR in write_sb_page

Set BITMAP_WRITE_ERROR directly in write_sb_page instead of propagating
the error to the caller and setting it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230615064840.629492-2-hch@lst.de
This commit is contained in:
Christoph Hellwig 2023-06-15 08:48:30 +02:00 коммит произвёл Song Liu
Родитель f71209b1f2
Коммит 59cefee75b
1 изменённых файлов: 8 добавлений и 13 удалений

Просмотреть файл

@ -279,22 +279,20 @@ static int __write_sb_page(struct md_rdev *rdev, struct bitmap *bitmap,
return 0; return 0;
} }
static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) static void write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
{ {
struct md_rdev *rdev;
struct mddev *mddev = bitmap->mddev; struct mddev *mddev = bitmap->mddev;
int ret;
do { do {
rdev = NULL; struct md_rdev *rdev = NULL;
while ((rdev = next_active_rdev(rdev, mddev)) != NULL) { while ((rdev = next_active_rdev(rdev, mddev)) != NULL) {
ret = __write_sb_page(rdev, bitmap, page); if (__write_sb_page(rdev, bitmap, page) < 0) {
if (ret) set_bit(BITMAP_WRITE_ERROR, &bitmap->flags);
return ret; return;
}
} }
} while (wait && md_super_wait(mddev) < 0); } while (wait && md_super_wait(mddev) < 0);
return 0;
} }
static void md_bitmap_file_kick(struct bitmap *bitmap); static void md_bitmap_file_kick(struct bitmap *bitmap);
@ -306,10 +304,7 @@ static void write_page(struct bitmap *bitmap, struct page *page, int wait)
struct buffer_head *bh; struct buffer_head *bh;
if (bitmap->storage.file == NULL) { if (bitmap->storage.file == NULL) {
switch (write_sb_page(bitmap, page, wait)) { write_sb_page(bitmap, page, wait);
case -EINVAL:
set_bit(BITMAP_WRITE_ERROR, &bitmap->flags);
}
} else { } else {
bh = page_buffers(page); bh = page_buffers(page);