diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-22 13:23:39 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-22 13:23:39 -0500 |
| commit | af22941ae126b528a80c7e1149fa22b31815c826 (patch) | |
| tree | bd364ac0648fa6acde2756dfa52f6d875ce0ba1a | |
| parent | 9be962d5258ebb5a0f1edd3ede26bfd847c4ebe6 (diff) | |
| parent | 633395b67bb222f85bb8f825c7751a54b9ec84ee (diff) | |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block layer fixes from Jens Axboe:
"Just a set of small fixes that have either been queued up after the
original pull for this merge window, or just missed the original pull
request.
- a few bcache fixes/changes from Eric and Kent
- add WRITE_SAME to the command filter whitelist frm Mauricio
- kill an unused struct member from Ritesh
- partition IO alignment fix from Stefan
- nvme sysfs printf fix from Stephen"
* 'for-linus' of git://git.kernel.dk/linux-block:
block: check partition alignment
nvme : Use correct scnprintf in cmb show
block: allow WRITE_SAME commands with the SG_IO ioctl
block: Remove unused member (busy) from struct blk_queue_tag
bcache: partition support: add 16 minors per bcacheN device
bcache: Make gc wakeup sane, remove set_task_state()
| -rw-r--r-- | block/ioctl.c | 3 | ||||
| -rw-r--r-- | block/scsi_ioctl.c | 3 | ||||
| -rw-r--r-- | drivers/md/bcache/bcache.h | 4 | ||||
| -rw-r--r-- | drivers/md/bcache/btree.c | 39 | ||||
| -rw-r--r-- | drivers/md/bcache/btree.h | 3 | ||||
| -rw-r--r-- | drivers/md/bcache/request.c | 4 | ||||
| -rw-r--r-- | drivers/md/bcache/super.c | 7 | ||||
| -rw-r--r-- | drivers/nvme/host/pci.c | 4 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 1 |
9 files changed, 38 insertions, 30 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index f856963204f4..656c8c6ed206 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
| @@ -45,6 +45,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
| 45 | || pstart < 0 || plength < 0 || partno > 65535) | 45 | || pstart < 0 || plength < 0 || partno > 65535) |
| 46 | return -EINVAL; | 46 | return -EINVAL; |
| 47 | } | 47 | } |
| 48 | /* check if partition is aligned to blocksize */ | ||
| 49 | if (p.start & (bdev_logical_block_size(bdev) - 1)) | ||
| 50 | return -EINVAL; | ||
| 48 | 51 | ||
| 49 | mutex_lock(&bdev->bd_mutex); | 52 | mutex_lock(&bdev->bd_mutex); |
| 50 | 53 | ||
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 0774799942e0..c6fee7437be4 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
| @@ -182,6 +182,9 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter) | |||
| 182 | __set_bit(WRITE_16, filter->write_ok); | 182 | __set_bit(WRITE_16, filter->write_ok); |
| 183 | __set_bit(WRITE_LONG, filter->write_ok); | 183 | __set_bit(WRITE_LONG, filter->write_ok); |
| 184 | __set_bit(WRITE_LONG_2, filter->write_ok); | 184 | __set_bit(WRITE_LONG_2, filter->write_ok); |
| 185 | __set_bit(WRITE_SAME, filter->write_ok); | ||
| 186 | __set_bit(WRITE_SAME_16, filter->write_ok); | ||
| 187 | __set_bit(WRITE_SAME_32, filter->write_ok); | ||
| 185 | __set_bit(ERASE, filter->write_ok); | 188 | __set_bit(ERASE, filter->write_ok); |
| 186 | __set_bit(GPCMD_MODE_SELECT_10, filter->write_ok); | 189 | __set_bit(GPCMD_MODE_SELECT_10, filter->write_ok); |
| 187 | __set_bit(MODE_SELECT, filter->write_ok); | 190 | __set_bit(MODE_SELECT, filter->write_ok); |
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 6b420a55c745..c3ea03c9a1a8 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
| @@ -425,7 +425,7 @@ struct cache { | |||
| 425 | * until a gc finishes - otherwise we could pointlessly burn a ton of | 425 | * until a gc finishes - otherwise we could pointlessly burn a ton of |
| 426 | * cpu | 426 | * cpu |
| 427 | */ | 427 | */ |
| 428 | unsigned invalidate_needs_gc:1; | 428 | unsigned invalidate_needs_gc; |
| 429 | 429 | ||
| 430 | bool discard; /* Get rid of? */ | 430 | bool discard; /* Get rid of? */ |
| 431 | 431 | ||
| @@ -593,8 +593,8 @@ struct cache_set { | |||
| 593 | 593 | ||
| 594 | /* Counts how many sectors bio_insert has added to the cache */ | 594 | /* Counts how many sectors bio_insert has added to the cache */ |
| 595 | atomic_t sectors_to_gc; | 595 | atomic_t sectors_to_gc; |
| 596 | wait_queue_head_t gc_wait; | ||
| 596 | 597 | ||
| 597 | wait_queue_head_t moving_gc_wait; | ||
| 598 | struct keybuf moving_gc_keys; | 598 | struct keybuf moving_gc_keys; |
| 599 | /* Number of moving GC bios in flight */ | 599 | /* Number of moving GC bios in flight */ |
| 600 | struct semaphore moving_in_flight; | 600 | struct semaphore moving_in_flight; |
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 6fdd8e252760..a43eedd5804d 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c | |||
| @@ -1757,32 +1757,34 @@ static void bch_btree_gc(struct cache_set *c) | |||
| 1757 | bch_moving_gc(c); | 1757 | bch_moving_gc(c); |
| 1758 | } | 1758 | } |
| 1759 | 1759 | ||
| 1760 | static int bch_gc_thread(void *arg) | 1760 | static bool gc_should_run(struct cache_set *c) |
| 1761 | { | 1761 | { |
| 1762 | struct cache_set *c = arg; | ||
| 1763 | struct cache *ca; | 1762 | struct cache *ca; |
| 1764 | unsigned i; | 1763 | unsigned i; |
| 1765 | 1764 | ||
| 1766 | while (1) { | 1765 | for_each_cache(ca, c, i) |
| 1767 | again: | 1766 | if (ca->invalidate_needs_gc) |
| 1768 | bch_btree_gc(c); | 1767 | return true; |
| 1769 | 1768 | ||
| 1770 | set_current_state(TASK_INTERRUPTIBLE); | 1769 | if (atomic_read(&c->sectors_to_gc) < 0) |
| 1771 | if (kthread_should_stop()) | 1770 | return true; |
| 1772 | break; | ||
| 1773 | 1771 | ||
| 1774 | mutex_lock(&c->bucket_lock); | 1772 | return false; |
| 1773 | } | ||
| 1775 | 1774 | ||
| 1776 | for_each_cache(ca, c, i) | 1775 | static int bch_gc_thread(void *arg) |
| 1777 | if (ca->invalidate_needs_gc) { | 1776 | { |
| 1778 | mutex_unlock(&c->bucket_lock); | 1777 | struct cache_set *c = arg; |
| 1779 | set_current_state(TASK_RUNNING); | ||
| 1780 | goto again; | ||
| 1781 | } | ||
| 1782 | 1778 | ||
| 1783 | mutex_unlock(&c->bucket_lock); | 1779 | while (1) { |
| 1780 | wait_event_interruptible(c->gc_wait, | ||
| 1781 | kthread_should_stop() || gc_should_run(c)); | ||
| 1784 | 1782 | ||
| 1785 | schedule(); | 1783 | if (kthread_should_stop()) |
| 1784 | break; | ||
| 1785 | |||
| 1786 | set_gc_sectors(c); | ||
| 1787 | bch_btree_gc(c); | ||
| 1786 | } | 1788 | } |
| 1787 | 1789 | ||
| 1788 | return 0; | 1790 | return 0; |
| @@ -1790,11 +1792,10 @@ again: | |||
| 1790 | 1792 | ||
| 1791 | int bch_gc_thread_start(struct cache_set *c) | 1793 | int bch_gc_thread_start(struct cache_set *c) |
| 1792 | { | 1794 | { |
| 1793 | c->gc_thread = kthread_create(bch_gc_thread, c, "bcache_gc"); | 1795 | c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc"); |
| 1794 | if (IS_ERR(c->gc_thread)) | 1796 | if (IS_ERR(c->gc_thread)) |
| 1795 | return PTR_ERR(c->gc_thread); | 1797 | return PTR_ERR(c->gc_thread); |
| 1796 | 1798 | ||
| 1797 | set_task_state(c->gc_thread, TASK_INTERRUPTIBLE); | ||
| 1798 | return 0; | 1799 | return 0; |
| 1799 | } | 1800 | } |
| 1800 | 1801 | ||
diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 5c391fa01bed..9b80417cd547 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h | |||
| @@ -260,8 +260,7 @@ void bch_initial_mark_key(struct cache_set *, int, struct bkey *); | |||
| 260 | 260 | ||
| 261 | static inline void wake_up_gc(struct cache_set *c) | 261 | static inline void wake_up_gc(struct cache_set *c) |
| 262 | { | 262 | { |
| 263 | if (c->gc_thread) | 263 | wake_up(&c->gc_wait); |
| 264 | wake_up_process(c->gc_thread); | ||
| 265 | } | 264 | } |
| 266 | 265 | ||
| 267 | #define MAP_DONE 0 | 266 | #define MAP_DONE 0 |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index f49c5417527d..76d20875503c 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
| @@ -196,10 +196,8 @@ static void bch_data_insert_start(struct closure *cl) | |||
| 196 | struct data_insert_op *op = container_of(cl, struct data_insert_op, cl); | 196 | struct data_insert_op *op = container_of(cl, struct data_insert_op, cl); |
| 197 | struct bio *bio = op->bio, *n; | 197 | struct bio *bio = op->bio, *n; |
| 198 | 198 | ||
| 199 | if (atomic_sub_return(bio_sectors(bio), &op->c->sectors_to_gc) < 0) { | 199 | if (atomic_sub_return(bio_sectors(bio), &op->c->sectors_to_gc) < 0) |
| 200 | set_gc_sectors(op->c); | ||
| 201 | wake_up_gc(op->c); | 200 | wake_up_gc(op->c); |
| 202 | } | ||
| 203 | 201 | ||
| 204 | if (op->bypass) | 202 | if (op->bypass) |
| 205 | return bch_data_invalidate(cl); | 203 | return bch_data_invalidate(cl); |
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 2fb5bfeb43e2..3a19cbc8b230 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
| @@ -58,6 +58,7 @@ static wait_queue_head_t unregister_wait; | |||
| 58 | struct workqueue_struct *bcache_wq; | 58 | struct workqueue_struct *bcache_wq; |
| 59 | 59 | ||
| 60 | #define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE) | 60 | #define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE) |
| 61 | #define BCACHE_MINORS 16 /* partition support */ | ||
| 61 | 62 | ||
| 62 | /* Superblock */ | 63 | /* Superblock */ |
| 63 | 64 | ||
| @@ -783,8 +784,10 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, | |||
| 783 | if (minor < 0) | 784 | if (minor < 0) |
| 784 | return minor; | 785 | return minor; |
| 785 | 786 | ||
| 787 | minor *= BCACHE_MINORS; | ||
| 788 | |||
| 786 | if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || | 789 | if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || |
| 787 | !(d->disk = alloc_disk(1))) { | 790 | !(d->disk = alloc_disk(BCACHE_MINORS))) { |
| 788 | ida_simple_remove(&bcache_minor, minor); | 791 | ida_simple_remove(&bcache_minor, minor); |
| 789 | return -ENOMEM; | 792 | return -ENOMEM; |
| 790 | } | 793 | } |
| @@ -1489,6 +1492,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) | |||
| 1489 | mutex_init(&c->bucket_lock); | 1492 | mutex_init(&c->bucket_lock); |
| 1490 | init_waitqueue_head(&c->btree_cache_wait); | 1493 | init_waitqueue_head(&c->btree_cache_wait); |
| 1491 | init_waitqueue_head(&c->bucket_wait); | 1494 | init_waitqueue_head(&c->bucket_wait); |
| 1495 | init_waitqueue_head(&c->gc_wait); | ||
| 1492 | sema_init(&c->uuid_write_mutex, 1); | 1496 | sema_init(&c->uuid_write_mutex, 1); |
| 1493 | 1497 | ||
| 1494 | spin_lock_init(&c->btree_gc_time.lock); | 1498 | spin_lock_init(&c->btree_gc_time.lock); |
| @@ -1548,6 +1552,7 @@ static void run_cache_set(struct cache_set *c) | |||
| 1548 | 1552 | ||
| 1549 | for_each_cache(ca, c, i) | 1553 | for_each_cache(ca, c, i) |
| 1550 | c->nbuckets += ca->sb.nbuckets; | 1554 | c->nbuckets += ca->sb.nbuckets; |
| 1555 | set_gc_sectors(c); | ||
| 1551 | 1556 | ||
| 1552 | if (CACHE_SYNC(&c->sb)) { | 1557 | if (CACHE_SYNC(&c->sb)) { |
| 1553 | LIST_HEAD(journal); | 1558 | LIST_HEAD(journal); |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 2fd7dc2e8fc4..3d21a154dce7 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | #define NVME_AQ_DEPTH 256 | 50 | #define NVME_AQ_DEPTH 256 |
| 51 | #define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) | 51 | #define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) |
| 52 | #define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) | 52 | #define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * We handle AEN commands ourselves and don't even let the | 55 | * We handle AEN commands ourselves and don't even let the |
| 56 | * block layer know about them. | 56 | * block layer know about them. |
| @@ -1349,7 +1349,7 @@ static ssize_t nvme_cmb_show(struct device *dev, | |||
| 1349 | { | 1349 | { |
| 1350 | struct nvme_dev *ndev = to_nvme_dev(dev_get_drvdata(dev)); | 1350 | struct nvme_dev *ndev = to_nvme_dev(dev_get_drvdata(dev)); |
| 1351 | 1351 | ||
| 1352 | return snprintf(buf, PAGE_SIZE, "cmbloc : x%08x\ncmbsz : x%08x\n", | 1352 | return scnprintf(buf, PAGE_SIZE, "cmbloc : x%08x\ncmbsz : x%08x\n", |
| 1353 | ndev->cmbloc, ndev->cmbsz); | 1353 | ndev->cmbloc, ndev->cmbsz); |
| 1354 | } | 1354 | } |
| 1355 | static DEVICE_ATTR(cmb, S_IRUGO, nvme_cmb_show, NULL); | 1355 | static DEVICE_ATTR(cmb, S_IRUGO, nvme_cmb_show, NULL); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 286b2a264383..83695641bd5e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -288,7 +288,6 @@ enum blk_queue_state { | |||
| 288 | struct blk_queue_tag { | 288 | struct blk_queue_tag { |
| 289 | struct request **tag_index; /* map of busy tags */ | 289 | struct request **tag_index; /* map of busy tags */ |
| 290 | unsigned long *tag_map; /* bit map of free/busy tags */ | 290 | unsigned long *tag_map; /* bit map of free/busy tags */ |
| 291 | int busy; /* current depth */ | ||
| 292 | int max_depth; /* what we will send to device */ | 291 | int max_depth; /* what we will send to device */ |
| 293 | int real_max_depth; /* what the array can hold */ | 292 | int real_max_depth; /* what the array can hold */ |
| 294 | atomic_t refcnt; /* map can be shared */ | 293 | atomic_t refcnt; /* map can be shared */ |
