Skip to content

Commit 4c66461

Browse files
adam900710kdave
authored andcommitted
btrfs: rename btrfs_bio to btrfs_io_context
The structure btrfs_bio is used by two different sites: - bio->bi_private for mirror based profiles For those profiles (SINGLE/DUP/RAID1*/RAID10), this structures records how many mirrors are still pending, and save the original endio function of the bio. - RAID56 code In that case, RAID56 only utilize the stripes info, and no long uses that to trace the pending mirrors. So btrfs_bio is not always bind to a bio, and contains more info for IO context, thus renaming it will make the naming less confusing. Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent dc28722 commit 4c66461

File tree

11 files changed

+325
-315
lines changed

11 files changed

+325
-315
lines changed

fs/btrfs/check-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
14551455
struct btrfs_fs_info *fs_info = state->fs_info;
14561456
int ret;
14571457
u64 length;
1458-
struct btrfs_bio *multi = NULL;
1458+
struct btrfs_io_context *multi = NULL;
14591459
struct btrfs_device *device;
14601460

14611461
length = len;

fs/btrfs/extent-tree.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ static int btrfs_issue_discard(struct block_device *bdev, u64 start, u64 len,
12661266
return ret;
12671267
}
12681268

1269-
static int do_discard_extent(struct btrfs_bio_stripe *stripe, u64 *bytes)
1269+
static int do_discard_extent(struct btrfs_io_stripe *stripe, u64 *bytes)
12701270
{
12711271
struct btrfs_device *dev = stripe->dev;
12721272
struct btrfs_fs_info *fs_info = dev->fs_info;
@@ -1313,22 +1313,21 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
13131313
u64 discarded_bytes = 0;
13141314
u64 end = bytenr + num_bytes;
13151315
u64 cur = bytenr;
1316-
struct btrfs_bio *bbio = NULL;
1317-
1316+
struct btrfs_io_context *bioc = NULL;
13181317

13191318
/*
1320-
* Avoid races with device replace and make sure our bbio has devices
1319+
* Avoid races with device replace and make sure our bioc has devices
13211320
* associated to its stripes that don't go away while we are discarding.
13221321
*/
13231322
btrfs_bio_counter_inc_blocked(fs_info);
13241323
while (cur < end) {
1325-
struct btrfs_bio_stripe *stripe;
1324+
struct btrfs_io_stripe *stripe;
13261325
int i;
13271326

13281327
num_bytes = end - cur;
13291328
/* Tell the block device(s) that the sectors can be discarded */
13301329
ret = btrfs_map_block(fs_info, BTRFS_MAP_DISCARD, cur,
1331-
&num_bytes, &bbio, 0);
1330+
&num_bytes, &bioc, 0);
13321331
/*
13331332
* Error can be -ENOMEM, -ENOENT (no such chunk mapping) or
13341333
* -EOPNOTSUPP. For any such error, @num_bytes is not updated,
@@ -1337,8 +1336,8 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
13371336
if (ret < 0)
13381337
goto out;
13391338

1340-
stripe = bbio->stripes;
1341-
for (i = 0; i < bbio->num_stripes; i++, stripe++) {
1339+
stripe = bioc->stripes;
1340+
for (i = 0; i < bioc->num_stripes; i++, stripe++) {
13421341
u64 bytes;
13431342
struct btrfs_device *device = stripe->dev;
13441343

@@ -1361,7 +1360,7 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
13611360
* And since there are two loops, explicitly
13621361
* go to out to avoid confusion.
13631362
*/
1364-
btrfs_put_bbio(bbio);
1363+
btrfs_put_bioc(bioc);
13651364
goto out;
13661365
}
13671366

@@ -1372,7 +1371,7 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
13721371
*/
13731372
ret = 0;
13741373
}
1375-
btrfs_put_bbio(bbio);
1374+
btrfs_put_bioc(bioc);
13761375
cur += num_bytes;
13771376
}
13781377
out:

fs/btrfs/extent_io.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,7 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
22902290
struct btrfs_device *dev;
22912291
u64 map_length = 0;
22922292
u64 sector;
2293-
struct btrfs_bio *bbio = NULL;
2293+
struct btrfs_io_context *bioc = NULL;
22942294
int ret;
22952295

22962296
ASSERT(!(fs_info->sb->s_flags & SB_RDONLY));
@@ -2304,7 +2304,7 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
23042304
map_length = length;
23052305

23062306
/*
2307-
* Avoid races with device replace and make sure our bbio has devices
2307+
* Avoid races with device replace and make sure our bioc has devices
23082308
* associated to its stripes that don't go away while we are doing the
23092309
* read repair operation.
23102310
*/
@@ -2317,28 +2317,28 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
23172317
* stripe's dev and sector.
23182318
*/
23192319
ret = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical,
2320-
&map_length, &bbio, 0);
2320+
&map_length, &bioc, 0);
23212321
if (ret) {
23222322
btrfs_bio_counter_dec(fs_info);
23232323
bio_put(bio);
23242324
return -EIO;
23252325
}
2326-
ASSERT(bbio->mirror_num == 1);
2326+
ASSERT(bioc->mirror_num == 1);
23272327
} else {
23282328
ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,
2329-
&map_length, &bbio, mirror_num);
2329+
&map_length, &bioc, mirror_num);
23302330
if (ret) {
23312331
btrfs_bio_counter_dec(fs_info);
23322332
bio_put(bio);
23332333
return -EIO;
23342334
}
2335-
BUG_ON(mirror_num != bbio->mirror_num);
2335+
BUG_ON(mirror_num != bioc->mirror_num);
23362336
}
23372337

2338-
sector = bbio->stripes[bbio->mirror_num - 1].physical >> 9;
2338+
sector = bioc->stripes[bioc->mirror_num - 1].physical >> 9;
23392339
bio->bi_iter.bi_sector = sector;
2340-
dev = bbio->stripes[bbio->mirror_num - 1].dev;
2341-
btrfs_put_bbio(bbio);
2340+
dev = bioc->stripes[bioc->mirror_num - 1].dev;
2341+
btrfs_put_bioc(bioc);
23422342
if (!dev || !dev->bdev ||
23432343
!test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state)) {
23442344
btrfs_bio_counter_dec(fs_info);

fs/btrfs/extent_map.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static void extent_map_device_set_bits(struct extent_map *em, unsigned bits)
360360
int i;
361361

362362
for (i = 0; i < map->num_stripes; i++) {
363-
struct btrfs_bio_stripe *stripe = &map->stripes[i];
363+
struct btrfs_io_stripe *stripe = &map->stripes[i];
364364
struct btrfs_device *device = stripe->dev;
365365

366366
set_extent_bits_nowait(&device->alloc_state, stripe->physical,
@@ -375,7 +375,7 @@ static void extent_map_device_clear_bits(struct extent_map *em, unsigned bits)
375375
int i;
376376

377377
for (i = 0; i < map->num_stripes; i++) {
378-
struct btrfs_bio_stripe *stripe = &map->stripes[i];
378+
struct btrfs_io_stripe *stripe = &map->stripes[i];
379379
struct btrfs_device *device = stripe->dev;
380380

381381
__clear_extent_bit(&device->alloc_state, stripe->physical,

0 commit comments

Comments
 (0)