aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-18 21:22:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-18 21:22:45 -0400
commitb1dab2f0409c478fd2d9e227c2c018524eca9603 (patch)
tree9d2b29b9209c6e0036da295b7704452aa7d35e72 /drivers
parent2f05af8b5943d5702ef555c91da93af99938be44 (diff)
parentf402693d06f32e746c6153e459c5fb064fa02741 (diff)
Merge tag 'dm-3.4-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
Pull a dm fix from Alasdair G Kergon: "A fix to the thin provisioning userspace interface." * tag 'dm-3.4-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: dm thin: fix table output when pool target disables discard passdown internally
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-thin.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 2fd87b544a93..eb3d138ff55a 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1632,6 +1632,21 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti)
1632 pool->low_water_blocks = pt->low_water_blocks; 1632 pool->low_water_blocks = pt->low_water_blocks;
1633 pool->pf = pt->pf; 1633 pool->pf = pt->pf;
1634 1634
1635 /*
1636 * If discard_passdown was enabled verify that the data device
1637 * supports discards. Disable discard_passdown if not; otherwise
1638 * -EOPNOTSUPP will be returned.
1639 */
1640 if (pt->pf.discard_passdown) {
1641 struct request_queue *q = bdev_get_queue(pt->data_dev->bdev);
1642 if (!q || !blk_queue_discard(q)) {
1643 char buf[BDEVNAME_SIZE];
1644 DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.",
1645 bdevname(pt->data_dev->bdev, buf));
1646 pool->pf.discard_passdown = 0;
1647 }
1648 }
1649
1635 return 0; 1650 return 0;
1636} 1651}
1637 1652
@@ -1988,19 +2003,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
1988 goto out_flags_changed; 2003 goto out_flags_changed;
1989 } 2004 }
1990 2005
1991 /*
1992 * If discard_passdown was enabled verify that the data device
1993 * supports discards. Disable discard_passdown if not; otherwise
1994 * -EOPNOTSUPP will be returned.
1995 */
1996 if (pf.discard_passdown) {
1997 struct request_queue *q = bdev_get_queue(data_dev->bdev);
1998 if (!q || !blk_queue_discard(q)) {
1999 DMWARN("Discard unsupported by data device: Disabling discard passdown.");
2000 pf.discard_passdown = 0;
2001 }
2002 }
2003
2004 pt->pool = pool; 2006 pt->pool = pool;
2005 pt->ti = ti; 2007 pt->ti = ti;
2006 pt->metadata_dev = metadata_dev; 2008 pt->metadata_dev = metadata_dev;
@@ -2385,7 +2387,7 @@ static int pool_status(struct dm_target *ti, status_type_t type,
2385 (unsigned long long)pt->low_water_blocks); 2387 (unsigned long long)pt->low_water_blocks);
2386 2388
2387 count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled + 2389 count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled +
2388 !pool->pf.discard_passdown; 2390 !pt->pf.discard_passdown;
2389 DMEMIT("%u ", count); 2391 DMEMIT("%u ", count);
2390 2392
2391 if (!pool->pf.zero_new_blocks) 2393 if (!pool->pf.zero_new_blocks)
@@ -2394,7 +2396,7 @@ static int pool_status(struct dm_target *ti, status_type_t type,
2394 if (!pool->pf.discard_enabled) 2396 if (!pool->pf.discard_enabled)
2395 DMEMIT("ignore_discard "); 2397 DMEMIT("ignore_discard ");
2396 2398
2397 if (!pool->pf.discard_passdown) 2399 if (!pt->pf.discard_passdown)
2398 DMEMIT("no_discard_passdown "); 2400 DMEMIT("no_discard_passdown ");
2399 2401
2400 break; 2402 break;