sysctl: move some boundary constants from sysctl.c to sysctl_vals
[linux-block.git] / include / linux / blkdev.h
index bd4370baccca31ace90c0d3bbb23d08e7a14bcff..9c95df26fc26b1fec99c5325f8f22ceeef59d175 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/percpu-refcount.h>
 #include <linux/blkzoned.h>
 #include <linux/sbitmap.h>
+#include <linux/srcu.h>
 
 struct module;
 struct request_queue;
@@ -44,7 +45,7 @@ struct blk_crypto_profile;
  */
 #define BLKCG_MAX_POLS         6
 
-static inline int blk_validate_block_size(unsigned int bsize)
+static inline int blk_validate_block_size(unsigned long bsize)
 {
        if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
                return -EINVAL;
@@ -267,7 +268,7 @@ struct request_queue {
        int                     poll_nsec;
 
        struct blk_stat_callback        *poll_cb;
-       struct blk_rq_stat      poll_stat[BLK_MQ_POLL_STATS_BKTS];
+       struct blk_rq_stat      *poll_stat;
 
        struct timer_list       timeout;
        struct work_struct      timeout_work;
@@ -373,11 +374,18 @@ struct request_queue {
         * devices that do not have multiple independent access ranges.
         */
        struct blk_independent_access_ranges *ia_ranges;
+
+       /**
+        * @srcu: Sleepable RCU. Use as lock when type of the request queue
+        * is blocking (BLK_MQ_F_BLOCKING). Must be the last member
+        */
+       struct srcu_struct      srcu[];
 };
 
 /* Keep blk_queue_flag_name[] in sync with the definitions below */
 #define QUEUE_FLAG_STOPPED     0       /* queue is stopped */
 #define QUEUE_FLAG_DYING       1       /* queue being torn down */
+#define QUEUE_FLAG_HAS_SRCU    2       /* SRCU is allocated */
 #define QUEUE_FLAG_NOMERGES     3      /* disable merge attempts */
 #define QUEUE_FLAG_SAME_COMP   4       /* complete on same CPU-group */
 #define QUEUE_FLAG_FAIL_IO     5       /* fake timeout */
@@ -397,7 +405,6 @@ struct request_queue {
 #define QUEUE_FLAG_FUA         18      /* device supports FUA writes */
 #define QUEUE_FLAG_DAX         19      /* device supports DAX */
 #define QUEUE_FLAG_STATS       20      /* track IO start and completion times */
-#define QUEUE_FLAG_POLL_STATS  21      /* collecting stats for hybrid polling */
 #define QUEUE_FLAG_REGISTERED  22      /* queue has been registered to a disk */
 #define QUEUE_FLAG_QUIESCED    24      /* queue has been quiesced */
 #define QUEUE_FLAG_PCI_P2PDMA  25      /* device supports PCI p2p requests */
@@ -416,6 +423,7 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
 
 #define blk_queue_stopped(q)   test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
 #define blk_queue_dying(q)     test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)
+#define blk_queue_has_srcu(q)  test_bit(QUEUE_FLAG_HAS_SRCU, &(q)->queue_flags)
 #define blk_queue_dead(q)      test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
 #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags)
 #define blk_queue_nomerges(q)  test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
@@ -1171,8 +1179,6 @@ int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned lo
 bool blk_crypto_register(struct blk_crypto_profile *profile,
                         struct request_queue *q);
 
-void blk_crypto_unregister(struct request_queue *q);
-
 #else /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 static inline bool blk_crypto_register(struct blk_crypto_profile *profile,
@@ -1181,8 +1187,6 @@ static inline bool blk_crypto_register(struct blk_crypto_profile *profile,
        return true;
 }
 
-static inline void blk_crypto_unregister(struct request_queue *q) { }
-
 #endif /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 enum blk_unique_id {
@@ -1335,33 +1339,4 @@ struct io_comp_batch {
 
 #define DEFINE_IO_COMP_BATCH(name)     struct io_comp_batch name = { }
 
-#define rq_list_add(listptr, rq)       do {            \
-       (rq)->rq_next = *(listptr);                     \
-       *(listptr) = rq;                                \
-} while (0)
-
-#define rq_list_pop(listptr)                           \
-({                                                     \
-       struct request *__req = NULL;                   \
-       if ((listptr) && *(listptr))    {               \
-               __req = *(listptr);                     \
-               *(listptr) = __req->rq_next;            \
-       }                                               \
-       __req;                                          \
-})
-
-#define rq_list_peek(listptr)                          \
-({                                                     \
-       struct request *__req = NULL;                   \
-       if ((listptr) && *(listptr))                    \
-               __req = *(listptr);                     \
-       __req;                                          \
-})
-
-#define rq_list_for_each(listptr, pos)                 \
-       for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos)) \
-
-#define rq_list_next(rq)       (rq)->rq_next
-#define rq_list_empty(list)    ((list) == (struct request *) NULL)
-
 #endif /* _LINUX_BLKDEV_H */