From: NeilBrown <neilb@suse.com>
To: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Mike Snitzer <snitzer@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-raid@vger.kernel.org,
device-mapper development <dm-devel@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
Pavel Machek <pavel@ucw.cz>,
Jack Wang <jinpu.wang@profitbricks.com>,
Kent Overstreet <kent.overstreet@gmail.com>
Subject: Re: [PATCH v2] blk: improve order of bio handling in generic_make_request()
Date: Sat, 11 Mar 2017 11:47:56 +1100 [thread overview]
Message-ID: <87shmkfxkz.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CANr6vz8EbRWXq7igGCzRy9JC1Nt=MMma0h8M6nxHQtwiMDa5aQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3001 bytes --]
On Fri, Mar 10 2017, Lars Ellenberg wrote:
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -1975,7 +1975,14 @@ generic_make_request_checks(struct bio *bio)
>> */
>> blk_qc_t generic_make_request(struct bio *bio)
>> {
>> - struct bio_list bio_list_on_stack;
>> + /*
>> + * bio_list_on_stack[0] contains bios submitted by the current
>> + * make_request_fn.
>> + * bio_list_on_stack[1] contains bios that were submitted before
>> + * the current make_request_fn, but that haven't been processed
>> + * yet.
>> + */
>> + struct bio_list bio_list_on_stack[2];
>> blk_qc_t ret = BLK_QC_T_NONE;
>
> May I suggest that, if you intend to assign something that is not a
> plain &(struct bio_list), but a &(struct bio_list[2]),
> you change the task member so it is renamed (current->bio_list vs
> current->bio_lists, plural, is what I did last year).
> Or you will break external modules, silently, and horribly (or,
> rather, they won't notice, but break the kernel).
> Examples of such modules would be DRBD, ZFS, quite possibly others.
>
This is exactly what I didn't in my first draft (bio_list -> bio_lists),
but then I reverted that change because it didn't seem to be worth the
noise.
It isn't much noise, sched.h, bcache/btree.c, md/dm-bufio.c, and
md/raid1.c get minor changes.
But as I'm hoping to get rid of all of those uses, renaming before
removing seemed pointless ... though admittedly that is what I did for
bioset_create().... I wondered about that too.
The example you give later:
struct bio_list *tmp = current->bio_list;
current->bio_list = NULL;
submit_bio()
current->bio_list = tmp;
won't cause any problem. Whatever lists the parent generic_make_request
is holding onto will be untouched during the submit_bio() call, and will
be exactly as it expects them when this caller returns.
If some out-of-tree code does anything with ->bio_list that makes sense
with the previous code, then it will still make sense with the new
code. However there will be a few bios that it didn't get too look at.
These will all be bios that were submitted by a device further up the
stack (closer to the filesystem), so they *should* be irrelevant.
I could probably come up with some weird behaviour that might have
worked before but now wouldn't quite work the same way. But just fixing
bugs can sometimes affect an out-of-tree driver in a strange way because
it was assuming those bugs.
I hope that I'll soon be able to remove punt_bios_to_rescuer and
flush_current_bio_list, after which current->bio_list can really be
just a list again. I don't think it is worth changing the name for a
transient situation.
But thanks for the review - it encouraged me to think though the
consequences again and I'm now more confident.
I actually now think that change probably wasn't necessary. It is
safer though. It ensures that current functionality isn't removed
without a clear justification.
Thanks,
NeilBrown
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
prev parent reply other threads:[~2017-03-11 0:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87h93blz6g.fsf@notabene.neil.brown.name>
[not found] ` <71562c2c-97f4-9a0a-32ec-30e0702ca575@profitbricks.com>
[not found] ` <87lgsjj9w8.fsf@notabene.neil.brown.name>
[not found] ` <a674456d-fb93-437e-c50e-195e7a035ba4@kernel.dk>
2017-03-07 20:38 ` [PATCH v2] blk: improve order of bio handling in generic_make_request() NeilBrown
2017-03-10 4:32 ` NeilBrown
2017-03-10 4:33 ` [PATCH 1/5 v3] " NeilBrown
2017-03-10 4:34 ` [PATCH 2/5] blk: remove bio_set arg from blk_queue_split() NeilBrown
2017-03-10 4:35 ` [PATCH 3/5] blk: make the bioset rescue_workqueue optional NeilBrown
2017-03-10 4:36 ` [PATCH 4/5] blk: use non-rescuing bioset for q->bio_split NeilBrown
2017-03-10 4:37 ` [PATCH 5/5] block_dev: make blkdev_dio_pool a non-rescuing bioset NeilBrown
2017-03-10 4:38 ` [PATCH v2] blk: improve order of bio handling in generic_make_request() Jens Axboe
2017-03-10 4:40 ` Jens Axboe
2017-03-10 5:19 ` NeilBrown
2017-03-10 12:34 ` Lars Ellenberg
2017-03-10 14:38 ` Mike Snitzer
2017-03-10 14:55 ` Mikulas Patocka
2017-03-10 15:07 ` Jack Wang
2017-03-10 15:35 ` Mike Snitzer
2017-03-10 18:51 ` Lars Ellenberg
2017-03-11 0:47 ` NeilBrown [this message]
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=87shmkfxkz.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=jinpu.wang@profitbricks.com \
--cc=kent.overstreet@gmail.com \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=pavel@ucw.cz \
--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).