diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 18:32:19 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 18:32:19 -0500 |
| commit | e2c5923c349c1738fe8fda980874d93f6fb2e5b6 (patch) | |
| tree | b97a90170c45211bcc437761653aa8016c34afcd /include/linux | |
| parent | abc36be236358162202e86ad88616ff95a755101 (diff) | |
| parent | a04b5de5050ab8b891128eb2c47a0916fe8622e1 (diff) | |
Merge branch 'for-4.15/block' of git://git.kernel.dk/linux-block
Pull core block layer updates from Jens Axboe:
"This is the main pull request for block storage for 4.15-rc1.
Nothing out of the ordinary in here, and no API changes or anything
like that. Just various new features for drivers, core changes, etc.
In particular, this pull request contains:
- A patch series from Bart, closing the whole on blk/scsi-mq queue
quescing.
- A series from Christoph, building towards hidden gendisks (for
multipath) and ability to move bio chains around.
- NVMe
- Support for native multipath for NVMe (Christoph).
- Userspace notifications for AENs (Keith).
- Command side-effects support (Keith).
- SGL support (Chaitanya Kulkarni)
- FC fixes and improvements (James Smart)
- Lots of fixes and tweaks (Various)
- bcache
- New maintainer (Michael Lyle)
- Writeback control improvements (Michael)
- Various fixes (Coly, Elena, Eric, Liang, et al)
- lightnvm updates, mostly centered around the pblk interface
(Javier, Hans, and Rakesh).
- Removal of unused bio/bvec kmap atomic interfaces (me, Christoph)
- Writeback series that fix the much discussed hundreds of millions
of sync-all units. This goes all the way, as discussed previously
(me).
- Fix for missing wakeup on writeback timer adjustments (Yafang
Shao).
- Fix laptop mode on blk-mq (me).
- {mq,name} tupple lookup for IO schedulers, allowing us to have
alias names. This means you can use 'deadline' on both !mq and on
mq (where it's called mq-deadline). (me).
- blktrace race fix, oopsing on sg load (me).
- blk-mq optimizations (me).
- Obscure waitqueue race fix for kyber (Omar).
- NBD fixes (Josef).
- Disable writeback throttling by default on bfq, like we do on cfq
(Luca Miccio).
- Series from Ming that enable us to treat flush requests on blk-mq
like any other request. This is a really nice cleanup.
- Series from Ming that improves merging on blk-mq with schedulers,
getting us closer to flipping the switch on scsi-mq again.
- BFQ updates (Paolo).
- blk-mq atomic flags memory ordering fixes (Peter Z).
- Loop cgroup support (Shaohua).
- Lots of minor fixes from lots of different folks, both for core and
driver code"
* 'for-4.15/block' of git://git.kernel.dk/linux-block: (294 commits)
nvme: fix visibility of "uuid" ns attribute
blk-mq: fixup some comment typos and lengths
ide: ide-atapi: fix compile error with defining macro DEBUG
blk-mq: improve tag waiting setup for non-shared tags
brd: remove unused brd_mutex
blk-mq: only run the hardware queue if IO is pending
block: avoid null pointer dereference on null disk
fs: guard_bio_eod() needs to consider partitions
xtensa/simdisk: fix compile error
nvme: expose subsys attribute to sysfs
nvme: create 'slaves' and 'holders' entries for hidden controllers
block: create 'slaves' and 'holders' entries for hidden gendisks
nvme: also expose the namespace identification sysfs files for mpath nodes
nvme: implement multipath access to nvme subsystems
nvme: track shared namespaces
nvme: introduce a nvme_ns_ids structure
nvme: track subsystems
block, nvme: Introduce blk_mq_req_flags_t
block, scsi: Make SCSI quiesce and resume work reliably
block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/backing-dev-defs.h | 24 | ||||
| -rw-r--r-- | include/linux/backing-dev.h | 4 | ||||
| -rw-r--r-- | include/linux/bio.h | 25 | ||||
| -rw-r--r-- | include/linux/blk-cgroup.h | 25 | ||||
| -rw-r--r-- | include/linux/blk-mq.h | 40 | ||||
| -rw-r--r-- | include/linux/blk_types.h | 16 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 36 | ||||
| -rw-r--r-- | include/linux/buffer_head.h | 2 | ||||
| -rw-r--r-- | include/linux/elevator.h | 1 | ||||
| -rw-r--r-- | include/linux/genhd.h | 4 | ||||
| -rw-r--r-- | include/linux/kthread.h | 11 | ||||
| -rw-r--r-- | include/linux/lightnvm.h | 11 | ||||
| -rw-r--r-- | include/linux/nvme-fc-driver.h | 15 | ||||
| -rw-r--r-- | include/linux/nvme.h | 30 | ||||
| -rw-r--r-- | include/linux/sbitmap.h | 64 | ||||
| -rw-r--r-- | include/linux/writeback.h | 30 |
16 files changed, 200 insertions, 138 deletions
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index fff4cfa0c21d..bfe86b54f6c1 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h | |||
| @@ -25,6 +25,7 @@ enum wb_state { | |||
| 25 | WB_shutting_down, /* wb_shutdown() in progress */ | 25 | WB_shutting_down, /* wb_shutdown() in progress */ |
| 26 | WB_writeback_running, /* Writeback is in progress */ | 26 | WB_writeback_running, /* Writeback is in progress */ |
| 27 | WB_has_dirty_io, /* Dirty inodes on ->b_{dirty|io|more_io} */ | 27 | WB_has_dirty_io, /* Dirty inodes on ->b_{dirty|io|more_io} */ |
| 28 | WB_start_all, /* nr_pages == 0 (all) work pending */ | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | enum wb_congested_state { | 31 | enum wb_congested_state { |
| @@ -45,6 +46,28 @@ enum wb_stat_item { | |||
| 45 | #define WB_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) | 46 | #define WB_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) |
| 46 | 47 | ||
| 47 | /* | 48 | /* |
| 49 | * why some writeback work was initiated | ||
| 50 | */ | ||
| 51 | enum wb_reason { | ||
| 52 | WB_REASON_BACKGROUND, | ||
| 53 | WB_REASON_VMSCAN, | ||
| 54 | WB_REASON_SYNC, | ||
| 55 | WB_REASON_PERIODIC, | ||
| 56 | WB_REASON_LAPTOP_TIMER, | ||
| 57 | WB_REASON_FREE_MORE_MEM, | ||
| 58 | WB_REASON_FS_FREE_SPACE, | ||
| 59 | /* | ||
| 60 | * There is no bdi forker thread any more and works are done | ||
| 61 | * by emergency worker, however, this is TPs userland visible | ||
| 62 | * and we'll be exposing exactly the same information, | ||
| 63 | * so it has a mismatch name. | ||
| 64 | */ | ||
| 65 | WB_REASON_FORKER_THREAD, | ||
| 66 | |||
| 67 | WB_REASON_MAX, | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* | ||
| 48 | * For cgroup writeback, multiple wb's may map to the same blkcg. Those | 71 | * For cgroup writeback, multiple wb's may map to the same blkcg. Those |
| 49 | * wb's can operate mostly independently but should share the congested | 72 | * wb's can operate mostly independently but should share the congested |
| 50 | * state. To facilitate such sharing, the congested state is tracked using | 73 | * state. To facilitate such sharing, the congested state is tracked using |
| @@ -116,6 +139,7 @@ struct bdi_writeback { | |||
| 116 | 139 | ||
| 117 | struct fprop_local_percpu completions; | 140 | struct fprop_local_percpu completions; |
| 118 | int dirty_exceeded; | 141 | int dirty_exceeded; |
| 142 | enum wb_reason start_all_reason; | ||
| 119 | 143 | ||
| 120 | spinlock_t work_lock; /* protects work_list & dwork scheduling */ | 144 | spinlock_t work_lock; /* protects work_list & dwork scheduling */ |
| 121 | struct list_head work_list; | 145 | struct list_head work_list; |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 16621579a3db..f41ca8486e02 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -39,8 +39,6 @@ static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask) | |||
| 39 | return bdi_alloc_node(gfp_mask, NUMA_NO_NODE); | 39 | return bdi_alloc_node(gfp_mask, NUMA_NO_NODE); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, | ||
| 43 | bool range_cyclic, enum wb_reason reason); | ||
| 44 | void wb_start_background_writeback(struct bdi_writeback *wb); | 42 | void wb_start_background_writeback(struct bdi_writeback *wb); |
| 45 | void wb_workfn(struct work_struct *work); | 43 | void wb_workfn(struct work_struct *work); |
| 46 | void wb_wakeup_delayed(struct bdi_writeback *wb); | 44 | void wb_wakeup_delayed(struct bdi_writeback *wb); |
| @@ -175,8 +173,6 @@ static inline int wb_congested(struct bdi_writeback *wb, int cong_bits) | |||
| 175 | 173 | ||
| 176 | long congestion_wait(int sync, long timeout); | 174 | long congestion_wait(int sync, long timeout); |
| 177 | long wait_iff_congested(struct pglist_data *pgdat, int sync, long timeout); | 175 | long wait_iff_congested(struct pglist_data *pgdat, int sync, long timeout); |
| 178 | int pdflush_proc_obsolete(struct ctl_table *table, int write, | ||
| 179 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 180 | 176 | ||
| 181 | static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi) | 177 | static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi) |
| 182 | { | 178 | { |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 275c91c99516..d4eec19a6d3c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -129,18 +129,6 @@ static inline void *bio_data(struct bio *bio) | |||
| 129 | #define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset) | 129 | #define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset) |
| 130 | 130 | ||
| 131 | /* | 131 | /* |
| 132 | * queues that have highmem support enabled may still need to revert to | ||
| 133 | * PIO transfers occasionally and thus map high pages temporarily. For | ||
| 134 | * permanent PIO fall back, user is probably better off disabling highmem | ||
| 135 | * I/O completely on that queue (see ide-dma for example) | ||
| 136 | */ | ||
| 137 | #define __bio_kmap_atomic(bio, iter) \ | ||
| 138 | (kmap_atomic(bio_iter_iovec((bio), (iter)).bv_page) + \ | ||
| 139 | bio_iter_iovec((bio), (iter)).bv_offset) | ||
| 140 | |||
| 141 | #define __bio_kunmap_atomic(addr) kunmap_atomic(addr) | ||
| 142 | |||
| 143 | /* | ||
| 144 | * merge helpers etc | 132 | * merge helpers etc |
| 145 | */ | 133 | */ |
| 146 | 134 | ||
| @@ -522,13 +510,11 @@ do { \ | |||
| 522 | 510 | ||
| 523 | #ifdef CONFIG_BLK_CGROUP | 511 | #ifdef CONFIG_BLK_CGROUP |
| 524 | int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); | 512 | int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); |
| 525 | int bio_associate_current(struct bio *bio); | ||
| 526 | void bio_disassociate_task(struct bio *bio); | 513 | void bio_disassociate_task(struct bio *bio); |
| 527 | void bio_clone_blkcg_association(struct bio *dst, struct bio *src); | 514 | void bio_clone_blkcg_association(struct bio *dst, struct bio *src); |
| 528 | #else /* CONFIG_BLK_CGROUP */ | 515 | #else /* CONFIG_BLK_CGROUP */ |
| 529 | static inline int bio_associate_blkcg(struct bio *bio, | 516 | static inline int bio_associate_blkcg(struct bio *bio, |
| 530 | struct cgroup_subsys_state *blkcg_css) { return 0; } | 517 | struct cgroup_subsys_state *blkcg_css) { return 0; } |
| 531 | static inline int bio_associate_current(struct bio *bio) { return -ENOENT; } | ||
| 532 | static inline void bio_disassociate_task(struct bio *bio) { } | 518 | static inline void bio_disassociate_task(struct bio *bio) { } |
| 533 | static inline void bio_clone_blkcg_association(struct bio *dst, | 519 | static inline void bio_clone_blkcg_association(struct bio *dst, |
| 534 | struct bio *src) { } | 520 | struct bio *src) { } |
| @@ -575,17 +561,6 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
| 575 | } | 561 | } |
| 576 | #endif | 562 | #endif |
| 577 | 563 | ||
| 578 | static inline char *__bio_kmap_irq(struct bio *bio, struct bvec_iter iter, | ||
| 579 | unsigned long *flags) | ||
| 580 | { | ||
| 581 | return bvec_kmap_irq(&bio_iter_iovec(bio, iter), flags); | ||
| 582 | } | ||
| 583 | #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) | ||
| 584 | |||
| 585 | #define bio_kmap_irq(bio, flags) \ | ||
| 586 | __bio_kmap_irq((bio), (bio)->bi_iter, (flags)) | ||
| 587 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) | ||
| 588 | |||
| 589 | /* | 564 | /* |
| 590 | * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. | 565 | * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. |
| 591 | * | 566 | * |
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 8bbc3716507a..e9825ff57b15 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/radix-tree.h> | 20 | #include <linux/radix-tree.h> |
| 21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
| 22 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
| 23 | #include <linux/kthread.h> | ||
| 23 | 24 | ||
| 24 | /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ | 25 | /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ |
| 25 | #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) | 26 | #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) |
| @@ -224,22 +225,16 @@ static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css) | |||
| 224 | return css ? container_of(css, struct blkcg, css) : NULL; | 225 | return css ? container_of(css, struct blkcg, css) : NULL; |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 227 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) | ||
| 228 | { | ||
| 229 | return css_to_blkcg(task_css(tsk, io_cgrp_id)); | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline struct blkcg *bio_blkcg(struct bio *bio) | 228 | static inline struct blkcg *bio_blkcg(struct bio *bio) |
| 233 | { | 229 | { |
| 230 | struct cgroup_subsys_state *css; | ||
| 231 | |||
| 234 | if (bio && bio->bi_css) | 232 | if (bio && bio->bi_css) |
| 235 | return css_to_blkcg(bio->bi_css); | 233 | return css_to_blkcg(bio->bi_css); |
| 236 | return task_blkcg(current); | 234 | css = kthread_blkcg(); |
| 237 | } | 235 | if (css) |
| 238 | 236 | return css_to_blkcg(css); | |
| 239 | static inline struct cgroup_subsys_state * | 237 | return css_to_blkcg(task_css(current, io_cgrp_id)); |
| 240 | task_get_blkcg_css(struct task_struct *task) | ||
| 241 | { | ||
| 242 | return task_get_css(task, io_cgrp_id); | ||
| 243 | } | 238 | } |
| 244 | 239 | ||
| 245 | /** | 240 | /** |
| @@ -736,12 +731,6 @@ struct blkcg_policy { | |||
| 736 | 731 | ||
| 737 | #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) | 732 | #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) |
| 738 | 733 | ||
| 739 | static inline struct cgroup_subsys_state * | ||
| 740 | task_get_blkcg_css(struct task_struct *task) | ||
| 741 | { | ||
| 742 | return NULL; | ||
| 743 | } | ||
| 744 | |||
| 745 | #ifdef CONFIG_BLOCK | 734 | #ifdef CONFIG_BLOCK |
| 746 | 735 | ||
| 747 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } | 736 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 994cbb0f7ffc..95c9a5c862e2 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
| @@ -31,10 +31,12 @@ struct blk_mq_hw_ctx { | |||
| 31 | 31 | ||
| 32 | struct sbitmap ctx_map; | 32 | struct sbitmap ctx_map; |
| 33 | 33 | ||
| 34 | struct blk_mq_ctx *dispatch_from; | ||
| 35 | |||
| 34 | struct blk_mq_ctx **ctxs; | 36 | struct blk_mq_ctx **ctxs; |
| 35 | unsigned int nr_ctx; | 37 | unsigned int nr_ctx; |
| 36 | 38 | ||
| 37 | wait_queue_entry_t dispatch_wait; | 39 | wait_queue_entry_t dispatch_wait; |
| 38 | atomic_t wait_index; | 40 | atomic_t wait_index; |
| 39 | 41 | ||
| 40 | struct blk_mq_tags *tags; | 42 | struct blk_mq_tags *tags; |
| @@ -91,6 +93,8 @@ struct blk_mq_queue_data { | |||
| 91 | 93 | ||
| 92 | typedef blk_status_t (queue_rq_fn)(struct blk_mq_hw_ctx *, | 94 | typedef blk_status_t (queue_rq_fn)(struct blk_mq_hw_ctx *, |
| 93 | const struct blk_mq_queue_data *); | 95 | const struct blk_mq_queue_data *); |
| 96 | typedef bool (get_budget_fn)(struct blk_mq_hw_ctx *); | ||
| 97 | typedef void (put_budget_fn)(struct blk_mq_hw_ctx *); | ||
| 94 | typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool); | 98 | typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool); |
| 95 | typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); | 99 | typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); |
| 96 | typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); | 100 | typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); |
| @@ -113,6 +117,15 @@ struct blk_mq_ops { | |||
| 113 | queue_rq_fn *queue_rq; | 117 | queue_rq_fn *queue_rq; |
| 114 | 118 | ||
| 115 | /* | 119 | /* |
| 120 | * Reserve budget before queue request, once .queue_rq is | ||
| 121 | * run, it is driver's responsibility to release the | ||
| 122 | * reserved budget. Also we have to handle failure case | ||
| 123 | * of .get_budget for avoiding I/O deadlock. | ||
| 124 | */ | ||
| 125 | get_budget_fn *get_budget; | ||
| 126 | put_budget_fn *put_budget; | ||
| 127 | |||
| 128 | /* | ||
| 116 | * Called on request timeout | 129 | * Called on request timeout |
| 117 | */ | 130 | */ |
| 118 | timeout_fn *timeout; | 131 | timeout_fn *timeout; |
| @@ -169,8 +182,7 @@ enum { | |||
| 169 | BLK_MQ_S_STOPPED = 0, | 182 | BLK_MQ_S_STOPPED = 0, |
| 170 | BLK_MQ_S_TAG_ACTIVE = 1, | 183 | BLK_MQ_S_TAG_ACTIVE = 1, |
| 171 | BLK_MQ_S_SCHED_RESTART = 2, | 184 | BLK_MQ_S_SCHED_RESTART = 2, |
| 172 | BLK_MQ_S_TAG_WAITING = 3, | 185 | BLK_MQ_S_START_ON_RUN = 3, |
| 173 | BLK_MQ_S_START_ON_RUN = 4, | ||
| 174 | 186 | ||
| 175 | BLK_MQ_MAX_DEPTH = 10240, | 187 | BLK_MQ_MAX_DEPTH = 10240, |
| 176 | 188 | ||
| @@ -198,15 +210,21 @@ void blk_mq_free_request(struct request *rq); | |||
| 198 | bool blk_mq_can_queue(struct blk_mq_hw_ctx *); | 210 | bool blk_mq_can_queue(struct blk_mq_hw_ctx *); |
| 199 | 211 | ||
| 200 | enum { | 212 | enum { |
| 201 | BLK_MQ_REQ_NOWAIT = (1 << 0), /* return when out of requests */ | 213 | /* return when out of requests */ |
| 202 | BLK_MQ_REQ_RESERVED = (1 << 1), /* allocate from reserved pool */ | 214 | BLK_MQ_REQ_NOWAIT = (__force blk_mq_req_flags_t)(1 << 0), |
| 203 | BLK_MQ_REQ_INTERNAL = (1 << 2), /* allocate internal/sched tag */ | 215 | /* allocate from reserved pool */ |
| 216 | BLK_MQ_REQ_RESERVED = (__force blk_mq_req_flags_t)(1 << 1), | ||
| 217 | /* allocate internal/sched tag */ | ||
| 218 | BLK_MQ_REQ_INTERNAL = (__force blk_mq_req_flags_t)(1 << 2), | ||
| 219 | /* set RQF_PREEMPT */ | ||
| 220 | BLK_MQ_REQ_PREEMPT = (__force blk_mq_req_flags_t)(1 << 3), | ||
| 204 | }; | 221 | }; |
| 205 | 222 | ||
| 206 | struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, | 223 | struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, |
| 207 | unsigned int flags); | 224 | blk_mq_req_flags_t flags); |
| 208 | struct request *blk_mq_alloc_request_hctx(struct request_queue *q, | 225 | struct request *blk_mq_alloc_request_hctx(struct request_queue *q, |
| 209 | unsigned int op, unsigned int flags, unsigned int hctx_idx); | 226 | unsigned int op, blk_mq_req_flags_t flags, |
| 227 | unsigned int hctx_idx); | ||
| 210 | struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag); | 228 | struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag); |
| 211 | 229 | ||
| 212 | enum { | 230 | enum { |
| @@ -249,7 +267,7 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); | |||
| 249 | void blk_mq_quiesce_queue(struct request_queue *q); | 267 | void blk_mq_quiesce_queue(struct request_queue *q); |
| 250 | void blk_mq_unquiesce_queue(struct request_queue *q); | 268 | void blk_mq_unquiesce_queue(struct request_queue *q); |
| 251 | void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); | 269 | void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); |
| 252 | void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); | 270 | bool blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); |
| 253 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); | 271 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); |
| 254 | void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); | 272 | void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); |
| 255 | void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, | 273 | void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, |
| @@ -260,8 +278,8 @@ void blk_freeze_queue_start(struct request_queue *q); | |||
| 260 | void blk_mq_freeze_queue_wait(struct request_queue *q); | 278 | void blk_mq_freeze_queue_wait(struct request_queue *q); |
| 261 | int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, | 279 | int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, |
| 262 | unsigned long timeout); | 280 | unsigned long timeout); |
| 263 | int blk_mq_reinit_tagset(struct blk_mq_tag_set *set, | 281 | int blk_mq_tagset_iter(struct blk_mq_tag_set *set, void *data, |
| 264 | int (reinit_request)(void *, struct request *)); | 282 | int (reinit_request)(void *, struct request *)); |
| 265 | 283 | ||
| 266 | int blk_mq_map_queues(struct blk_mq_tag_set *set); | 284 | int blk_mq_map_queues(struct blk_mq_tag_set *set); |
| 267 | void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); | 285 | void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 96ac3815542c..a1e628e032da 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -163,6 +163,8 @@ struct bio { | |||
| 163 | */ | 163 | */ |
| 164 | #define BIO_RESET_BITS BVEC_POOL_OFFSET | 164 | #define BIO_RESET_BITS BVEC_POOL_OFFSET |
| 165 | 165 | ||
| 166 | typedef __u32 __bitwise blk_mq_req_flags_t; | ||
| 167 | |||
| 166 | /* | 168 | /* |
| 167 | * Operations and flags common to the bio and request structures. | 169 | * Operations and flags common to the bio and request structures. |
| 168 | * We use 8 bits for encoding the operation, and the remaining 24 for flags. | 170 | * We use 8 bits for encoding the operation, and the remaining 24 for flags. |
| @@ -225,11 +227,14 @@ enum req_flag_bits { | |||
| 225 | __REQ_PREFLUSH, /* request for cache flush */ | 227 | __REQ_PREFLUSH, /* request for cache flush */ |
| 226 | __REQ_RAHEAD, /* read ahead, can fail anytime */ | 228 | __REQ_RAHEAD, /* read ahead, can fail anytime */ |
| 227 | __REQ_BACKGROUND, /* background IO */ | 229 | __REQ_BACKGROUND, /* background IO */ |
| 230 | __REQ_NOWAIT, /* Don't wait if request will block */ | ||
| 228 | 231 | ||
| 229 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ | 232 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ |
| 230 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ | 233 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ |
| 231 | 234 | ||
| 232 | __REQ_NOWAIT, /* Don't wait if request will block */ | 235 | /* for driver use */ |
| 236 | __REQ_DRV, | ||
| 237 | |||
| 233 | __REQ_NR_BITS, /* stops here */ | 238 | __REQ_NR_BITS, /* stops here */ |
| 234 | }; | 239 | }; |
| 235 | 240 | ||
| @@ -246,9 +251,11 @@ enum req_flag_bits { | |||
| 246 | #define REQ_PREFLUSH (1ULL << __REQ_PREFLUSH) | 251 | #define REQ_PREFLUSH (1ULL << __REQ_PREFLUSH) |
| 247 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) | 252 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) |
| 248 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) | 253 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) |
| 254 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) | ||
| 249 | 255 | ||
| 250 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) | 256 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) |
| 251 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) | 257 | |
| 258 | #define REQ_DRV (1ULL << __REQ_DRV) | ||
| 252 | 259 | ||
| 253 | #define REQ_FAILFAST_MASK \ | 260 | #define REQ_FAILFAST_MASK \ |
| 254 | (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) | 261 | (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) |
| @@ -330,11 +337,10 @@ static inline bool blk_qc_t_is_internal(blk_qc_t cookie) | |||
| 330 | } | 337 | } |
| 331 | 338 | ||
| 332 | struct blk_rq_stat { | 339 | struct blk_rq_stat { |
| 333 | s64 mean; | 340 | u64 mean; |
| 334 | u64 min; | 341 | u64 min; |
| 335 | u64 max; | 342 | u64 max; |
| 336 | s32 nr_samples; | 343 | u32 nr_samples; |
| 337 | s32 nr_batch; | ||
| 338 | u64 batch; | 344 | u64 batch; |
| 339 | }; | 345 | }; |
| 340 | 346 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8da66379f7ea..8089ca17db9a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -267,6 +267,7 @@ struct blk_queue_ctx; | |||
| 267 | 267 | ||
| 268 | typedef void (request_fn_proc) (struct request_queue *q); | 268 | typedef void (request_fn_proc) (struct request_queue *q); |
| 269 | typedef blk_qc_t (make_request_fn) (struct request_queue *q, struct bio *bio); | 269 | typedef blk_qc_t (make_request_fn) (struct request_queue *q, struct bio *bio); |
| 270 | typedef bool (poll_q_fn) (struct request_queue *q, blk_qc_t); | ||
| 270 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 271 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
| 271 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); | 272 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); |
| 272 | 273 | ||
| @@ -409,6 +410,7 @@ struct request_queue { | |||
| 409 | 410 | ||
| 410 | request_fn_proc *request_fn; | 411 | request_fn_proc *request_fn; |
| 411 | make_request_fn *make_request_fn; | 412 | make_request_fn *make_request_fn; |
| 413 | poll_q_fn *poll_fn; | ||
| 412 | prep_rq_fn *prep_rq_fn; | 414 | prep_rq_fn *prep_rq_fn; |
| 413 | unprep_rq_fn *unprep_rq_fn; | 415 | unprep_rq_fn *unprep_rq_fn; |
| 414 | softirq_done_fn *softirq_done_fn; | 416 | softirq_done_fn *softirq_done_fn; |
| @@ -610,7 +612,6 @@ struct request_queue { | |||
| 610 | #define QUEUE_FLAG_NOMERGES 5 /* disable merge attempts */ | 612 | #define QUEUE_FLAG_NOMERGES 5 /* disable merge attempts */ |
| 611 | #define QUEUE_FLAG_SAME_COMP 6 /* complete on same CPU-group */ | 613 | #define QUEUE_FLAG_SAME_COMP 6 /* complete on same CPU-group */ |
| 612 | #define QUEUE_FLAG_FAIL_IO 7 /* fake timeout */ | 614 | #define QUEUE_FLAG_FAIL_IO 7 /* fake timeout */ |
| 613 | #define QUEUE_FLAG_STACKABLE 8 /* supports request stacking */ | ||
| 614 | #define QUEUE_FLAG_NONROT 9 /* non-rotational device (SSD) */ | 615 | #define QUEUE_FLAG_NONROT 9 /* non-rotational device (SSD) */ |
| 615 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 616 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
| 616 | #define QUEUE_FLAG_IO_STAT 10 /* do IO stats */ | 617 | #define QUEUE_FLAG_IO_STAT 10 /* do IO stats */ |
| @@ -632,14 +633,13 @@ struct request_queue { | |||
| 632 | #define QUEUE_FLAG_REGISTERED 26 /* queue has been registered to a disk */ | 633 | #define QUEUE_FLAG_REGISTERED 26 /* queue has been registered to a disk */ |
| 633 | #define QUEUE_FLAG_SCSI_PASSTHROUGH 27 /* queue supports SCSI commands */ | 634 | #define QUEUE_FLAG_SCSI_PASSTHROUGH 27 /* queue supports SCSI commands */ |
| 634 | #define QUEUE_FLAG_QUIESCED 28 /* queue has been quiesced */ | 635 | #define QUEUE_FLAG_QUIESCED 28 /* queue has been quiesced */ |
| 636 | #define QUEUE_FLAG_PREEMPT_ONLY 29 /* only process REQ_PREEMPT requests */ | ||
| 635 | 637 | ||
| 636 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 638 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 637 | (1 << QUEUE_FLAG_STACKABLE) | \ | ||
| 638 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 639 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
| 639 | (1 << QUEUE_FLAG_ADD_RANDOM)) | 640 | (1 << QUEUE_FLAG_ADD_RANDOM)) |
| 640 | 641 | ||
| 641 | #define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 642 | #define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 642 | (1 << QUEUE_FLAG_STACKABLE) | \ | ||
| 643 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 643 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
| 644 | (1 << QUEUE_FLAG_POLL)) | 644 | (1 << QUEUE_FLAG_POLL)) |
| 645 | 645 | ||
| @@ -723,8 +723,6 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
| 723 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | 723 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |
| 724 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) | 724 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) |
| 725 | #define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) | 725 | #define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) |
| 726 | #define blk_queue_stackable(q) \ | ||
| 727 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | ||
| 728 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) | 726 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) |
| 729 | #define blk_queue_secure_erase(q) \ | 727 | #define blk_queue_secure_erase(q) \ |
| 730 | (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags)) | 728 | (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags)) |
| @@ -736,6 +734,11 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
| 736 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ | 734 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ |
| 737 | REQ_FAILFAST_DRIVER)) | 735 | REQ_FAILFAST_DRIVER)) |
| 738 | #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) | 736 | #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) |
| 737 | #define blk_queue_preempt_only(q) \ | ||
| 738 | test_bit(QUEUE_FLAG_PREEMPT_ONLY, &(q)->queue_flags) | ||
| 739 | |||
| 740 | extern int blk_set_preempt_only(struct request_queue *q); | ||
| 741 | extern void blk_clear_preempt_only(struct request_queue *q); | ||
| 739 | 742 | ||
| 740 | static inline bool blk_account_rq(struct request *rq) | 743 | static inline bool blk_account_rq(struct request *rq) |
| 741 | { | 744 | { |
| @@ -923,24 +926,17 @@ static inline void rq_flush_dcache_pages(struct request *rq) | |||
| 923 | } | 926 | } |
| 924 | #endif | 927 | #endif |
| 925 | 928 | ||
| 926 | #ifdef CONFIG_PRINTK | ||
| 927 | #define vfs_msg(sb, level, fmt, ...) \ | ||
| 928 | __vfs_msg(sb, level, fmt, ##__VA_ARGS__) | ||
| 929 | #else | ||
| 930 | #define vfs_msg(sb, level, fmt, ...) \ | ||
| 931 | do { \ | ||
| 932 | no_printk(fmt, ##__VA_ARGS__); \ | ||
| 933 | __vfs_msg(sb, "", " "); \ | ||
| 934 | } while (0) | ||
| 935 | #endif | ||
| 936 | |||
| 937 | extern int blk_register_queue(struct gendisk *disk); | 929 | extern int blk_register_queue(struct gendisk *disk); |
| 938 | extern void blk_unregister_queue(struct gendisk *disk); | 930 | extern void blk_unregister_queue(struct gendisk *disk); |
| 939 | extern blk_qc_t generic_make_request(struct bio *bio); | 931 | extern blk_qc_t generic_make_request(struct bio *bio); |
| 932 | extern blk_qc_t direct_make_request(struct bio *bio); | ||
| 940 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | 933 | extern void blk_rq_init(struct request_queue *q, struct request *rq); |
| 941 | extern void blk_init_request_from_bio(struct request *req, struct bio *bio); | 934 | extern void blk_init_request_from_bio(struct request *req, struct bio *bio); |
| 942 | extern void blk_put_request(struct request *); | 935 | extern void blk_put_request(struct request *); |
| 943 | extern void __blk_put_request(struct request_queue *, struct request *); | 936 | extern void __blk_put_request(struct request_queue *, struct request *); |
| 937 | extern struct request *blk_get_request_flags(struct request_queue *, | ||
| 938 | unsigned int op, | ||
| 939 | blk_mq_req_flags_t flags); | ||
| 944 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, | 940 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, |
| 945 | gfp_t gfp_mask); | 941 | gfp_t gfp_mask); |
| 946 | extern void blk_requeue_request(struct request_queue *, struct request *); | 942 | extern void blk_requeue_request(struct request_queue *, struct request *); |
| @@ -964,7 +960,7 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
| 964 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | 960 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 965 | struct scsi_ioctl_command __user *); | 961 | struct scsi_ioctl_command __user *); |
| 966 | 962 | ||
| 967 | extern int blk_queue_enter(struct request_queue *q, bool nowait); | 963 | extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags); |
| 968 | extern void blk_queue_exit(struct request_queue *q); | 964 | extern void blk_queue_exit(struct request_queue *q); |
| 969 | extern void blk_start_queue(struct request_queue *q); | 965 | extern void blk_start_queue(struct request_queue *q); |
| 970 | extern void blk_start_queue_async(struct request_queue *q); | 966 | extern void blk_start_queue_async(struct request_queue *q); |
| @@ -991,7 +987,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | |||
| 991 | int blk_status_to_errno(blk_status_t status); | 987 | int blk_status_to_errno(blk_status_t status); |
| 992 | blk_status_t errno_to_blk_status(int errno); | 988 | blk_status_t errno_to_blk_status(int errno); |
| 993 | 989 | ||
| 994 | bool blk_mq_poll(struct request_queue *q, blk_qc_t cookie); | 990 | bool blk_poll(struct request_queue *q, blk_qc_t cookie); |
| 995 | 991 | ||
| 996 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | 992 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) |
| 997 | { | 993 | { |
| @@ -1110,6 +1106,8 @@ extern struct request *blk_peek_request(struct request_queue *q); | |||
| 1110 | extern void blk_start_request(struct request *rq); | 1106 | extern void blk_start_request(struct request *rq); |
| 1111 | extern struct request *blk_fetch_request(struct request_queue *q); | 1107 | extern struct request *blk_fetch_request(struct request_queue *q); |
| 1112 | 1108 | ||
| 1109 | void blk_steal_bios(struct bio_list *list, struct request *rq); | ||
| 1110 | |||
| 1113 | /* | 1111 | /* |
| 1114 | * Request completion related functions. | 1112 | * Request completion related functions. |
| 1115 | * | 1113 | * |
| @@ -1372,7 +1370,7 @@ static inline int sb_issue_zeroout(struct super_block *sb, sector_t block, | |||
| 1372 | gfp_mask, 0); | 1370 | gfp_mask, 0); |
| 1373 | } | 1371 | } |
| 1374 | 1372 | ||
| 1375 | extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); | 1373 | extern int blk_verify_command(unsigned char *cmd, fmode_t mode); |
| 1376 | 1374 | ||
| 1377 | enum blk_default_limits { | 1375 | enum blk_default_limits { |
| 1378 | BLK_MAX_SEGMENTS = 128, | 1376 | BLK_MAX_SEGMENTS = 128, |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index afa37f807f12..8b1bf8d3d4a2 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
| @@ -157,7 +157,7 @@ void set_bh_page(struct buffer_head *bh, | |||
| 157 | struct page *page, unsigned long offset); | 157 | struct page *page, unsigned long offset); |
| 158 | int try_to_free_buffers(struct page *); | 158 | int try_to_free_buffers(struct page *); |
| 159 | struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, | 159 | struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, |
| 160 | int retry); | 160 | bool retry); |
| 161 | void create_empty_buffers(struct page *, unsigned long, | 161 | void create_empty_buffers(struct page *, unsigned long, |
| 162 | unsigned long b_state); | 162 | unsigned long b_state); |
| 163 | void end_buffer_read_sync(struct buffer_head *bh, int uptodate); | 163 | void end_buffer_read_sync(struct buffer_head *bh, int uptodate); |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index ddb7632d73b9..3d794b3dc532 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
| @@ -145,6 +145,7 @@ struct elevator_type | |||
| 145 | size_t icq_align; /* ditto */ | 145 | size_t icq_align; /* ditto */ |
| 146 | struct elv_fs_entry *elevator_attrs; | 146 | struct elv_fs_entry *elevator_attrs; |
| 147 | char elevator_name[ELV_NAME_MAX]; | 147 | char elevator_name[ELV_NAME_MAX]; |
| 148 | const char *elevator_alias; | ||
| 148 | struct module *elevator_owner; | 149 | struct module *elevator_owner; |
| 149 | bool uses_mq; | 150 | bool uses_mq; |
| 150 | #ifdef CONFIG_BLK_DEBUG_FS | 151 | #ifdef CONFIG_BLK_DEBUG_FS |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index eaefb7a62f83..5144ebe046c9 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -141,6 +141,7 @@ struct hd_struct { | |||
| 141 | #define GENHD_FL_NATIVE_CAPACITY 128 | 141 | #define GENHD_FL_NATIVE_CAPACITY 128 |
| 142 | #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 | 142 | #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 |
| 143 | #define GENHD_FL_NO_PART_SCAN 512 | 143 | #define GENHD_FL_NO_PART_SCAN 512 |
| 144 | #define GENHD_FL_HIDDEN 1024 | ||
| 144 | 145 | ||
| 145 | enum { | 146 | enum { |
| 146 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ | 147 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ |
| @@ -236,7 +237,7 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk) | |||
| 236 | 237 | ||
| 237 | static inline dev_t disk_devt(struct gendisk *disk) | 238 | static inline dev_t disk_devt(struct gendisk *disk) |
| 238 | { | 239 | { |
| 239 | return disk_to_dev(disk)->devt; | 240 | return MKDEV(disk->major, disk->first_minor); |
| 240 | } | 241 | } |
| 241 | 242 | ||
| 242 | static inline dev_t part_devt(struct hd_struct *part) | 243 | static inline dev_t part_devt(struct hd_struct *part) |
| @@ -244,6 +245,7 @@ static inline dev_t part_devt(struct hd_struct *part) | |||
| 244 | return part_to_dev(part)->devt; | 245 | return part_to_dev(part)->devt; |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 248 | extern struct hd_struct *__disk_get_part(struct gendisk *disk, int partno); | ||
| 247 | extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno); | 249 | extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno); |
| 248 | 250 | ||
| 249 | static inline void disk_put_part(struct hd_struct *part) | 251 | static inline void disk_put_part(struct hd_struct *part) |
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 86d53a3cb497..3203e36b2ee8 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | /* Simple interface for creating and stopping kernel threads without mess. */ | 4 | /* Simple interface for creating and stopping kernel threads without mess. */ |
| 5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
| 6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
| 7 | #include <linux/cgroup.h> | ||
| 7 | 8 | ||
| 8 | __printf(4, 5) | 9 | __printf(4, 5) |
| 9 | struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), | 10 | struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), |
| @@ -199,4 +200,14 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); | |||
| 199 | 200 | ||
| 200 | void kthread_destroy_worker(struct kthread_worker *worker); | 201 | void kthread_destroy_worker(struct kthread_worker *worker); |
| 201 | 202 | ||
| 203 | #ifdef CONFIG_BLK_CGROUP | ||
| 204 | void kthread_associate_blkcg(struct cgroup_subsys_state *css); | ||
| 205 | struct cgroup_subsys_state *kthread_blkcg(void); | ||
| 206 | #else | ||
| 207 | static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } | ||
| 208 | static inline struct cgroup_subsys_state *kthread_blkcg(void) | ||
| 209 | { | ||
| 210 | return NULL; | ||
| 211 | } | ||
| 212 | #endif | ||
| 202 | #endif /* _LINUX_KTHREAD_H */ | 213 | #endif /* _LINUX_KTHREAD_H */ |
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index a29a8db5cc2f..2d1d9de06728 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h | |||
| @@ -57,6 +57,7 @@ typedef int (nvm_get_l2p_tbl_fn)(struct nvm_dev *, u64, u32, | |||
| 57 | typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *); | 57 | typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *); |
| 58 | typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int); | 58 | typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int); |
| 59 | typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); | 59 | typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); |
| 60 | typedef int (nvm_submit_io_sync_fn)(struct nvm_dev *, struct nvm_rq *); | ||
| 60 | typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *); | 61 | typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *); |
| 61 | typedef void (nvm_destroy_dma_pool_fn)(void *); | 62 | typedef void (nvm_destroy_dma_pool_fn)(void *); |
| 62 | typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, | 63 | typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, |
| @@ -70,6 +71,7 @@ struct nvm_dev_ops { | |||
| 70 | nvm_op_set_bb_fn *set_bb_tbl; | 71 | nvm_op_set_bb_fn *set_bb_tbl; |
| 71 | 72 | ||
| 72 | nvm_submit_io_fn *submit_io; | 73 | nvm_submit_io_fn *submit_io; |
| 74 | nvm_submit_io_sync_fn *submit_io_sync; | ||
| 73 | 75 | ||
| 74 | nvm_create_dma_pool_fn *create_dma_pool; | 76 | nvm_create_dma_pool_fn *create_dma_pool; |
| 75 | nvm_destroy_dma_pool_fn *destroy_dma_pool; | 77 | nvm_destroy_dma_pool_fn *destroy_dma_pool; |
| @@ -461,10 +463,9 @@ struct nvm_tgt_type { | |||
| 461 | 463 | ||
| 462 | /* For internal use */ | 464 | /* For internal use */ |
| 463 | struct list_head list; | 465 | struct list_head list; |
| 466 | struct module *owner; | ||
| 464 | }; | 467 | }; |
| 465 | 468 | ||
| 466 | extern struct nvm_tgt_type *nvm_find_target_type(const char *, int); | ||
| 467 | |||
| 468 | extern int nvm_register_tgt_type(struct nvm_tgt_type *); | 469 | extern int nvm_register_tgt_type(struct nvm_tgt_type *); |
| 469 | extern void nvm_unregister_tgt_type(struct nvm_tgt_type *); | 470 | extern void nvm_unregister_tgt_type(struct nvm_tgt_type *); |
| 470 | 471 | ||
| @@ -479,10 +480,8 @@ extern int nvm_set_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr *, | |||
| 479 | int, int); | 480 | int, int); |
| 480 | extern int nvm_max_phys_sects(struct nvm_tgt_dev *); | 481 | extern int nvm_max_phys_sects(struct nvm_tgt_dev *); |
| 481 | extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); | 482 | extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); |
| 483 | extern int nvm_submit_io_sync(struct nvm_tgt_dev *, struct nvm_rq *); | ||
| 482 | extern int nvm_erase_sync(struct nvm_tgt_dev *, struct ppa_addr *, int); | 484 | extern int nvm_erase_sync(struct nvm_tgt_dev *, struct ppa_addr *, int); |
| 483 | extern int nvm_set_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *, | ||
| 484 | const struct ppa_addr *, int, int); | ||
| 485 | extern void nvm_free_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *); | ||
| 486 | extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *, | 485 | extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *, |
| 487 | void *); | 486 | void *); |
| 488 | extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t); | 487 | extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t); |
| @@ -491,8 +490,6 @@ extern void nvm_end_io(struct nvm_rq *); | |||
| 491 | extern int nvm_bb_tbl_fold(struct nvm_dev *, u8 *, int); | 490 | extern int nvm_bb_tbl_fold(struct nvm_dev *, u8 *, int); |
| 492 | extern int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr, u8 *); | 491 | extern int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr, u8 *); |
| 493 | 492 | ||
| 494 | extern int nvm_dev_factory(struct nvm_dev *, int flags); | ||
| 495 | |||
| 496 | extern void nvm_part_to_tgt(struct nvm_dev *, sector_t *, int); | 493 | extern void nvm_part_to_tgt(struct nvm_dev *, sector_t *, int); |
| 497 | 494 | ||
| 498 | #else /* CONFIG_NVM */ | 495 | #else /* CONFIG_NVM */ |
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index a726f96010d5..496ff759f84c 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | * @node_name: FC WWNN for the port | 40 | * @node_name: FC WWNN for the port |
| 41 | * @port_name: FC WWPN for the port | 41 | * @port_name: FC WWPN for the port |
| 42 | * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) | 42 | * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) |
| 43 | * @dev_loss_tmo: maximum delay for reconnects to an association on | ||
| 44 | * this device. Used only on a remoteport. | ||
| 43 | * | 45 | * |
| 44 | * Initialization values for dynamic port fields: | 46 | * Initialization values for dynamic port fields: |
| 45 | * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must | 47 | * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must |
| @@ -50,6 +52,7 @@ struct nvme_fc_port_info { | |||
| 50 | u64 port_name; | 52 | u64 port_name; |
| 51 | u32 port_role; | 53 | u32 port_role; |
| 52 | u32 port_id; | 54 | u32 port_id; |
| 55 | u32 dev_loss_tmo; | ||
| 53 | }; | 56 | }; |
| 54 | 57 | ||
| 55 | 58 | ||
| @@ -102,8 +105,6 @@ enum nvmefc_fcp_datadir { | |||
| 102 | }; | 105 | }; |
| 103 | 106 | ||
| 104 | 107 | ||
| 105 | #define NVME_FC_MAX_SEGMENTS 256 | ||
| 106 | |||
| 107 | /** | 108 | /** |
| 108 | * struct nvmefc_fcp_req - Request structure passed from NVME-FC transport | 109 | * struct nvmefc_fcp_req - Request structure passed from NVME-FC transport |
| 109 | * to LLDD in order to perform a NVME FCP IO operation. | 110 | * to LLDD in order to perform a NVME FCP IO operation. |
| @@ -202,6 +203,9 @@ enum nvme_fc_obj_state { | |||
| 202 | * The length of the buffer corresponds to the local_priv_sz | 203 | * The length of the buffer corresponds to the local_priv_sz |
| 203 | * value specified in the nvme_fc_port_template supplied by | 204 | * value specified in the nvme_fc_port_template supplied by |
| 204 | * the LLDD. | 205 | * the LLDD. |
| 206 | * @dev_loss_tmo: maximum delay for reconnects to an association on | ||
| 207 | * this device. To modify, lldd must call | ||
| 208 | * nvme_fc_set_remoteport_devloss(). | ||
| 205 | * | 209 | * |
| 206 | * Fields with dynamic values. Values may change base on link state. LLDD | 210 | * Fields with dynamic values. Values may change base on link state. LLDD |
| 207 | * may reference fields directly to change them. Initialized by the | 211 | * may reference fields directly to change them. Initialized by the |
| @@ -259,10 +263,9 @@ struct nvme_fc_remote_port { | |||
| 259 | u32 port_role; | 263 | u32 port_role; |
| 260 | u64 node_name; | 264 | u64 node_name; |
| 261 | u64 port_name; | 265 | u64 port_name; |
| 262 | |||
| 263 | struct nvme_fc_local_port *localport; | 266 | struct nvme_fc_local_port *localport; |
| 264 | |||
| 265 | void *private; | 267 | void *private; |
| 268 | u32 dev_loss_tmo; | ||
| 266 | 269 | ||
| 267 | /* dynamic fields */ | 270 | /* dynamic fields */ |
| 268 | u32 port_id; | 271 | u32 port_id; |
| @@ -446,6 +449,10 @@ int nvme_fc_register_remoteport(struct nvme_fc_local_port *localport, | |||
| 446 | 449 | ||
| 447 | int nvme_fc_unregister_remoteport(struct nvme_fc_remote_port *remoteport); | 450 | int nvme_fc_unregister_remoteport(struct nvme_fc_remote_port *remoteport); |
| 448 | 451 | ||
| 452 | void nvme_fc_rescan_remoteport(struct nvme_fc_remote_port *remoteport); | ||
| 453 | |||
| 454 | int nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *remoteport, | ||
| 455 | u32 dev_loss_tmo); | ||
| 449 | 456 | ||
| 450 | 457 | ||
| 451 | /* | 458 | /* |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 9310ce77d8e1..aea87f0d917b 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
| @@ -90,6 +90,14 @@ enum { | |||
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | #define NVME_AQ_DEPTH 32 | 92 | #define NVME_AQ_DEPTH 32 |
| 93 | #define NVME_NR_AEN_COMMANDS 1 | ||
| 94 | #define NVME_AQ_BLK_MQ_DEPTH (NVME_AQ_DEPTH - NVME_NR_AEN_COMMANDS) | ||
| 95 | |||
| 96 | /* | ||
| 97 | * Subtract one to leave an empty queue entry for 'Full Queue' condition. See | ||
| 98 | * NVM-Express 1.2 specification, section 4.1.2. | ||
| 99 | */ | ||
| 100 | #define NVME_AQ_MQ_TAG_DEPTH (NVME_AQ_BLK_MQ_DEPTH - 1) | ||
| 93 | 101 | ||
| 94 | enum { | 102 | enum { |
| 95 | NVME_REG_CAP = 0x0000, /* Controller Capabilities */ | 103 | NVME_REG_CAP = 0x0000, /* Controller Capabilities */ |
| @@ -267,6 +275,7 @@ enum { | |||
| 267 | NVME_CTRL_OACS_SEC_SUPP = 1 << 0, | 275 | NVME_CTRL_OACS_SEC_SUPP = 1 << 0, |
| 268 | NVME_CTRL_OACS_DIRECTIVES = 1 << 5, | 276 | NVME_CTRL_OACS_DIRECTIVES = 1 << 5, |
| 269 | NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, | 277 | NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, |
| 278 | NVME_CTRL_LPA_CMD_EFFECTS_LOG = 1 << 1, | ||
| 270 | }; | 279 | }; |
| 271 | 280 | ||
| 272 | struct nvme_lbaf { | 281 | struct nvme_lbaf { |
| @@ -396,6 +405,21 @@ struct nvme_fw_slot_info_log { | |||
| 396 | }; | 405 | }; |
| 397 | 406 | ||
| 398 | enum { | 407 | enum { |
| 408 | NVME_CMD_EFFECTS_CSUPP = 1 << 0, | ||
| 409 | NVME_CMD_EFFECTS_LBCC = 1 << 1, | ||
| 410 | NVME_CMD_EFFECTS_NCC = 1 << 2, | ||
| 411 | NVME_CMD_EFFECTS_NIC = 1 << 3, | ||
| 412 | NVME_CMD_EFFECTS_CCC = 1 << 4, | ||
| 413 | NVME_CMD_EFFECTS_CSE_MASK = 3 << 16, | ||
| 414 | }; | ||
| 415 | |||
| 416 | struct nvme_effects_log { | ||
| 417 | __le32 acs[256]; | ||
| 418 | __le32 iocs[256]; | ||
| 419 | __u8 resv[2048]; | ||
| 420 | }; | ||
| 421 | |||
| 422 | enum { | ||
| 399 | NVME_SMART_CRIT_SPARE = 1 << 0, | 423 | NVME_SMART_CRIT_SPARE = 1 << 0, |
| 400 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, | 424 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, |
| 401 | NVME_SMART_CRIT_RELIABILITY = 1 << 2, | 425 | NVME_SMART_CRIT_RELIABILITY = 1 << 2, |
| @@ -404,6 +428,10 @@ enum { | |||
| 404 | }; | 428 | }; |
| 405 | 429 | ||
| 406 | enum { | 430 | enum { |
| 431 | NVME_AER_ERROR = 0, | ||
| 432 | NVME_AER_SMART = 1, | ||
| 433 | NVME_AER_CSS = 6, | ||
| 434 | NVME_AER_VS = 7, | ||
| 407 | NVME_AER_NOTICE_NS_CHANGED = 0x0002, | 435 | NVME_AER_NOTICE_NS_CHANGED = 0x0002, |
| 408 | NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102, | 436 | NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102, |
| 409 | }; | 437 | }; |
| @@ -681,6 +709,7 @@ enum nvme_admin_opcode { | |||
| 681 | nvme_admin_format_nvm = 0x80, | 709 | nvme_admin_format_nvm = 0x80, |
| 682 | nvme_admin_security_send = 0x81, | 710 | nvme_admin_security_send = 0x81, |
| 683 | nvme_admin_security_recv = 0x82, | 711 | nvme_admin_security_recv = 0x82, |
| 712 | nvme_admin_sanitize_nvm = 0x84, | ||
| 684 | }; | 713 | }; |
| 685 | 714 | ||
| 686 | enum { | 715 | enum { |
| @@ -712,6 +741,7 @@ enum { | |||
| 712 | NVME_LOG_ERROR = 0x01, | 741 | NVME_LOG_ERROR = 0x01, |
| 713 | NVME_LOG_SMART = 0x02, | 742 | NVME_LOG_SMART = 0x02, |
| 714 | NVME_LOG_FW_SLOT = 0x03, | 743 | NVME_LOG_FW_SLOT = 0x03, |
| 744 | NVME_LOG_CMD_EFFECTS = 0x05, | ||
| 715 | NVME_LOG_DISC = 0x70, | 745 | NVME_LOG_DISC = 0x70, |
| 716 | NVME_LOG_RESERVATION = 0x80, | 746 | NVME_LOG_RESERVATION = 0x80, |
| 717 | NVME_FWACT_REPL = (0 << 3), | 747 | NVME_FWACT_REPL = (0 << 3), |
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index a1904aadbc45..0dcc60e820de 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h | |||
| @@ -211,10 +211,14 @@ bool sbitmap_any_bit_set(const struct sbitmap *sb); | |||
| 211 | */ | 211 | */ |
| 212 | bool sbitmap_any_bit_clear(const struct sbitmap *sb); | 212 | bool sbitmap_any_bit_clear(const struct sbitmap *sb); |
| 213 | 213 | ||
| 214 | #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) | ||
| 215 | #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) | ||
| 216 | |||
| 214 | typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *); | 217 | typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *); |
| 215 | 218 | ||
| 216 | /** | 219 | /** |
| 217 | * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. | 220 | * __sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. |
| 221 | * @start: Where to start the iteration. | ||
| 218 | * @sb: Bitmap to iterate over. | 222 | * @sb: Bitmap to iterate over. |
| 219 | * @fn: Callback. Should return true to continue or false to break early. | 223 | * @fn: Callback. Should return true to continue or false to break early. |
| 220 | * @data: Pointer to pass to callback. | 224 | * @data: Pointer to pass to callback. |
| @@ -222,35 +226,61 @@ typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *); | |||
| 222 | * This is inline even though it's non-trivial so that the function calls to the | 226 | * This is inline even though it's non-trivial so that the function calls to the |
| 223 | * callback will hopefully get optimized away. | 227 | * callback will hopefully get optimized away. |
| 224 | */ | 228 | */ |
| 225 | static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, | 229 | static inline void __sbitmap_for_each_set(struct sbitmap *sb, |
| 226 | void *data) | 230 | unsigned int start, |
| 231 | sb_for_each_fn fn, void *data) | ||
| 227 | { | 232 | { |
| 228 | unsigned int i; | 233 | unsigned int index; |
| 234 | unsigned int nr; | ||
| 235 | unsigned int scanned = 0; | ||
| 229 | 236 | ||
| 230 | for (i = 0; i < sb->map_nr; i++) { | 237 | if (start >= sb->depth) |
| 231 | struct sbitmap_word *word = &sb->map[i]; | 238 | start = 0; |
| 232 | unsigned int off, nr; | 239 | index = SB_NR_TO_INDEX(sb, start); |
| 240 | nr = SB_NR_TO_BIT(sb, start); | ||
| 233 | 241 | ||
| 234 | if (!word->word) | 242 | while (scanned < sb->depth) { |
| 235 | continue; | 243 | struct sbitmap_word *word = &sb->map[index]; |
| 244 | unsigned int depth = min_t(unsigned int, word->depth - nr, | ||
| 245 | sb->depth - scanned); | ||
| 236 | 246 | ||
| 237 | nr = 0; | 247 | scanned += depth; |
| 238 | off = i << sb->shift; | 248 | if (!word->word) |
| 249 | goto next; | ||
| 250 | |||
| 251 | /* | ||
| 252 | * On the first iteration of the outer loop, we need to add the | ||
| 253 | * bit offset back to the size of the word for find_next_bit(). | ||
| 254 | * On all other iterations, nr is zero, so this is a noop. | ||
| 255 | */ | ||
| 256 | depth += nr; | ||
| 239 | while (1) { | 257 | while (1) { |
| 240 | nr = find_next_bit(&word->word, word->depth, nr); | 258 | nr = find_next_bit(&word->word, depth, nr); |
| 241 | if (nr >= word->depth) | 259 | if (nr >= depth) |
| 242 | break; | 260 | break; |
| 243 | 261 | if (!fn(sb, (index << sb->shift) + nr, data)) | |
| 244 | if (!fn(sb, off + nr, data)) | ||
| 245 | return; | 262 | return; |
| 246 | 263 | ||
| 247 | nr++; | 264 | nr++; |
| 248 | } | 265 | } |
| 266 | next: | ||
| 267 | nr = 0; | ||
| 268 | if (++index >= sb->map_nr) | ||
| 269 | index = 0; | ||
| 249 | } | 270 | } |
| 250 | } | 271 | } |
| 251 | 272 | ||
| 252 | #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) | 273 | /** |
| 253 | #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) | 274 | * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. |
| 275 | * @sb: Bitmap to iterate over. | ||
| 276 | * @fn: Callback. Should return true to continue or false to break early. | ||
| 277 | * @data: Pointer to pass to callback. | ||
| 278 | */ | ||
| 279 | static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, | ||
| 280 | void *data) | ||
| 281 | { | ||
| 282 | __sbitmap_for_each_set(sb, 0, fn, data); | ||
| 283 | } | ||
| 254 | 284 | ||
| 255 | static inline unsigned long *__sbitmap_word(struct sbitmap *sb, | 285 | static inline unsigned long *__sbitmap_word(struct sbitmap *sb, |
| 256 | unsigned int bitnr) | 286 | unsigned int bitnr) |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index e12d92808e98..f42d85631d17 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -43,28 +43,6 @@ enum writeback_sync_modes { | |||
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | /* | 45 | /* |
| 46 | * why some writeback work was initiated | ||
| 47 | */ | ||
| 48 | enum wb_reason { | ||
| 49 | WB_REASON_BACKGROUND, | ||
| 50 | WB_REASON_VMSCAN, | ||
| 51 | WB_REASON_SYNC, | ||
| 52 | WB_REASON_PERIODIC, | ||
| 53 | WB_REASON_LAPTOP_TIMER, | ||
| 54 | WB_REASON_FREE_MORE_MEM, | ||
| 55 | WB_REASON_FS_FREE_SPACE, | ||
| 56 | /* | ||
| 57 | * There is no bdi forker thread any more and works are done | ||
| 58 | * by emergency worker, however, this is TPs userland visible | ||
| 59 | * and we'll be exposing exactly the same information, | ||
| 60 | * so it has a mismatch name. | ||
| 61 | */ | ||
| 62 | WB_REASON_FORKER_THREAD, | ||
| 63 | |||
| 64 | WB_REASON_MAX, | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * A control structure which tells the writeback code what to do. These are | 46 | * A control structure which tells the writeback code what to do. These are |
| 69 | * always on the stack, and hence need no locking. They are always initialised | 47 | * always on the stack, and hence need no locking. They are always initialised |
| 70 | * in a manner such that unspecified fields are set to zero. | 48 | * in a manner such that unspecified fields are set to zero. |
| @@ -186,11 +164,11 @@ struct bdi_writeback; | |||
| 186 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 164 | void writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
| 187 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | 165 | void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
| 188 | enum wb_reason reason); | 166 | enum wb_reason reason); |
| 189 | bool try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 167 | void try_to_writeback_inodes_sb(struct super_block *sb, enum wb_reason reason); |
| 190 | bool try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | ||
| 191 | enum wb_reason reason); | ||
| 192 | void sync_inodes_sb(struct super_block *); | 168 | void sync_inodes_sb(struct super_block *); |
| 193 | void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); | 169 | void wakeup_flusher_threads(enum wb_reason reason); |
| 170 | void wakeup_flusher_threads_bdi(struct backing_dev_info *bdi, | ||
| 171 | enum wb_reason reason); | ||
| 194 | void inode_wait_for_writeback(struct inode *inode); | 172 | void inode_wait_for_writeback(struct inode *inode); |
| 195 | 173 | ||
| 196 | /* writeback.h requires fs.h; it, too, is not included from here. */ | 174 | /* writeback.h requires fs.h; it, too, is not included from here. */ |
