From 24f3ab010422d82ef7e7acf9682f003e73432aa5 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Thu, 12 Aug 2010 04:14:00 +0100 Subject: [PATCH] --- yaml --- r: 209155 b: refs/heads/master c: 708e929513502fb050c0a3c3ee267cab5b056ded h: refs/heads/master i: 209153: c145a16be1f414caaec3572a6aa6cb681f53b601 209151: b53da4c4418e9c58e8c90eca9eee20e4f16ae227 v: v3 --- [refs] | 2 +- trunk/drivers/md/dm.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 08923c2c20cd..cfb59e62d8d2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 87c961cb747fa55b664b76abfcb9d44c14ae851f +refs/heads/master: 708e929513502fb050c0a3c3ee267cab5b056ded diff --git a/trunk/drivers/md/dm.c b/trunk/drivers/md/dm.c index a503b95ecbfb..f3cc5d99fe8d 100644 --- a/trunk/drivers/md/dm.c +++ b/trunk/drivers/md/dm.c @@ -639,8 +639,14 @@ static void dec_pending(struct dm_io *io, int error) * There can be just one barrier request so we use * a per-device variable for error reporting. * Note that you can't touch the bio after end_io_acct + * + * We ignore -EOPNOTSUPP for empty flush reported by + * underlying devices. We assume that if the device + * doesn't support empty barriers, it doesn't need + * cache flushing commands. */ - if (!md->barrier_error && io_error != -EOPNOTSUPP) + if (!md->barrier_error && + !(bio_empty_barrier(bio) && io_error == -EOPNOTSUPP)) md->barrier_error = io_error; end_io_acct(io); free_io(md, io); @@ -2284,7 +2290,12 @@ static void process_barrier(struct mapped_device *md, struct bio *bio) if (!bio_empty_barrier(bio)) { __split_and_process_bio(md, bio); - dm_flush(md); + /* + * If the request isn't supported, don't waste time with + * the second flush. + */ + if (md->barrier_error != -EOPNOTSUPP) + dm_flush(md); } if (md->barrier_error != DM_ENDIO_REQUEUE)