Skip to content

Commit 38f520a

Browse files
committed
md/md-bitmap: cleanup bitmap_ops->startwrite()
bitmap_startwrite() always return 0, and the caller doesn't check return value as well, hence change the method to void. Also rename startwrite/endwrite to start_write/end_write, which is more in line with the usual naming convention. Link: https://lore.kernel.org/linux-raid/[email protected] Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Xiao Ni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
1 parent b886475 commit 38f520a

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

drivers/md/md-bitmap.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,13 +1682,13 @@ __acquires(bitmap->lock)
16821682
&(bitmap->bp[page].map[pageoff]);
16831683
}
16841684

1685-
static int bitmap_startwrite(struct mddev *mddev, sector_t offset,
1686-
unsigned long sectors)
1685+
static void bitmap_start_write(struct mddev *mddev, sector_t offset,
1686+
unsigned long sectors)
16871687
{
16881688
struct bitmap *bitmap = mddev->bitmap;
16891689

16901690
if (!bitmap)
1691-
return 0;
1691+
return;
16921692

16931693
while (sectors) {
16941694
sector_t blocks;
@@ -1698,7 +1698,7 @@ static int bitmap_startwrite(struct mddev *mddev, sector_t offset,
16981698
bmc = md_bitmap_get_counter(&bitmap->counts, offset, &blocks, 1);
16991699
if (!bmc) {
17001700
spin_unlock_irq(&bitmap->counts.lock);
1701-
return 0;
1701+
return;
17021702
}
17031703

17041704
if (unlikely(COUNTER(*bmc) == COUNTER_MAX)) {
@@ -1734,11 +1734,10 @@ static int bitmap_startwrite(struct mddev *mddev, sector_t offset,
17341734
else
17351735
sectors = 0;
17361736
}
1737-
return 0;
17381737
}
17391738

1740-
static void bitmap_endwrite(struct mddev *mddev, sector_t offset,
1741-
unsigned long sectors)
1739+
static void bitmap_end_write(struct mddev *mddev, sector_t offset,
1740+
unsigned long sectors)
17421741
{
17431742
struct bitmap *bitmap = mddev->bitmap;
17441743

@@ -3013,8 +3012,8 @@ static struct bitmap_operations bitmap_ops = {
30133012
.end_behind_write = bitmap_end_behind_write,
30143013
.wait_behind_writes = bitmap_wait_behind_writes,
30153014

3016-
.startwrite = bitmap_startwrite,
3017-
.endwrite = bitmap_endwrite,
3015+
.start_write = bitmap_start_write,
3016+
.end_write = bitmap_end_write,
30183017
.start_sync = bitmap_start_sync,
30193018
.end_sync = bitmap_end_sync,
30203019
.cond_end_sync = bitmap_cond_end_sync,

drivers/md/md-bitmap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ struct bitmap_operations {
8080
void (*end_behind_write)(struct mddev *mddev);
8181
void (*wait_behind_writes)(struct mddev *mddev);
8282

83-
int (*startwrite)(struct mddev *mddev, sector_t offset,
83+
void (*start_write)(struct mddev *mddev, sector_t offset,
84+
unsigned long sectors);
85+
void (*end_write)(struct mddev *mddev, sector_t offset,
8486
unsigned long sectors);
85-
void (*endwrite)(struct mddev *mddev, sector_t offset,
86-
unsigned long sectors);
8787
bool (*start_sync)(struct mddev *mddev, sector_t offset,
8888
sector_t *blocks, bool degraded);
8989
void (*end_sync)(struct mddev *mddev, sector_t offset, sector_t *blocks);

drivers/md/md.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8799,14 +8799,14 @@ static void md_bitmap_start(struct mddev *mddev,
87998799
mddev->pers->bitmap_sector(mddev, &md_io_clone->offset,
88008800
&md_io_clone->sectors);
88018801

8802-
mddev->bitmap_ops->startwrite(mddev, md_io_clone->offset,
8803-
md_io_clone->sectors);
8802+
mddev->bitmap_ops->start_write(mddev, md_io_clone->offset,
8803+
md_io_clone->sectors);
88048804
}
88058805

88068806
static void md_bitmap_end(struct mddev *mddev, struct md_io_clone *md_io_clone)
88078807
{
8808-
mddev->bitmap_ops->endwrite(mddev, md_io_clone->offset,
8809-
md_io_clone->sectors);
8808+
mddev->bitmap_ops->end_write(mddev, md_io_clone->offset,
8809+
md_io_clone->sectors);
88108810
}
88118811

88128812
static void md_end_clone_io(struct bio *bio)

0 commit comments

Comments
 (0)