From: Mike Snitzer <snitzer@redhat.com> To: Christoph Hellwig <hch@lst.de> Cc: Jens Axboe <axboe@kernel.dk>, linux-raid@vger.kernel.org, dm-devel@redhat.com, linux-btrfs@vger.kernel.org Subject: Re: block: add a bi_error field to struct bio Date: Wed, 10 Jun 2015 11:26:49 -0400 [thread overview] Message-ID: <20150610152649.GA31140@redhat.com> (raw) In-Reply-To: <20150610081138.GA3841@lst.de> On Wed, Jun 10 2015 at 4:11am -0400, Christoph Hellwig <hch@lst.de> wrote: > On Thu, Jun 04, 2015 at 11:31:07AM -0400, Mike Snitzer wrote: > > This patch _really_ concerns me because just in DM alone I found you > > took liberties that you shouldn't have and created a regression. First > > issue is a real bug (your proposed dm-io.c:dmio_complete change missed > > that dm-io uses error_bits and not traditional error code like expected) > > Point taken. I already wanted to complain about the mess due to the bio > error abuse with it's own values in DM in the first posting, guess I > need to add that to the second one. I don't think overloading common > interfaces with your private error codes is a good idea, but let's > leave that for a separate discussion. I'll queue a patch to rename 'error' to 'error_bits' where appropriate. > > the other issue being you added extra branching that isn't needed and > > made review more tedious (dm.c:clone_endio). > > I think the code is better than what it was before, but it's still > a bit of a mess. What do you think of the patch below which I'd > like to add before the big bi_error patch as a preparatory one? If you're referring to the mix of error variables I totally agree. Just don't think we need the extra branching. > > For DM, please add Signed-off-by: Mike Snitzer <snitzer@redhat.com> once > > you've folded in this patch, thanks! > > FYI, that wasn't a foldable patch but updated hunks of the old one. Not > really a problem, but a little confusing. Yeap, should have been clearer they were meant to replace your hunks. > >From f095cbeba5135afa6cf102718319f0d0c1e7b422 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig <hch@lst.de> > Date: Wed, 10 Jun 2015 10:04:45 +0200 > Subject: dm: use a single error code variable in clone_endio > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > clone_endio currently uses two variables for tracking error state, with > values getting bounceѕ forth and back between the two, which makes the > code hard to read. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/md/dm.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 2161ed9..8467976 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -956,7 +956,6 @@ static void disable_write_same(struct mapped_device *md) > > static void clone_endio(struct bio *bio, int error) > { > - int r = error; > struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); > struct dm_io *io = tio->io; > struct mapped_device *md = tio->io->md; > @@ -966,23 +965,22 @@ static void clone_endio(struct bio *bio, int error) > error = -EIO; > > if (endio) { > - r = endio(tio->ti, bio, error); > - if (r < 0 || r == DM_ENDIO_REQUEUE) > - /* > - * error and requeue request are handled > - * in dec_pending(). > - */ > - error = r; > - else if (r == DM_ENDIO_INCOMPLETE) > + error = endio(tio->ti, bio, error); > + if (error == DM_ENDIO_INCOMPLETE) { > /* The target will handle the io */ > return; > - else if (r) { > - DMWARN("unimplemented target endio return value: %d", r); > + } > + > + if (error > 0 && error != DM_ENDIO_REQUEUE) { > + DMWARN("unimplemented target endio return value: %d", > + error); > BUG(); > } > + > + /* Error and requeue request are handled in dec_pending(). */ > } > > - if (unlikely(r == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) && > + if (unlikely(error == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) && > !bdev_get_queue(bio->bi_bdev)->limits.max_write_same_sectors)) > disable_write_same(md); > > -- > 1.9.1 Unfortunately by dropping the original error (e.g. -EREMOTEIO) on the floor (in the 'if (endio) {' branch) you're breaking the REQ_WRITE_SAME check. Your new bi_error patch gets away with the redundant error code cleanup because we can directly check the bio's bi_error for -EREMOTEIO. So feel free to fold the simplified 'if (error > 0 && error != DM_ENDIO_REQUEUE) {' in to your new patch -- but not seeing the point of making this prep patch in advance. -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com> To: Christoph Hellwig <hch@lst.de> Cc: Jens Axboe <axboe@kernel.dk>, linux-raid@vger.kernel.org, dm-devel@redhat.com, linux-btrfs@vger.kernel.org Subject: Re: block: add a bi_error field to struct bio Date: Wed, 10 Jun 2015 11:26:49 -0400 [thread overview] Message-ID: <20150610152649.GA31140@redhat.com> (raw) In-Reply-To: <20150610081138.GA3841@lst.de> On Wed, Jun 10 2015 at 4:11am -0400, Christoph Hellwig <hch@lst.de> wrote: > On Thu, Jun 04, 2015 at 11:31:07AM -0400, Mike Snitzer wrote: > > This patch _really_ concerns me because just in DM alone I found you > > took liberties that you shouldn't have and created a regression. First > > issue is a real bug (your proposed dm-io.c:dmio_complete change missed > > that dm-io uses error_bits and not traditional error code like expected) > > Point taken. I already wanted to complain about the mess due to the bio > error abuse with it's own values in DM in the first posting, guess I > need to add that to the second one. I don't think overloading common > interfaces with your private error codes is a good idea, but let's > leave that for a separate discussion. I'll queue a patch to rename 'error' to 'error_bits' where appropriate. > > the other issue being you added extra branching that isn't needed and > > made review more tedious (dm.c:clone_endio). > > I think the code is better than what it was before, but it's still > a bit of a mess. What do you think of the patch below which I'd > like to add before the big bi_error patch as a preparatory one? If you're referring to the mix of error variables I totally agree. Just don't think we need the extra branching. > > For DM, please add Signed-off-by: Mike Snitzer <snitzer@redhat.com> once > > you've folded in this patch, thanks! > > FYI, that wasn't a foldable patch but updated hunks of the old one. Not > really a problem, but a little confusing. Yeap, should have been clearer they were meant to replace your hunks. > >From f095cbeba5135afa6cf102718319f0d0c1e7b422 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig <hch@lst.de> > Date: Wed, 10 Jun 2015 10:04:45 +0200 > Subject: dm: use a single error code variable in clone_endio > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > clone_endio currently uses two variables for tracking error state, with > values getting bounceѕ forth and back between the two, which makes the > code hard to read. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/md/dm.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 2161ed9..8467976 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -956,7 +956,6 @@ static void disable_write_same(struct mapped_device *md) > > static void clone_endio(struct bio *bio, int error) > { > - int r = error; > struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); > struct dm_io *io = tio->io; > struct mapped_device *md = tio->io->md; > @@ -966,23 +965,22 @@ static void clone_endio(struct bio *bio, int error) > error = -EIO; > > if (endio) { > - r = endio(tio->ti, bio, error); > - if (r < 0 || r == DM_ENDIO_REQUEUE) > - /* > - * error and requeue request are handled > - * in dec_pending(). > - */ > - error = r; > - else if (r == DM_ENDIO_INCOMPLETE) > + error = endio(tio->ti, bio, error); > + if (error == DM_ENDIO_INCOMPLETE) { > /* The target will handle the io */ > return; > - else if (r) { > - DMWARN("unimplemented target endio return value: %d", r); > + } > + > + if (error > 0 && error != DM_ENDIO_REQUEUE) { > + DMWARN("unimplemented target endio return value: %d", > + error); > BUG(); > } > + > + /* Error and requeue request are handled in dec_pending(). */ > } > > - if (unlikely(r == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) && > + if (unlikely(error == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) && > !bdev_get_queue(bio->bi_bdev)->limits.max_write_same_sectors)) > disable_write_same(md); > > -- > 1.9.1 Unfortunately by dropping the original error (e.g. -EREMOTEIO) on the floor (in the 'if (endio) {' branch) you're breaking the REQ_WRITE_SAME check. Your new bi_error patch gets away with the redundant error code cleanup because we can directly check the bio's bi_error for -EREMOTEIO. So feel free to fold the simplified 'if (error > 0 && error != DM_ENDIO_REQUEUE) {' in to your new patch -- but not seeing the point of making this prep patch in advance.
next prev parent reply other threads:[~2015-06-10 15:26 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-03 13:42 [RFC] add a bi_error field Christoph Hellwig 2015-06-03 13:42 ` [PATCH] block: add a bi_error field to struct bio Christoph Hellwig 2015-06-04 9:53 ` [dm-devel] " Martin K. Petersen 2015-06-04 15:31 ` Mike Snitzer 2015-06-10 8:11 ` Christoph Hellwig 2015-06-10 8:11 ` Christoph Hellwig 2015-06-10 15:26 ` Mike Snitzer [this message] 2015-06-10 15:26 ` Mike Snitzer 2015-06-10 16:01 ` Mike Snitzer 2015-06-10 16:04 ` Christoph Hellwig 2015-06-10 16:50 ` Mike Snitzer 2015-06-10 18:29 ` anup modak 2015-06-11 7:53 ` Christoph Hellwig 2015-06-11 7:59 ` Christoph Hellwig 2015-06-10 2:50 ` [dm-devel] [PATCH] " Neil Brown 2015-06-10 8:45 ` Christoph Hellwig 2015-06-11 7:59 ` [RFC] add a bi_error field Liu Bo 2015-06-11 8:05 ` Liu Bo 2015-06-11 8:08 ` Christoph Hellwig 2015-06-11 9:42 ` Liu Bo
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=20150610152649.GA31140@redhat.com \ --to=snitzer@redhat.com \ --cc=axboe@kernel.dk \ --cc=dm-devel@redhat.com \ --cc=hch@lst.de \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-raid@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.