Message ID | 20231218012746.24442-5-hongyu.jin.cn@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v5,RESEND,1/5] block: Fix bio IO priority setting | expand |
On Mon, Dec 18, 2023 at 09:27:45AM +0800, Hongyu Jin wrote: > From: Hongyu Jin <hongyu.jin@unisoc.com> > > To fix this problem, when read FEC and hash from disk, I/O priority are > inconsistent with data block and blocked by other I/O with low I/O > priority. > > Make I/O for FEC and hash has same I/O priority with original data I/O. "To fix this problem" is supposed to be in the second paragraph, not the first, right? > @@ -728,6 +730,7 @@ static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) > sector_t block = io->block; > unsigned int n_blocks = io->n_blocks; > struct dm_verity_prefetch_work *pw; > + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); > > if (v->validated_blocks) { > while (n_blocks && test_bit(block, v->validated_blocks)) { The caller has the bio pointer already, so maybe just add it as a parameter to verity_submit_prefetch()? - Eric
Eric Biggers <ebiggers@kernel.org> 于2023年12月20日周三 06:48写道: > > On Mon, Dec 18, 2023 at 09:27:45AM +0800, Hongyu Jin wrote: > > From: Hongyu Jin <hongyu.jin@unisoc.com> > > > > To fix this problem, when read FEC and hash from disk, I/O priority are > > inconsistent with data block and blocked by other I/O with low I/O > > priority. > > > > Make I/O for FEC and hash has same I/O priority with original data I/O. > > "To fix this problem" is supposed to be in the second paragraph, not the first, > right? Yes, The verification and error correction process takes effect after obtaining the data. > > > @@ -728,6 +730,7 @@ static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) > > sector_t block = io->block; > > unsigned int n_blocks = io->n_blocks; > > struct dm_verity_prefetch_work *pw; > > + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); > > > > if (v->validated_blocks) { > > while (n_blocks && test_bit(block, v->validated_blocks)) { > > The caller has the bio pointer already, so maybe just add it as a parameter to > verity_submit_prefetch()? > > - Eric ok, I will change it.
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index 715173cbf0ee..6a5a679e7e8a 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -209,6 +209,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, u8 *bbuf, *rs_block; u8 want_digest[HASH_MAX_DIGESTSIZE]; unsigned int n, k; + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); if (neras) *neras = 0; @@ -247,7 +248,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, bufio = v->bufio; } - bbuf = dm_bufio_read(bufio, block, &buf, IOPRIO_DEFAULT); + bbuf = dm_bufio_read(bufio, block, &buf, bio_prio(bio)); if (IS_ERR(bbuf)) { DMWARN_LIMIT("%s: FEC %llu: read failed (%llu): %ld", v->data_dev->name, diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 0038e168f3d7..8c911b6722ce 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -51,6 +51,7 @@ static DEFINE_STATIC_KEY_FALSE(use_tasklet_enabled); struct dm_verity_prefetch_work { struct work_struct work; struct dm_verity *v; + unsigned short ioprio; sector_t block; unsigned int n_blocks; }; @@ -293,6 +294,7 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io, int r; sector_t hash_block; unsigned int offset; + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); verity_hash_at_level(v, block, level, &hash_block, &offset); @@ -307,7 +309,7 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io, return -EAGAIN; } } else - data = dm_bufio_read(v->bufio, hash_block, &buf, IOPRIO_DEFAULT); + data = dm_bufio_read(v->bufio, hash_block, &buf, bio_prio(bio)); if (IS_ERR(data)) return PTR_ERR(data); @@ -717,7 +719,7 @@ static void verity_prefetch_io(struct work_struct *work) } no_prefetch_cluster: dm_bufio_prefetch(v->bufio, hash_block_start, - hash_block_end - hash_block_start + 1, IOPRIO_DEFAULT); + hash_block_end - hash_block_start + 1, pw->ioprio); } kfree(pw); @@ -728,6 +730,7 @@ static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) sector_t block = io->block; unsigned int n_blocks = io->n_blocks; struct dm_verity_prefetch_work *pw; + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); if (v->validated_blocks) { while (n_blocks && test_bit(block, v->validated_blocks)) { @@ -751,6 +754,7 @@ static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) pw->v = v; pw->block = block; pw->n_blocks = n_blocks; + pw->ioprio = bio_prio(bio); queue_work(v->verify_wq, &pw->work); }