From: Mike Snitzer <snitzer@redhat.com>
To: alex chen <alex.chen@huawei.com>
Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>, Milan Broz <asi@seznam.cz>,
Mike Anderson <andmike@linux.vnet.ibm.com>,
christophe varoqui <christophe.varoqui@free.fr>,
dm-devel@redhat.com, Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
Joseph Qi <joseph.qi@huawei.com>,
Alasdair Kergon <agk@redhat.com>
Subject: dm: disable WRITE SAME if it fails
Date: Mon, 2 Jun 2014 14:36:35 -0400 [thread overview]
Message-ID: <20140602183635.GA1396@redhat.com> (raw)
In-Reply-To: <20140531150517.GJ29705@agk-dp.fab.redhat.com>
On Sat, May 31 2014 at 11:05am -0400,
Alasdair G Kergon <agk@redhat.com> wrote:
> On Sat, May 31, 2014 at 04:51:30PM +0800, alex chen wrote:
> > The original commit f84cb8a46a771f36a04a02c61ea635c968ed5f6a("dm mpath:
> > disable WRITE SAME if it fails") disables WRITE SAME in the DM multipath
> > device if it fails, but when the DM linear device stacks ontop of the
> > multipath device it doesn't help.
> > this patch adds DM linear end_io method to catch WRITE SAME errors and
> > disables WRITE SAME in the DM linear device's queue_limits if an
> > underlying device disables it.
>
> How does your patch address striped targets?
>
> Shouldn't this code be taken out of mpath and moved to dm.c and applied to all
> targets (both bio and rq-based, at least where WRITE SAME is supported)?
Alex,
I've implemented what Alasdair and I have been suggesting.
Can you please test this untested patch?
Thanks,
Mike
---
drivers/md/dm-mpath.c | 11 +----------
drivers/md/dm.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index fa0f6cb..9eb6dfd 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1240,17 +1240,8 @@ static int do_end_io(struct multipath *m, struct request *clone,
if (!error && !clone->errors)
return 0; /* I/O complete */
- if (noretry_error(error)) {
- if ((clone->cmd_flags & REQ_WRITE_SAME) &&
- !clone->q->limits.max_write_same_sectors) {
- struct queue_limits *limits;
-
- /* device doesn't really support WRITE SAME, disable it */
- limits = dm_get_queue_limits(dm_table_get_md(m->ti->table));
- limits->max_write_same_sectors = 0;
- }
+ if (noretry_error(error))
return error;
- }
if (mpio->pgpath)
fail_path(mpio->pgpath);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 97940fc..c37581c 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -755,6 +755,14 @@ static void dec_pending(struct dm_io *io, int error)
}
}
+static void disable_write_same(struct mapped_device *md)
+{
+ struct queue_limits *limits = dm_get_queue_limits(md);
+
+ /* device doesn't really support WRITE SAME, disable it */
+ limits->max_write_same_sectors = 0;
+}
+
static void clone_endio(struct bio *bio, int error)
{
int r = 0;
@@ -783,6 +791,10 @@ static void clone_endio(struct bio *bio, int error)
}
}
+ if (r < 0 && (bio->bi_rw & REQ_WRITE_SAME) &&
+ !bdev_get_queue(bio->bi_bdev)->limits.max_write_same_sectors)
+ disable_write_same(md);
+
free_tio(md, tio);
dec_pending(io, error);
}
@@ -977,6 +989,10 @@ static void dm_done(struct request *clone, int error, bool mapped)
r = rq_end_io(tio->ti, clone, error, &tio->info);
}
+ if (r < 0 && (clone->cmd_flags & REQ_WRITE_SAME) &&
+ !clone->q->limits.max_write_same_sectors)
+ disable_write_same(tio->md);
+
if (r <= 0)
/* The target wants to complete the I/O */
dm_end_request(clone, r);
next prev parent reply other threads:[~2014-06-02 18:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 4:14 [PATCH] dm linear: disable WRITE SAME if it fails alex chen
2014-03-05 7:30 ` alex chen
2014-03-05 14:23 ` Mike Snitzer
2014-05-31 8:51 ` [PATCH] " alex chen
2014-05-31 14:43 ` Alasdair G Kergon
2014-05-31 15:05 ` Alasdair G Kergon
2014-06-02 18:36 ` Mike Snitzer [this message]
2014-06-03 16:58 ` dm: " Mike Snitzer
2014-06-03 22:59 ` Martin K. Petersen
2014-06-04 0:06 ` Mike Snitzer
2014-06-04 4:03 ` alex chen
2014-06-04 13:52 ` Mike Snitzer
2014-06-05 1:52 ` alex chen
2014-06-05 13:07 ` 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=20140602183635.GA1396@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=alex.chen@huawei.com \
--cc=andmike@linux.vnet.ibm.com \
--cc=asi@seznam.cz \
--cc=christophe.varoqui@free.fr \
--cc=dm-devel@redhat.com \
--cc=j-nomura@ce.jp.nec.com \
--cc=joseph.qi@huawei.com \
--cc=k-ueda@ct.jp.nec.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 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.