Skip to content

Commit 6feef53

Browse files
crquanJens Axboe
authored andcommitted
block: mark bio_split_pool static
Since all bio_split calls refer the same single bio_split_pool, the bio_split function can use bio_split_pool directly instead of the mempool_t parameter; then the mempool_t parameter can be removed from bio_split param list, and bio_split_pool is only referred in fs/bio.c file, can be marked static. Signed-off-by: Denis ChengRq <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ad3316b commit 6feef53

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

drivers/block/pktcdvd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2544,7 +2544,7 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio)
25442544
if (last_zone != zone) {
25452545
BUG_ON(last_zone != zone + pd->settings.size);
25462546
first_sectors = last_zone - bio->bi_sector;
2547-
bp = bio_split(bio, bio_split_pool, first_sectors);
2547+
bp = bio_split(bio, first_sectors);
25482548
BUG_ON(!bp);
25492549
pkt_make_request(q, &bp->bio1);
25502550
pkt_make_request(q, &bp->bio2);

drivers/md/linear.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static int linear_make_request (struct request_queue *q, struct bio *bio)
353353
* split it.
354354
*/
355355
struct bio_pair *bp;
356-
bp = bio_split(bio, bio_split_pool,
356+
bp = bio_split(bio,
357357
((tmp_dev->offset + tmp_dev->size)<<1) - bio->bi_sector);
358358
if (linear_make_request(q, &bp->bio1))
359359
generic_make_request(&bp->bio1);

drivers/md/raid0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio)
427427
/* This is a one page bio that upper layers
428428
* refuse to split for us, so we need to split it.
429429
*/
430-
bp = bio_split(bio, bio_split_pool, chunk_sects - (bio->bi_sector & (chunk_sects - 1)) );
430+
bp = bio_split(bio, chunk_sects - (bio->bi_sector & (chunk_sects - 1)));
431431
if (raid0_make_request(q, &bp->bio1))
432432
generic_make_request(&bp->bio1);
433433
if (raid0_make_request(q, &bp->bio2))

drivers/md/raid10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static int make_request(struct request_queue *q, struct bio * bio)
817817
/* This is a one page bio that upper layers
818818
* refuse to split for us, so we need to split it.
819819
*/
820-
bp = bio_split(bio, bio_split_pool,
820+
bp = bio_split(bio,
821821
chunk_sects - (bio->bi_sector & (chunk_sects - 1)) );
822822
if (make_request(q, &bp->bio1))
823823
generic_make_request(&bp->bio1);

fs/bio.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
static struct kmem_cache *bio_slab __read_mostly;
3232

33-
mempool_t *bio_split_pool __read_mostly;
33+
static mempool_t *bio_split_pool __read_mostly;
3434

3535
/*
3636
* if you change this list, also change bvec_alloc or things will
@@ -1256,9 +1256,9 @@ static void bio_pair_end_2(struct bio *bi, int err)
12561256
* split a bio - only worry about a bio with a single page
12571257
* in it's iovec
12581258
*/
1259-
struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors)
1259+
struct bio_pair *bio_split(struct bio *bi, int first_sectors)
12601260
{
1261-
struct bio_pair *bp = mempool_alloc(pool, GFP_NOIO);
1261+
struct bio_pair *bp = mempool_alloc(bio_split_pool, GFP_NOIO);
12621262

12631263
if (!bp)
12641264
return bp;
@@ -1292,7 +1292,7 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors)
12921292
bp->bio2.bi_end_io = bio_pair_end_2;
12931293

12941294
bp->bio1.bi_private = bi;
1295-
bp->bio2.bi_private = pool;
1295+
bp->bio2.bi_private = bio_split_pool;
12961296

12971297
if (bio_integrity(bi))
12981298
bio_integrity_split(bi, bp, first_sectors);
@@ -1455,7 +1455,6 @@ EXPORT_SYMBOL(bio_map_kern);
14551455
EXPORT_SYMBOL(bio_copy_kern);
14561456
EXPORT_SYMBOL(bio_pair_release);
14571457
EXPORT_SYMBOL(bio_split);
1458-
EXPORT_SYMBOL(bio_split_pool);
14591458
EXPORT_SYMBOL(bio_copy_user);
14601459
EXPORT_SYMBOL(bio_uncopy_user);
14611460
EXPORT_SYMBOL(bioset_create);

include/linux/bio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ struct bio_pair {
300300
atomic_t cnt;
301301
int error;
302302
};
303-
extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
304-
int first_sectors);
305-
extern mempool_t *bio_split_pool;
303+
extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
306304
extern void bio_pair_release(struct bio_pair *dbio);
307305

308306
extern struct bio_set *bioset_create(int, int);

0 commit comments

Comments
 (0)