Skip to content

Commit ed00aab

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: rename generic_make_request to submit_bio_noacct
generic_make_request has always been very confusingly misnamed, so rename it to submit_bio_noacct to make it clear that it is submit_bio minus accounting and a few checks. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c62b37d commit ed00aab

44 files changed

Lines changed: 115 additions & 118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/block/biodoc.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ Now the generic block layer performs partition-remapping early and thus
10361036
provides drivers with a sector number relative to whole device, rather than
10371037
having to take partition number into account in order to arrive at the true
10381038
sector number. The routine blk_partition_remap() is invoked by
1039-
generic_make_request even before invoking the queue specific ->submit_bio,
1039+
submit_bio_noacct even before invoking the queue specific ->submit_bio,
10401040
so the i/o scheduler also gets to operate on whole disk sector numbers. This
10411041
should typically not require changes to block drivers, it just never gets
10421042
to invoke its own partition sector offset calculations since all bios

‎Documentation/fault-injection/fault-injection.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Available fault injection capabilities
2424

2525
injects disk IO errors on devices permitted by setting
2626
/sys/block/<device>/make-it-fail or
27-
/sys/block/<device>/<partition>/make-it-fail. (generic_make_request())
27+
/sys/block/<device>/<partition>/make-it-fail. (submit_bio_noacct())
2828

2929
- fail_mmc_request
3030

‎Documentation/trace/ftrace.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ function-trace, we get a much larger output::
14531453
=> __blk_run_queue_uncond
14541454
=> __blk_run_queue
14551455
=> blk_queue_bio
1456-
=> generic_make_request
1456+
=> submit_bio_noacct
14571457
=> submit_bio
14581458
=> submit_bh
14591459
=> __ext3_get_inode_loc
@@ -1738,7 +1738,7 @@ tracers.
17381738
=> __blk_run_queue_uncond
17391739
=> __blk_run_queue
17401740
=> blk_queue_bio
1741-
=> generic_make_request
1741+
=> submit_bio_noacct
17421742
=> submit_bio
17431743
=> submit_bh
17441744
=> ext3_bread

‎block/bio.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static void bio_alloc_rescue(struct work_struct *work)
358358
if (!bio)
359359
break;
360360

361-
generic_make_request(bio);
361+
submit_bio_noacct(bio);
362362
}
363363
}
364364

@@ -416,19 +416,19 @@ static void punt_bios_to_rescuer(struct bio_set *bs)
416416
* submit the previously allocated bio for IO before attempting to allocate
417417
* a new one. Failure to do so can cause deadlocks under memory pressure.
418418
*
419-
* Note that when running under generic_make_request() (i.e. any block
419+
* Note that when running under submit_bio_noacct() (i.e. any block
420420
* driver), bios are not submitted until after you return - see the code in
421-
* generic_make_request() that converts recursion into iteration, to prevent
421+
* submit_bio_noacct() that converts recursion into iteration, to prevent
422422
* stack overflows.
423423
*
424424
* This would normally mean allocating multiple bios under
425-
* generic_make_request() would be susceptible to deadlocks, but we have
425+
* submit_bio_noacct() would be susceptible to deadlocks, but we have
426426
* deadlock avoidance code that resubmits any blocked bios from a rescuer
427427
* thread.
428428
*
429429
* However, we do not guarantee forward progress for allocations from other
430430
* mempools. Doing multiple allocations from the same mempool under
431-
* generic_make_request() should be avoided - instead, use bio_set's front_pad
431+
* submit_bio_noacct() should be avoided - instead, use bio_set's front_pad
432432
* for per bio allocations.
433433
*
434434
* RETURNS:
@@ -457,14 +457,14 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs,
457457
nr_iovecs > 0))
458458
return NULL;
459459
/*
460-
* generic_make_request() converts recursion to iteration; this
460+
* submit_bio_noacct() converts recursion to iteration; this
461461
* means if we're running beneath it, any bios we allocate and
462462
* submit will not be submitted (and thus freed) until after we
463463
* return.
464464
*
465465
* This exposes us to a potential deadlock if we allocate
466466
* multiple bios from the same bio_set() while running
467-
* underneath generic_make_request(). If we were to allocate
467+
* underneath submit_bio_noacct(). If we were to allocate
468468
* multiple bios (say a stacking block driver that was splitting
469469
* bios), we would deadlock if we exhausted the mempool's
470470
* reserve.

‎block/blk-core.c‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
956956
return BLK_STS_OK;
957957
}
958958

959-
static noinline_for_stack bool
960-
generic_make_request_checks(struct bio *bio)
959+
static noinline_for_stack bool submit_bio_checks(struct bio *bio)
961960
{
962961
struct request_queue *q = bio->bi_disk->queue;
963962
blk_status_t status = BLK_STS_IOERR;
@@ -985,9 +984,8 @@ generic_make_request_checks(struct bio *bio)
985984
}
986985

987986
/*
988-
* Filter flush bio's early so that make_request based
989-
* drivers without flush support don't have to worry
990-
* about them.
987+
* Filter flush bio's early so that bio based drivers without flush
988+
* support don't have to worry about them.
991989
*/
992990
if (op_is_flush(bio->bi_opf) &&
993991
!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) {
@@ -1072,7 +1070,7 @@ generic_make_request_checks(struct bio *bio)
10721070
return false;
10731071
}
10741072

1075-
static blk_qc_t do_make_request(struct bio *bio)
1073+
static blk_qc_t __submit_bio(struct bio *bio)
10761074
{
10771075
struct gendisk *disk = bio->bi_disk;
10781076
blk_qc_t ret = BLK_QC_T_NONE;
@@ -1087,15 +1085,15 @@ static blk_qc_t do_make_request(struct bio *bio)
10871085
}
10881086

10891087
/**
1090-
* generic_make_request - re-submit a bio to the block device layer for I/O
1088+
* submit_bio_noacct - re-submit a bio to the block device layer for I/O
10911089
* @bio: The bio describing the location in memory and on the device.
10921090
*
10931091
* This is a version of submit_bio() that shall only be used for I/O that is
10941092
* resubmitted to lower level drivers by stacking block drivers. All file
10951093
* systems and other upper level users of the block layer should use
10961094
* submit_bio() instead.
10971095
*/
1098-
blk_qc_t generic_make_request(struct bio *bio)
1096+
blk_qc_t submit_bio_noacct(struct bio *bio)
10991097
{
11001098
/*
11011099
* bio_list_on_stack[0] contains bios submitted by the current
@@ -1106,15 +1104,15 @@ blk_qc_t generic_make_request(struct bio *bio)
11061104
struct bio_list bio_list_on_stack[2];
11071105
blk_qc_t ret = BLK_QC_T_NONE;
11081106

1109-
if (!generic_make_request_checks(bio))
1107+
if (!submit_bio_checks(bio))
11101108
goto out;
11111109

11121110
/*
11131111
* We only want one ->submit_bio to be active at a time, else
11141112
* stack usage with stacked devices could be a problem. So use
11151113
* current->bio_list to keep a list of requests submited by a
11161114
* ->submit_bio method. current->bio_list is also used as a
1117-
* flag to say if generic_make_request is currently active in this
1115+
* flag to say if submit_bio_noacct is currently active in this
11181116
* task or not. If it is NULL, then no make_request is active. If
11191117
* it is non-NULL, then a make_request is active, and new requests
11201118
* should be added at the tail
@@ -1132,7 +1130,7 @@ blk_qc_t generic_make_request(struct bio *bio)
11321130
* we assign bio_list to a pointer to the bio_list_on_stack,
11331131
* thus initialising the bio_list of new bios to be
11341132
* added. ->submit_bio() may indeed add some more bios
1135-
* through a recursive call to generic_make_request. If it
1133+
* through a recursive call to submit_bio_noacct. If it
11361134
* did, we find a non-NULL value in bio_list and re-enter the loop
11371135
* from the top. In this case we really did just take the bio
11381136
* of the top of the list (no pretending) and so remove it from
@@ -1150,7 +1148,7 @@ blk_qc_t generic_make_request(struct bio *bio)
11501148
/* Create a fresh bio_list for all subordinate requests */
11511149
bio_list_on_stack[1] = bio_list_on_stack[0];
11521150
bio_list_init(&bio_list_on_stack[0]);
1153-
ret = do_make_request(bio);
1151+
ret = __submit_bio(bio);
11541152

11551153
/* sort new bios into those for a lower level
11561154
* and those for the same level
@@ -1174,13 +1172,13 @@ blk_qc_t generic_make_request(struct bio *bio)
11741172
out:
11751173
return ret;
11761174
}
1177-
EXPORT_SYMBOL(generic_make_request);
1175+
EXPORT_SYMBOL(submit_bio_noacct);
11781176

11791177
/**
11801178
* direct_make_request - hand a buffer directly to its device driver for I/O
11811179
* @bio: The bio describing the location in memory and on the device.
11821180
*
1183-
* This function behaves like generic_make_request(), but does not protect
1181+
* This function behaves like submit_bio_noacct(), but does not protect
11841182
* against recursion. Must only be used if the called driver is known
11851183
* to be blk-mq based.
11861184
*/
@@ -1192,7 +1190,7 @@ blk_qc_t direct_make_request(struct bio *bio)
11921190
bio_io_error(bio);
11931191
return BLK_QC_T_NONE;
11941192
}
1195-
if (!generic_make_request_checks(bio))
1193+
if (!submit_bio_checks(bio))
11961194
return BLK_QC_T_NONE;
11971195
if (unlikely(bio_queue_enter(bio)))
11981196
return BLK_QC_T_NONE;
@@ -1263,13 +1261,13 @@ blk_qc_t submit_bio(struct bio *bio)
12631261
blk_qc_t ret;
12641262

12651263
psi_memstall_enter(&pflags);
1266-
ret = generic_make_request(bio);
1264+
ret = submit_bio_noacct(bio);
12671265
psi_memstall_leave(&pflags);
12681266

12691267
return ret;
12701268
}
12711269

1272-
return generic_make_request(bio);
1270+
return submit_bio_noacct(bio);
12731271
}
12741272
EXPORT_SYMBOL(submit_bio);
12751273

‎block/blk-crypto-fallback.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static bool blk_crypto_split_bio_if_needed(struct bio **bio_ptr)
228228
return false;
229229
}
230230
bio_chain(split_bio, bio);
231-
generic_make_request(bio);
231+
submit_bio_noacct(bio);
232232
*bio_ptr = split_bio;
233233
}
234234

‎block/blk-crypto.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void __blk_crypto_free_request(struct request *rq)
239239
* kernel crypto API. When the crypto API fallback is used for encryption,
240240
* blk-crypto may choose to split the bio into 2 - the first one that will
241241
* continue to be processed and the second one that will be resubmitted via
242-
* generic_make_request. A bounce bio will be allocated to encrypt the contents
242+
* submit_bio_noacct. A bounce bio will be allocated to encrypt the contents
243243
* of the aforementioned "first one", and *bio_ptr will be updated to this
244244
* bounce bio.
245245
*

‎block/blk-merge.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void __blk_queue_split(struct bio **bio, unsigned int *nr_segs)
338338

339339
bio_chain(split, *bio);
340340
trace_block_split(q, split, (*bio)->bi_iter.bi_sector);
341-
generic_make_request(*bio);
341+
submit_bio_noacct(*bio);
342342
*bio = split;
343343
}
344344
}

‎block/blk-throttle.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,8 @@ static void blk_throtl_dispatch_work_fn(struct work_struct *work)
13391339

13401340
if (!bio_list_empty(&bio_list_on_stack)) {
13411341
blk_start_plug(&plug);
1342-
while((bio = bio_list_pop(&bio_list_on_stack)))
1343-
generic_make_request(bio);
1342+
while ((bio = bio_list_pop(&bio_list_on_stack)))
1343+
submit_bio_noacct(bio);
13441344
blk_finish_plug(&plug);
13451345
}
13461346
}

‎block/bounce.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
309309
if (!passthrough && sectors < bio_sectors(*bio_orig)) {
310310
bio = bio_split(*bio_orig, sectors, GFP_NOIO, &bounce_bio_split);
311311
bio_chain(bio, *bio_orig);
312-
generic_make_request(*bio_orig);
312+
submit_bio_noacct(*bio_orig);
313313
*bio_orig = bio;
314314
}
315315
bio = bounce_clone_bio(*bio_orig, GFP_NOIO, passthrough ? NULL :

0 commit comments

Comments
 (0)