Skip to content

Commit 1d0ef1c

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: raid56: handle endio in rmw_rbio
Both callers of rmv_rbio call rbio_orig_end_io right after it, so move the call into the shared function. Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 52f0c19 commit 1d0ef1c

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

fs/btrfs/raid56.c

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,7 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
22352235
return false;
22362236
}
22372237

2238-
static int rmw_rbio(struct btrfs_raid_bio *rbio)
2238+
static void rmw_rbio(struct btrfs_raid_bio *rbio)
22392239
{
22402240
struct bio_list bio_list;
22412241
int sectornr;
@@ -2247,7 +2247,7 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
22472247
*/
22482248
ret = alloc_rbio_parity_pages(rbio);
22492249
if (ret < 0)
2250-
return ret;
2250+
goto out;
22512251

22522252
/*
22532253
* Either full stripe write, or we have every data sector already
@@ -2260,13 +2260,13 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
22602260
*/
22612261
ret = alloc_rbio_data_pages(rbio);
22622262
if (ret < 0)
2263-
return ret;
2263+
goto out;
22642264

22652265
index_rbio_pages(rbio);
22662266

22672267
ret = rmw_read_wait_recover(rbio);
22682268
if (ret < 0)
2269-
return ret;
2269+
goto out;
22702270
}
22712271

22722272
/*
@@ -2299,7 +2299,7 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
22992299
bio_list_init(&bio_list);
23002300
ret = rmw_assemble_write_bios(rbio, &bio_list);
23012301
if (ret < 0)
2302-
return ret;
2302+
goto out;
23032303

23042304
/* We should have at least one bio assembled. */
23052305
ASSERT(bio_list_size(&bio_list));
@@ -2316,32 +2316,22 @@ static int rmw_rbio(struct btrfs_raid_bio *rbio)
23162316
break;
23172317
}
23182318
}
2319-
return ret;
2319+
out:
2320+
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
23202321
}
23212322

23222323
static void rmw_rbio_work(struct work_struct *work)
23232324
{
23242325
struct btrfs_raid_bio *rbio;
2325-
int ret;
23262326

23272327
rbio = container_of(work, struct btrfs_raid_bio, work);
2328-
2329-
ret = lock_stripe_add(rbio);
2330-
if (ret == 0) {
2331-
ret = rmw_rbio(rbio);
2332-
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
2333-
}
2328+
if (lock_stripe_add(rbio) == 0)
2329+
rmw_rbio(rbio);
23342330
}
23352331

23362332
static void rmw_rbio_work_locked(struct work_struct *work)
23372333
{
2338-
struct btrfs_raid_bio *rbio;
2339-
int ret;
2340-
2341-
rbio = container_of(work, struct btrfs_raid_bio, work);
2342-
2343-
ret = rmw_rbio(rbio);
2344-
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
2334+
rmw_rbio(container_of(work, struct btrfs_raid_bio, work));
23452335
}
23462336

23472337
/*

0 commit comments

Comments
 (0)