blk_start_plug(9)
πΈ blk_start_plug(9) πΈ
okay so bestie, welcome to the Kernel API Manual β¨ this one's a little function with main character energy: blk_start_plug.
π NAME π
blk_start_plug β initializes blk_plug and tracks it inside the task_struct π«Ά
β¨ SYNOPSIS β¨
void blk_start_plug (struct blk_plug *plug );
π ARGUMENTS π
plugβ thestruct blk_plugthat needs to be initialized. that's it, that's the one, give it a little kiss on the forehead before you pass it in π
π¦ DESCRIPTION π¦
So here's the vibe: blk_start_plug tells the block layer that the caller intends to submit multiple I/O requests in a batch. like, "hey girl, I'm about to drop a whole haul, not just one thing" ποΈ
The block layer may use this hint to defer submitting I/Os from the caller until blk_finish_plug is called. obsessed, so efficient.
But β and this is the important part, no cap β the block layer may choose to submit requests before a call to blk_finish_plug if:
- the number of queued I/Os exceeds
BLK_MAX_REQUEST_COUNT, or - the size of the I/O is larger than
BLK_PLUG_FLUSH_SIZE.
The queued I/Os may also be submitted early if the task schedules (see below π).
Tracking blk_plug inside the task_struct helps with auto-flushing the pending I/O should the task end up blocking between blk_start_plug and blk_finish_plug. This is important from a performance perspective, but also ensures that we don't deadlock. π¨
For instance: if the task is blocking for a memory allocation, memory reclaim could end up wanting to free a page belonging to that request that is currently residing in our private plug. By flushing the pending I/O when the process goes to sleep, we avoid this kind of deadlock. literally the whole point, iykyk πβ¨
ngl the deadlock avoidance is the real icon here. don't skip the flush, bestie.
π SEE ALSO π
Kernel file ./block/blk-core.c plus these absolute legends:
blk_queue_flag_set(9)blk_queue_flag_clear(9)blk_op_str(9)blk_sync_queue(9)blk_set_pm_only(9)blk_put_queue(9)blk_queue_enter(9)blk_get_queue(9)submit_bio_noacct(9)submit_bio(9)bio_poll(9)bio_start_io_acct(9)blk_lld_busy(9)blk_finish_plug(9)
aaaand that's the page! π brought to you by the ./block girlies, dated October 2026, filed under blk_start_plug(9). mwah, go flush responsibly ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms