Commit a3e7689b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: cleanup the VM accounting in submit_bio

submit_bio uses some extremely convoluted checks and confusing comments
to only account REQ_OP_READ/REQ_OP_WRITE comments.  Just switch to the
plain obvious checks instead.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220516063654.2782792-1-hch@lst.de
[axboe: fixup WRITE -> REQ_OP_WRITE]
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5d2ae142
...@@ -892,19 +892,11 @@ void submit_bio(struct bio *bio) ...@@ -892,19 +892,11 @@ void submit_bio(struct bio *bio)
if (blkcg_punt_bio_submit(bio)) if (blkcg_punt_bio_submit(bio))
return; return;
/* if (bio_op(bio) == REQ_OP_READ) {
* If it's a regular read/write or a barrier with data attached, task_io_account_read(bio->bi_iter.bi_size);
* go through the normal accounting stuff before submission. count_vm_events(PGPGIN, bio_sectors(bio));
*/ } else if (bio_op(bio) == REQ_OP_WRITE) {
if (bio_has_data(bio)) { count_vm_events(PGPGOUT, bio_sectors(bio));
unsigned int count = bio_sectors(bio);
if (op_is_write(bio_op(bio))) {
count_vm_events(PGPGOUT, count);
} else {
task_io_account_read(bio->bi_iter.bi_size);
count_vm_events(PGPGIN, count);
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment