Re: [PATCH v2] block: flush queued bios when the process blocks
From: Mike Snitzer
Date: Thu Oct 08 2015 - 11:09:06 EST
On Thu, Oct 08 2015 at 11:04am -0400,
Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
>
>
> On Tue, 6 Oct 2015, Mike Snitzer wrote:
>
> > To give others context for why I'm caring about this issue again, this
> > recent BZ against 4.3-rc served as a reminder that we _need_ a fix:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1267650
> >
> > FYI, I cleaned up the plug-based approach a bit further, here is the
> > incremental patch:
> > http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/commit/?h=wip&id=f73d001ec692125308accbb5ca26f892f949c1b6
> >
> > And here is a new version of the overall combined patch (sharing now
> > before I transition to looking at alternatives, though my gut is the use
> > of a plug in generic_make_request really wouldn't hurt us.. famous last
> > words):
> >
> > block/bio.c | 82 +++++++++++++-------------------------------------
> > block/blk-core.c | 21 ++++++++-----
> > drivers/md/dm-bufio.c | 2 +-
> > drivers/md/raid1.c | 6 ++--
> > drivers/md/raid10.c | 6 ++--
> > include/linux/blkdev.h | 11 +++++--
> > include/linux/sched.h | 4 ---
> > 7 files changed, 51 insertions(+), 81 deletions(-)
> >
...
> > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> > index 2dd3308..c2bff16 100644
> > --- a/drivers/md/dm-bufio.c
> > +++ b/drivers/md/dm-bufio.c
> > @@ -168,7 +168,7 @@ static inline int dm_bufio_cache_index(struct dm_bufio_client *c)
> > #define DM_BUFIO_CACHE(c) (dm_bufio_caches[dm_bufio_cache_index(c)])
> > #define DM_BUFIO_CACHE_NAME(c) (dm_bufio_cache_names[dm_bufio_cache_index(c)])
> >
> > -#define dm_bufio_in_request() (!!current->bio_list)
> > +#define dm_bufio_in_request() (current->plug && !!current->plug->bio_list)
>
> This condition is repeated several times throughout the whole patch - so
> maybe you should make it a function in block device header file.
Yeah, I thought of that too but forgot to come back to it. Will do,
thanks.
FYI, I found another bug in my last patch and fixed it up. I'll get
some refactoring done (including your suggestion), actually _test_ the
code (e.g. verify all of lvm testsuite passes) and then send out v3.
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/