From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Mike Snitzer <snitzer@redhat.com>, Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, dm-devel@redhat.com
Subject: Re: [PATCH 5/8] dm: always setup ->orig_bio in alloc_io
Date: Wed, 13 Apr 2022 07:38:29 +0900 [thread overview]
Message-ID: <c4c83c0f-a4fc-2b37-180f-ccb272085fca@opensource.wdc.com> (raw)
In-Reply-To: <YlXmmB6IO7usz2c1@redhat.com>
On 4/13/22 05:52, Mike Snitzer wrote:
> On Tue, Apr 12 2022 at 4:56P -0400,
> Ming Lei <ming.lei@redhat.com> wrote:
>
>> The current DM codes setup ->orig_bio after __map_bio() returns,
>> and not only cause kernel panic for dm zone, but also a bit ugly
>> and tricky, especially the waiting until ->orig_bio is set in
>> dm_submit_bio_remap().
>>
>> The reason is that one new bio is cloned from original FS bio to
>> represent the mapped part, which just serves io accounting.
>>
>> Now we have switched to bdev based io accounting interface, and we
>> can retrieve sectors/bio_op from both the real original bio and the
>> added fields of .sector_offset & .sectors easily, so the new cloned
>> bio isn't necessary any more.
>>
>> Not only fixes dm-zone's kernel panic, but also cleans up dm io
>> accounting & split a bit.
>
> You're conflating quite a few things here. DM zone really has no
> business accessing io->orig_bio (dm-zone.c can just as easily inspect
> the tio->clone, because it hasn't been remapped yet it reflects the
> io->origin_bio, so there is no need to look at io->orig_bio) -- but
> yes I clearly broke things during the 5.18 merge and it needs fixing
> ASAP.
Problem is that we need to look at the BIO op in submission AND completion
path to handle zone append requests. So looking at the clone on submission
is OK since its op is still the original one. But on the completion path,
the clone may now be a regular write emulating a zone append op. And
looking at the clone only does not allow detecting that zone append.
We could have the orig_bio op saved in dm_io to avoid completely looking
at the orig_bio for detecting zone append.
>
> But I'm (ab)using io->orig_bio assignment to indicate to completion
> that it may proceed. See these dm-5.19 commits to see it imposed even
> further:
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.19&id=311a8e6650601a79079000466db77386c5ec2abb
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.19&id=56219ebb5f5c84785aa821f755d545eae41bdb1a
>
> And then leveraged here:
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.19&id=4aa7a368370c2a172d5a0b8927c6332c4b6a3514
>
> Could be all these dm-5.19 changes suck.. but I do know dm-zone.c is
> too tightly coupled to DM core. So I'll focus on that first, fix
> 5.18, and then circle back to "what's next?".
>
> Mike
>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-04-12 23:26 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 8:56 [PATCH 0/8] dm: io accounting & polling improvement Ming Lei
2022-04-12 8:56 ` [PATCH 1/8] block: replace disk based account with bdev's Ming Lei
2022-04-16 5:57 ` Christoph Hellwig
2022-04-12 8:56 ` [PATCH 2/8] dm: don't pass bio to __dm_start_io_acct and dm_end_io_acct Ming Lei
2022-04-12 8:56 ` [PATCH 3/8] dm: pass 'dm_io' instance to dm_io_acct directly Ming Lei
2022-04-12 20:28 ` Mike Snitzer
2022-04-13 1:43 ` Ming Lei
2022-04-12 8:56 ` [PATCH 4/8] dm: switch to bdev based io accounting interface Ming Lei
2022-04-12 8:56 ` [PATCH 5/8] dm: always setup ->orig_bio in alloc_io Ming Lei
2022-04-12 20:52 ` Mike Snitzer
2022-04-12 22:38 ` Damien Le Moal [this message]
2022-04-12 23:00 ` Mike Snitzer
2022-04-12 23:31 ` Damien Le Moal
2022-04-13 0:00 ` Damien Le Moal
2022-04-13 1:56 ` Ming Lei
2022-04-13 6:12 ` Mike Snitzer
2022-04-13 12:26 ` Ming Lei
2022-04-13 17:58 ` Mike Snitzer
2022-04-14 0:36 ` Ming Lei
2022-04-14 2:25 ` Mike Snitzer
2022-04-14 3:57 ` Ming Lei
2022-04-14 17:45 ` Mike Snitzer
2022-04-15 0:14 ` Ming Lei
2022-04-15 21:06 ` Mike Snitzer
2022-04-17 2:22 ` Ming Lei
2022-04-12 8:56 ` [PATCH 6/8] dm: don't grab target io reference in dm_zone_map_bio Ming Lei
2022-04-12 8:56 ` [PATCH 7/8] dm: improve target io referencing Ming Lei
2022-04-12 8:56 ` [PATCH 8/8] dm: put all polled io into one single list Ming Lei
2022-04-12 17:15 ` [PATCH 0/8] dm: io accounting & polling improvement Mike Snitzer
2022-04-16 5:58 ` Christoph Hellwig
2022-04-17 1:23 ` Mike Snitzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4c83c0f-a4fc-2b37-180f-ccb272085fca@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).