diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-08-21 00:32:18 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-07 09:21:21 -0800 |
commit | c429d08d9667437f9cbb711c1072b6ea40a96053 (patch) | |
tree | 58c94ade7417f41f288ac60f8343fdcf9648a398 | |
parent | 865af99ac05e7079901b2f9a6f1edf421af88756 (diff) |
bcache: drop ca->discard
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | drivers/md/bcache/alloc.c | 3 | ||||
-rw-r--r-- | drivers/md/bcache/bcache.h | 6 | ||||
-rw-r--r-- | drivers/md/bcache/journal.c | 3 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 3 | ||||
-rw-r--r-- | drivers/md/bcache/sysfs.c | 5 |
5 files changed, 5 insertions, 15 deletions
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 507d9fae1418..165fb8d36db2 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -462,7 +462,8 @@ static int bch_allocator_thread(void *arg) * dropped bucket lock */ - if (ca->discard) { + if (CACHE_DISCARD(cache_member_info(ca)) && + blk_queue_discard(bdev_get_queue(ca->bdev))) { mutex_unlock(&c->bucket_lock); blkdev_issue_discard(ca->bdev, bucket_to_sector(c, bucket), diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 7b78492d07f8..73d0369b2222 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -588,12 +588,6 @@ struct cache { #define NUM_GC_GENS 7 struct open_bucket *gc_buckets[NUM_GC_GENS]; - /* - * If set, the allocator thread will issue discard operations to newly - * invalidated buckets. - */ - bool discard; - struct journal_device journal; /* The rest of this all shows up in sysfs */ diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 250f05a9bf37..701a39928fbe 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -502,7 +502,8 @@ static void do_journal_discard(struct cache *ca) struct journal_device *ja = &ca->journal; struct bio *bio = &ja->discard_bio; - if (!ca->discard) { + if (!CACHE_DISCARD(cache_member_info(ca)) || + !blk_queue_discard(bdev_get_queue(ca->bdev))) { ja->discard_idx = ja->last_idx; return; } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 7cc5f0c3c2e6..f1b2bb2d0f77 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -2072,9 +2072,6 @@ static int cache_init(struct cache *ca) init_waitqueue_head(&ca->fifo_wait); bch_moving_init_cache(ca); - if (blk_queue_discard(bdev_get_queue(ca->bdev))) - ca->discard = CACHE_DISCARD(cache_member_info(ca)); - return 0; } diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 5b60fe9bf7c0..d699a85bd6ef 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -937,7 +937,7 @@ SHOW(__bch_cache) sysfs_hprint(block_size, block_bytes(ca)); sysfs_print(block_size_bytes, block_bytes(ca)); sysfs_print(nbuckets, ca->sb.nbuckets); - sysfs_print(discard, ca->discard); + sysfs_print(discard, CACHE_DISCARD(mi)); sysfs_hprint(written, atomic_long_read(&ca->sectors_written) << 9); sysfs_hprint(btree_written, atomic_long_read(&ca->btree_sectors_written) << 9); @@ -993,9 +993,6 @@ STORE(__bch_cache) if (attr == &sysfs_discard) { bool v = strtoul_or_return(buf); - if (blk_queue_discard(bdev_get_queue(ca->bdev))) - ca->discard = v; - if (v != CACHE_DISCARD(mi)) { SET_CACHE_DISCARD(mi, v); bcache_write_super(c); |