History

Merge tag 'for-6.11/block-20240722' of git://git.kernel.dk/linux

Pull more block updates from Jens Axboe: - MD fixes via Song: - md-cluster fixes (Heming Zhao) - raid1 fix (Mateusz Jończyk) - s390/dasd module description (Jeff) - Series cleaning up and hardening the blk-mq debugfs flag handling (John, Christoph) - blk-cgroup cleanup (Xiu) - Error polled IO attempts if backend doesn't support it (hexue) - Fix for an sbitmap hang (Yang) * tag 'for-6.11/block-20240722' of git://git.kernel.dk/linux: (23 commits) blk-cgroup: move congestion_count to struct blkcg sbitmap: fix io hung due to race on sbitmap_word::cleared block: avoid polling configuration errors block: Catch possible entries missing from rqf_name[] block: Simplify definition of RQF_NAME() block: Use enum to define RQF_x bit indexes block: Catch possible entries missing from cmd_flag_name[] block: Catch possible entries missing from alloc_policy_name[] block: Catch possible entries missing from hctx_flag_name[] block: Catch possible entries missing from hctx_state_name[] block: Catch possible entries missing from blk_queue_flag_name[] block: Make QUEUE_FLAG_x as an enum block: Relocate BLK_MQ_MAX_DEPTH block: Relocate BLK_MQ_CPU_WORK_BATCH block: remove QUEUE_FLAG_STOPPED block: Add missing entry to hctx_flag_name[] block: Add zone write plugging entry to rqf_name[] block: Add missing entries from cmd_flag_name[] s390/dasd: fix error checks in dasd_copy_pair_store() s390/dasd: add missing MODULE_DESCRIPTION() macros ...

Linus Torvalds committed 2 years ago

Commit 7d080fa2 parents 0256994 89ed6c919 files · +233 −102Browse files

Unified · Split

19 files
  1. block/blk-cgroup.c +4 −3
  2. block/blk-cgroup.h +6 −4
  3. block/blk-core.c +4 −1
  4. block/blk-mq-debugfs.c +21 −5
  5. block/blk-mq.h +2 −0
  6. drivers/md/md-cluster.c +39 −10
  7. drivers/md/md-cluster.h +2 −0
  8. drivers/md/md.c +14 −3
  9. drivers/md/raid1.c +1 −0
  10. drivers/s390/block/dasd_devmap.c +8 −2
  11. drivers/s390/block/dasd_diag.c +1 −0
  12. drivers/s390/block/dasd_eckd.c +1 −0
  13. drivers/s390/block/dasd_fba.c +1 −0
  14. include/linux/blk-mq.h +78 −49
  15. include/linux/blk_types.h +1 −0
  16. include/linux/blkdev.h +16 −15
  17. include/linux/cgroup-defs.h +0 −3
  18. include/linux/sbitmap.h +5 −0
  19. lib/sbitmap.c +29 −7
block/blk-cgroup.c+4−3
@@ -2182,12 +2182,13 @@ void blk_cgroup_bio_start(struct bio *bio) · 2181 unmodified lines
21822182
21832183 bool blk_cgroup_congested(void)
21842184 {
2185− struct cgroup_subsys_state *css;
2185+ struct blkcg *blkcg;
21862186 bool ret = false;
21872187
21882188 rcu_read_lock();
2189− for (css = blkcg_css(); css; css = css->parent) {
2190− if (atomic_read(&css->cgroup->congestion_count)) {
2189+ for (blkcg = css_to_blkcg(blkcg_css()); blkcg;
2190+ blkcg = blkcg_parent(blkcg)) {
2191+ if (atomic_read(&blkcg->congestion_count)) {
21912192 ret = true;
21922193 break;
21932194 }
block/blk-cgroup.h+6−4
@@ -95,6 +95,8 @@ struct blkcg { · 94 unmodified lines
9595 struct cgroup_subsys_state css;
9696 spinlock_t lock;
9797 refcount_t online_pin;
98+ /* If there is block congestion on this cgroup. */
99+ atomic_t congestion_count;
98100
99101 struct radix_tree_root blkg_tree;
100102 struct blkcg_gq __rcu *blkg_hint;
@@ -374,7 +376,7 @@ static inline void blkcg_use_delay(struct blkcg_gq *blkg) · 273 unmodified lines
374376 if (WARN_ON_ONCE(atomic_read(&blkg->use_delay) < 0))
375377 return;
376378 if (atomic_add_return(1, &blkg->use_delay) == 1)
377− atomic_inc(&blkg->blkcg->css.cgroup->congestion_count);
379+ atomic_inc(&blkg->blkcg->congestion_count);
378380 }
379381
380382 static inline int blkcg_unuse_delay(struct blkcg_gq *blkg)
@@ -399,7 +401,7 @@ static inline int blkcg_unuse_delay(struct blkcg_gq *blkg) · 18 unmodified lines
399401 if (old == 0)
400402 return 0;
401403 if (old == 1)
402− atomic_dec(&blkg->blkcg->css.cgroup->congestion_count);
404+ atomic_dec(&blkg->blkcg->congestion_count);
403405 return 1;
404406 }
405407
@@ -418,7 +420,7 @@ static inline void blkcg_set_delay(struct blkcg_gq *blkg, u64 delay) · 12 unmodified lines
418420
419421 /* We only want 1 person setting the congestion count for this blkg. */
420422 if (!old && atomic_try_cmpxchg(&blkg->use_delay, &old, -1))
421− atomic_inc(&blkg->blkcg->css.cgroup->congestion_count);
423+ atomic_inc(&blkg->blkcg->congestion_count);
422424
423425 atomic64_set(&blkg->delay_nsec, delay);
424426 }
@@ -435,7 +437,7 @@ static inline void blkcg_clear_delay(struct blkcg_gq *blkg) · 10 unmodified lines
435437
436438 /* We only want 1 person clearing the congestion count for this blkg. */
437439 if (old && atomic_try_cmpxchg(&blkg->use_delay, &old, 0))
438− atomic_dec(&blkg->blkcg->css.cgroup->congestion_count);
440+ atomic_dec(&blkg->blkcg->congestion_count);
439441 }
440442
441443 /**
block/blk-core.c+4−1
@@ -791,8 +791,11 @@ void submit_bio_noacct(struct bio *bio) · 790 unmodified lines
791791 }
792792 }
793793
794− if (!(q->limits.features & BLK_FEAT_POLL))
794+ if (!(q->limits.features & BLK_FEAT_POLL) &&
795+ (bio->bi_opf & REQ_POLLED)) {
795796 bio_clear_polled(bio);
797+ goto not_supported;
798+ }
796799
797800 switch (bio_op(bio)) {
798801 case REQ_OP_READ:
block/blk-mq-debugfs.c+21−5
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 #include <linux/kernel.h>
77 #include <linux/blkdev.h>
8+#include <linux/build_bug.h>
89 #include <linux/debugfs.h>
910
1011 #include "blk.h"
@@ -79,7 +80,6 @@ static int queue_pm_only_show(void *data, struct seq_file *m) · 68 unmodified lines
7980
8081 #define QUEUE_FLAG_NAME(name) [QUEUE_FLAG_##name] = #name
8182 static const char *const blk_queue_flag_name[] = {
82− QUEUE_FLAG_NAME(STOPPED),
8383 QUEUE_FLAG_NAME(DYING),
8484 QUEUE_FLAG_NAME(NOMERGES),
8585 QUEUE_FLAG_NAME(SAME_COMP),
@@ -100,6 +100,7 @@ static int queue_state_show(void *data, struct seq_file *m) · 14 unmodified lines
100100 {
101101 struct request_queue *q = data;
102102
103+ BUILD_BUG_ON(ARRAY_SIZE(blk_queue_flag_name) != QUEUE_FLAG_MAX);
103104 blk_flags_show(m, q->queue_flags, blk_queue_flag_name,
104105 ARRAY_SIZE(blk_queue_flag_name));
105106 seq_puts(m, "\n");
@@ -164,6 +165,7 @@ static int hctx_state_show(void *data, struct seq_file *m) · 58 unmodified lines
164165 {
165166 struct blk_mq_hw_ctx *hctx = data;
166167
168+ BUILD_BUG_ON(ARRAY_SIZE(hctx_state_name) != BLK_MQ_S_MAX);
167169 blk_flags_show(m, hctx->state, hctx_state_name,
168170 ARRAY_SIZE(hctx_state_name));
169171 seq_puts(m, "\n");
@@ -181,10 +183,11 @@ static const char *const alloc_policy_name[] = { · 11 unmodified lines
181183 static const char *const hctx_flag_name[] = {
182184 HCTX_FLAG_NAME(SHOULD_MERGE),
183185 HCTX_FLAG_NAME(TAG_QUEUE_SHARED),
184− HCTX_FLAG_NAME(BLOCKING),
185− HCTX_FLAG_NAME(NO_SCHED),
186186 HCTX_FLAG_NAME(STACKING),
187187 HCTX_FLAG_NAME(TAG_HCTX_SHARED),
188+ HCTX_FLAG_NAME(BLOCKING),
189+ HCTX_FLAG_NAME(NO_SCHED),
190+ HCTX_FLAG_NAME(NO_SCHED_BY_DEFAULT),
188191 };
189192 #undef HCTX_FLAG_NAME
190193
@@ -193,6 +196,10 @@ static int hctx_flags_show(void *data, struct seq_file *m) · 2 unmodified lines
193196 struct blk_mq_hw_ctx *hctx = data;
194197 const int alloc_policy = BLK_MQ_FLAG_TO_ALLOC_POLICY(hctx->flags);
195198
199+ BUILD_BUG_ON(ARRAY_SIZE(hctx_flag_name) !=
200+ BLK_MQ_F_ALLOC_POLICY_START_BIT);
201+ BUILD_BUG_ON(ARRAY_SIZE(alloc_policy_name) != BLK_TAG_ALLOC_MAX);
202+
196203 seq_puts(m, "alloc_policy=");
197204 if (alloc_policy < ARRAY_SIZE(alloc_policy_name) &&
198205 alloc_policy_name[alloc_policy])
@@ -223,12 +230,17 @@ static const char *const cmd_flag_name[] = { · 24 unmodified lines
223230 CMD_FLAG_NAME(RAHEAD),
224231 CMD_FLAG_NAME(BACKGROUND),
225232 CMD_FLAG_NAME(NOWAIT),
226− CMD_FLAG_NAME(NOUNMAP),
227233 CMD_FLAG_NAME(POLLED),
234+ CMD_FLAG_NAME(ALLOC_CACHE),
235+ CMD_FLAG_NAME(SWAP),
236+ CMD_FLAG_NAME(DRV),
237+ CMD_FLAG_NAME(FS_PRIVATE),
238+ CMD_FLAG_NAME(ATOMIC),
239+ CMD_FLAG_NAME(NOUNMAP),
228240 };
229241 #undef CMD_FLAG_NAME
230242
231−#define RQF_NAME(name) [ilog2((__force u32)RQF_##name)] = #name
243+#define RQF_NAME(name) [__RQF_##name] = #name
232244 static const char *const rqf_name[] = {
233245 RQF_NAME(STARTED),
234246 RQF_NAME(FLUSH_SEQ),
@@ -243,6 +255,7 @@ static const char *const rqf_name[] = { · 8 unmodified lines
243255 RQF_NAME(HASHED),
244256 RQF_NAME(STATS),
245257 RQF_NAME(SPECIAL_PAYLOAD),
258+ RQF_NAME(ZONE_WRITE_PLUGGING),
246259 RQF_NAME(TIMED_OUT),
247260 RQF_NAME(RESV),
248261 };
@@ -268,6 +281,9 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) · 19 unmodified lines
268281 const enum req_op op = req_op(rq);
269282 const char *op_str = blk_op_str(op);
270283
284+ BUILD_BUG_ON(ARRAY_SIZE(cmd_flag_name) != __REQ_NR_BITS);
285+ BUILD_BUG_ON(ARRAY_SIZE(rqf_name) != __RQF_BITS);
286+
271287 seq_printf(m, "%p {.op=", rq);
272288 if (strcmp(op_str, "UNKNOWN") == 0)
273289 seq_printf(m, "%u", op);
block/blk-mq.h+2−0
@@ -36,6 +36,8 @@ enum { · 35 unmodified lines
3636 BLK_MQ_TAG_MAX = BLK_MQ_NO_TAG - 1,
3737 };
3838
39+#define BLK_MQ_CPU_WORK_BATCH (8)
40+
3941 typedef unsigned int __bitwise blk_insert_t;
4042 #define BLK_MQ_INSERT_AT_HEAD ((__force blk_insert_t)0x01)
4143
drivers/md/md-cluster.c+39−10
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515
1616 #define LVB_SIZE 64
1717 #define NEW_DEV_TIMEOUT 5000
18+#define WAIT_DLM_LOCK_TIMEOUT (30 * HZ)
1819
1920 struct dlm_lock_resource {
2021 dlm_lockspace_t *ls;
@@ -56,6 +57,7 @@ struct resync_info { · 35 unmodified lines
5657 #define MD_CLUSTER_ALREADY_IN_CLUSTER 6
5758 #define MD_CLUSTER_PENDING_RECV_EVENT 7
5859 #define MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD 8
60+#define MD_CLUSTER_WAITING_FOR_SYNC 9
5961
6062 struct md_cluster_info {
6163 struct mddev *mddev; /* the md device which md_cluster_info belongs to */
@@ -91,6 +93,7 @@ struct md_cluster_info { · 29 unmodified lines
9193 sector_t sync_hi;
9294 };
9395
96+/* For compatibility, add the new msg_type at the end. */
9497 enum msg_type {
9598 METADATA_UPDATED = 0,
9699 RESYNCING,
@@ -100,6 +103,7 @@ enum msg_type { · 3 unmodified lines
100103 BITMAP_NEEDS_SYNC,
101104 CHANGE_CAPACITY,
102105 BITMAP_RESIZE,
106+ RESYNCING_START,
103107 };
104108
105109 struct cluster_msg {
@@ -130,8 +134,13 @@ static int dlm_lock_sync(struct dlm_lock_resource *res, int mode) · 24 unmodified lines
130134 0, sync_ast, res, res->bast);
131135 if (ret)
132136 return ret;
133− wait_event(res->sync_locking, res->sync_locking_done);
137+ ret = wait_event_timeout(res->sync_locking, res->sync_locking_done,
138+ WAIT_DLM_LOCK_TIMEOUT);
134139 res->sync_locking_done = false;
140+ if (!ret) {
141+ pr_err("locking DLM '%s' timeout!\n", res->name);
142+ return -EBUSY;
143+ }
135144 if (res->lksb.sb_status == 0)
136145 res->mode = mode;
137146 return res->lksb.sb_status;
@@ -455,6 +464,7 @@ static void process_suspend_info(struct mddev *mddev, · 317 unmodified lines
455464 clear_bit(MD_RESYNCING_REMOTE, &mddev->recovery);
456465 remove_suspend_info(mddev, slot);
457466 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
467+ clear_bit(MD_CLUSTER_WAITING_FOR_SYNC, &cinfo->state);
458468 md_wakeup_thread(mddev->thread);
459469 return;
460470 }
@@ -525,6 +535,7 @@ static int process_add_new_disk(struct mddev *mddev, struct cluster_msg *cmsg) · 64 unmodified lines
525535 res = -1;
526536 }
527537 clear_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state);
538+ set_bit(MD_CLUSTER_WAITING_FOR_SYNC, &cinfo->state);
528539 return res;
529540 }
530541
@@ -593,6 +604,9 @@ static int process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) · 62 unmodified lines
593604 case CHANGE_CAPACITY:
594605 set_capacity_and_notify(mddev->gendisk, mddev->array_sectors);
595606 break;
607+ case RESYNCING_START:
608+ clear_bit(MD_CLUSTER_WAITING_FOR_SYNC, &mddev->cluster_info->state);
609+ break;
596610 case RESYNCING:
597611 set_bit(MD_RESYNCING_REMOTE, &mddev->recovery);
598612 process_suspend_info(mddev, le32_to_cpu(msg->slot),
@@ -743,7 +757,7 @@ static void unlock_comm(struct md_cluster_info *cinfo) · 144 unmodified lines
743757 */
744758 static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg)
745759 {
746− int error;
760+ int error, unlock_error;
747761 int slot = cinfo->slot_number - 1;
748762
749763 cmsg->slot = cpu_to_le32(slot);
@@ -751,7 +765,7 @@ static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg) · 1 unmodified line
751765 error = dlm_lock_sync(cinfo->message_lockres, DLM_LOCK_EX);
752766 if (error) {
753767 pr_err("md-cluster: failed to get EX on MESSAGE (%d)\n", error);
754− goto failed_message;
768+ return error;
755769 }
756770
757771 memcpy(cinfo->message_lockres->lksb.sb_lvbptr, (void *)cmsg,
@@ -781,14 +795,10 @@ static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg) · 23 unmodified lines
781795 }
782796
783797 failed_ack:
784− error = dlm_unlock_sync(cinfo->message_lockres);
785− if (unlikely(error != 0)) {
798+ while ((unlock_error = dlm_unlock_sync(cinfo->message_lockres)))
786799 pr_err("md-cluster: failed convert to NL on MESSAGE(%d)\n",
787− error);
788− /* in case the message can't be released due to some reason */
789− goto failed_ack;
790− }
791−failed_message:
800+ unlock_error);
801+
792802 return error;
793803 }
794804
@@ -1343,6 +1353,23 @@ static void resync_info_get(struct mddev *mddev, sector_t *lo, sector_t *hi) · 548 unmodified lines
13431353 spin_unlock_irq(&cinfo->suspend_lock);
13441354 }
13451355
1356+static int resync_status_get(struct mddev *mddev)
1357+{
1358+ struct md_cluster_info *cinfo = mddev->cluster_info;
1359+
1360+ return test_bit(MD_CLUSTER_WAITING_FOR_SYNC, &cinfo->state);
1361+}
1362+
1363+static int resync_start_notify(struct mddev *mddev)
1364+{
1365+ struct md_cluster_info *cinfo = mddev->cluster_info;
1366+ struct cluster_msg cmsg = {0};
1367+
1368+ cmsg.type = cpu_to_le32(RESYNCING_START);
1369+
1370+ return sendmsg(cinfo, &cmsg, 0);
1371+}
1372+
13461373 static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi)
13471374 {
13481375 struct md_cluster_info *cinfo = mddev->cluster_info;
@@ -1577,6 +1604,8 @@ static const struct md_cluster_operations cluster_ops = { · 228 unmodified lines
15771604 .resync_start = resync_start,
15781605 .resync_finish = resync_finish,
15791606 .resync_info_update = resync_info_update,
1607+ .resync_start_notify = resync_start_notify,
1608+ .resync_status_get = resync_status_get,
15801609 .resync_info_get = resync_info_get,
15811610 .metadata_update_start = metadata_update_start,
15821611 .metadata_update_finish = metadata_update_finish,
drivers/md/md-cluster.h+2−0
@@ -14,6 +14,8 @@ struct md_cluster_operations { · 13 unmodified lines
1414 int (*leave)(struct mddev *mddev);
1515 int (*slot_number)(struct mddev *mddev);
1616 int (*resync_info_update)(struct mddev *mddev, sector_t lo, sector_t hi);
17+ int (*resync_start_notify)(struct mddev *mddev);
18+ int (*resync_status_get)(struct mddev *mddev);
1719 void (*resync_info_get)(struct mddev *mddev, sector_t *lo, sector_t *hi);
1820 int (*metadata_update_start)(struct mddev *mddev);
1921 int (*metadata_update_finish)(struct mddev *mddev);
drivers/md/md.c+14−3
@@ -8978,7 +8978,8 @@ void md_do_sync(struct md_thread *thread) · 8977 unmodified lines
89788978 * This will mean we have to start checking from the beginning again.
89798979 *
89808980 */
8981−
8981+ if (mddev_is_clustered(mddev))
8982+ md_cluster_ops->resync_start_notify(mddev);
89828983 do {
89838984 int mddev2_minor = -1;
89848985 mddev->curr_resync = MD_RESYNC_DELAYED;
@@ -9992,8 +9993,18 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev) · 1007 unmodified lines
99929993 */
99939994 if (rdev2->raid_disk == -1 && role != MD_DISK_ROLE_SPARE &&
99949995 !(le32_to_cpu(sb->feature_map) &
9995− MD_FEATURE_RESHAPE_ACTIVE)) {
9996− rdev2->saved_raid_disk = role;
9996+ MD_FEATURE_RESHAPE_ACTIVE) &&
9997+ !md_cluster_ops->resync_status_get(mddev)) {
9998+ /*
9999+ * -1 to make raid1_add_disk() set conf->fullsync
10000+ * to 1. This could avoid skipping sync when the
10001+ * remote node is down during resyncing.
10002+ */
10003+ if ((le32_to_cpu(sb->feature_map)
10004+ & MD_FEATURE_RECOVERY_OFFSET))
10005+ rdev2->saved_raid_disk = -1;
10006+ else
10007+ rdev2->saved_raid_disk = role;
999710008 ret = remove_and_add_spares(mddev, rdev2);
999810009 pr_info("Activated spare: %pg\n",
999910010 rdev2->bdev);
drivers/md/raid1.c+1−0
@@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, · 679 unmodified lines
680680 len = r1_bio->sectors;
681681 read_len = raid1_check_read_range(rdev, this_sector, &len);
682682 if (read_len == r1_bio->sectors) {
683+ *max_sectors = read_len;
683684 update_read_sectors(conf, disk, this_sector, read_len);
684685 return disk;
685686 }
drivers/s390/block/dasd_devmap.c+8−2
@@ -2248,13 +2248,19 @@ static ssize_t dasd_copy_pair_store(struct device *dev, · 2247 unmodified lines
22482248
22492249 /* allocate primary devmap if needed */
22502250 prim_devmap = dasd_find_busid(prim_busid);
2251− if (IS_ERR(prim_devmap))
2251+ if (IS_ERR(prim_devmap)) {
22522252 prim_devmap = dasd_add_busid(prim_busid, DASD_FEATURE_DEFAULT);
2253+ if (IS_ERR(prim_devmap))
2254+ return PTR_ERR(prim_devmap);
2255+ }
22532256
22542257 /* allocate secondary devmap if needed */
22552258 sec_devmap = dasd_find_busid(sec_busid);
2256− if (IS_ERR(sec_devmap))
2259+ if (IS_ERR(sec_devmap)) {
22572260 sec_devmap = dasd_add_busid(sec_busid, DASD_FEATURE_DEFAULT);
2261+ if (IS_ERR(sec_devmap))
2262+ return PTR_ERR(sec_devmap);
2263+ }
22582264
22592265 /* setting copy relation is only allowed for offline secondary */
22602266 if (sec_devmap->device)
drivers/s390/block/dasd_diag.c+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include "dasd_int.h"
3030 #include "dasd_diag.h"
3131
32+MODULE_DESCRIPTION("S/390 Support for DIAG access to DASD Disks");
3233 MODULE_LICENSE("GPL");
3334
3435 /* The maximum number of blocks per request (max_blocks) is dependent on the
drivers/s390/block/dasd_eckd.c+1−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444 /* 64k are 128 x 512 byte sectors */
4545 #define DASD_RAW_SECTORS_PER_TRACK 128
4646
47+MODULE_DESCRIPTION("S/390 DASD ECKD Disks device driver");
4748 MODULE_LICENSE("GPL");
4849
4950 static struct dasd_discipline dasd_eckd_discipline;
drivers/s390/block/dasd_fba.c+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #define DASD_FBA_CCW_LOCATE 0x43
3333 #define DASD_FBA_CCW_DEFINE_EXTENT 0x63
3434
35+MODULE_DESCRIPTION("S/390 DASD FBA Disks device driver");
3536 MODULE_LICENSE("GPL");
3637
3738 static struct dasd_discipline dasd_fba_discipline;
include/linux/blk-mq.h+78−49
@@ -27,38 +27,61 @@ typedef enum rq_end_io_ret (rq_end_io_fn)(struct request *, blk_status_t); · 26 unmodified lines
2727 * request flags */
2828 typedef __u32 __bitwise req_flags_t;
2929
30−/* drive already may have started this one */
31−#define RQF_STARTED ((__force req_flags_t)(1 << 1))
32−/* request for flush sequence */
33−#define RQF_FLUSH_SEQ ((__force req_flags_t)(1 << 4))
34−/* merge of different types, fail separately */
35−#define RQF_MIXED_MERGE ((__force req_flags_t)(1 << 5))
36−/* don't call prep for this one */
37−#define RQF_DONTPREP ((__force req_flags_t)(1 << 7))
38−/* use hctx->sched_tags */
39−#define RQF_SCHED_TAGS ((__force req_flags_t)(1 << 8))
40−/* use an I/O scheduler for this request */
41−#define RQF_USE_SCHED ((__force req_flags_t)(1 << 9))
42−/* vaguely specified driver internal error. Ignored by the block layer */
43−#define RQF_FAILED ((__force req_flags_t)(1 << 10))
44−/* don't warn about errors */
45−#define RQF_QUIET ((__force req_flags_t)(1 << 11))
46−/* account into disk and partition IO statistics */
47−#define RQF_IO_STAT ((__force req_flags_t)(1 << 13))
48−/* runtime pm request */
49−#define RQF_PM ((__force req_flags_t)(1 << 15))
50−/* on IO scheduler merge hash */
51−#define RQF_HASHED ((__force req_flags_t)(1 << 16))
52−/* track IO completion time */
53−#define RQF_STATS ((__force req_flags_t)(1 << 17))
54−/* Look at ->special_vec for the actual data payload instead of the
55− bio chain. */
56−#define RQF_SPECIAL_PAYLOAD ((__force req_flags_t)(1 << 18))
57−/* The request completion needs to be signaled to zone write pluging. */
58−#define RQF_ZONE_WRITE_PLUGGING ((__force req_flags_t)(1 << 20))
59−/* ->timeout has been called, don't expire again */
60−#define RQF_TIMED_OUT ((__force req_flags_t)(1 << 21))
61−#define RQF_RESV ((__force req_flags_t)(1 << 23))
30+/* Keep rqf_name[] in sync with the definitions below */
31+enum {
32+ /* drive already may have started this one */
33+ __RQF_STARTED,
34+ /* request for flush sequence */
35+ __RQF_FLUSH_SEQ,
36+ /* merge of different types, fail separately */
37+ __RQF_MIXED_MERGE,
38+ /* don't call prep for this one */
39+ __RQF_DONTPREP,
40+ /* use hctx->sched_tags */
41+ __RQF_SCHED_TAGS,
42+ /* use an I/O scheduler for this request */
43+ __RQF_USE_SCHED,
44+ /* vaguely specified driver internal error. Ignored by block layer */
45+ __RQF_FAILED,
46+ /* don't warn about errors */
47+ __RQF_QUIET,
48+ /* account into disk and partition IO statistics */
49+ __RQF_IO_STAT,
50+ /* runtime pm request */
51+ __RQF_PM,
52+ /* on IO scheduler merge hash */
53+ __RQF_HASHED,
54+ /* track IO completion time */
55+ __RQF_STATS,
56+ /* Look at ->special_vec for the actual data payload instead of the
57+ bio chain. */
58+ __RQF_SPECIAL_PAYLOAD,
59+ /* request completion needs to be signaled to zone write plugging. */
60+ __RQF_ZONE_WRITE_PLUGGING,
61+ /* ->timeout has been called, don't expire again */
62+ __RQF_TIMED_OUT,
63+ __RQF_RESV,
64+ __RQF_BITS
65+};
66+
67+#define RQF_STARTED ((__force req_flags_t)(1 << __RQF_STARTED))
68+#define RQF_FLUSH_SEQ ((__force req_flags_t)(1 << __RQF_FLUSH_SEQ))
69+#define RQF_MIXED_MERGE ((__force req_flags_t)(1 << __RQF_MIXED_MERGE))
70+#define RQF_DONTPREP ((__force req_flags_t)(1 << __RQF_DONTPREP))
71+#define RQF_SCHED_TAGS ((__force req_flags_t)(1 << __RQF_SCHED_TAGS))
72+#define RQF_USE_SCHED ((__force req_flags_t)(1 << __RQF_USE_SCHED))
73+#define RQF_FAILED ((__force req_flags_t)(1 << __RQF_FAILED))
74+#define RQF_QUIET ((__force req_flags_t)(1 << __RQF_QUIET))
75+#define RQF_IO_STAT ((__force req_flags_t)(1 << __RQF_IO_STAT))
76+#define RQF_PM ((__force req_flags_t)(1 << __RQF_PM))
77+#define RQF_HASHED ((__force req_flags_t)(1 << __RQF_HASHED))
78+#define RQF_STATS ((__force req_flags_t)(1 << __RQF_STATS))
79+#define RQF_SPECIAL_PAYLOAD \
80+ ((__force req_flags_t)(1 << __RQF_SPECIAL_PAYLOAD))
81+#define RQF_ZONE_WRITE_PLUGGING \
82+ ((__force req_flags_t)(1 << __RQF_ZONE_WRITE_PLUGGING))
83+#define RQF_TIMED_OUT ((__force req_flags_t)(1 << __RQF_TIMED_OUT))
84+#define RQF_RESV ((__force req_flags_t)(1 << __RQF_RESV))
6285
6386 /* flags that prevent us from merging requests: */
6487 #define RQF_NOMERGE_FLAGS \
@@ -278,8 +301,12 @@ enum blk_eh_timer_return { · 213 unmodified lines
278301 BLK_EH_RESET_TIMER,
279302 };
280303
281−#define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */
282−#define BLK_TAG_ALLOC_RR 1 /* allocate starting from last allocated tag */
304+/* Keep alloc_policy_name[] in sync with the definitions below */
305+enum {
306+ BLK_TAG_ALLOC_FIFO, /* allocate starting from 0 */
307+ BLK_TAG_ALLOC_RR, /* allocate starting from last allocated tag */
308+ BLK_TAG_ALLOC_MAX
309+};
283310
284311 /**
285312 * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware
@@ -644,6 +671,7 @@ struct blk_mq_ops { · 358 unmodified lines
644671 #endif
645672 };
646673
674+/* Keep hctx_flag_name[] in sync with the definitions below */
647675 enum {
648676 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
649677 BLK_MQ_F_TAG_QUEUE_SHARED = 1 << 1,
@@ -653,27 +681,17 @@ enum { · 3 unmodified lines
653681 */
654682 BLK_MQ_F_STACKING = 1 << 2,
655683 BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3,
656− BLK_MQ_F_BLOCKING = 1 << 5,
684+ BLK_MQ_F_BLOCKING = 1 << 4,
657685 /* Do not allow an I/O scheduler to be configured. */
658− BLK_MQ_F_NO_SCHED = 1 << 6,
686+ BLK_MQ_F_NO_SCHED = 1 << 5,
687+
659688 /*
660689 * Select 'none' during queue registration in case of a single hwq
661690 * or shared hwqs instead of 'mq-deadline'.
662691 */
663− BLK_MQ_F_NO_SCHED_BY_DEFAULT = 1 << 7,
664− BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
692+ BLK_MQ_F_NO_SCHED_BY_DEFAULT = 1 << 6,
693+ BLK_MQ_F_ALLOC_POLICY_START_BIT = 7,
665694 BLK_MQ_F_ALLOC_POLICY_BITS = 1,
666−
667− BLK_MQ_S_STOPPED = 0,
668− BLK_MQ_S_TAG_ACTIVE = 1,
669− BLK_MQ_S_SCHED_RESTART = 2,
670−
671− /* hw queue is inactive after all its CPUs become offline */
672− BLK_MQ_S_INACTIVE = 3,
673−
674− BLK_MQ_MAX_DEPTH = 10240,
675−
676− BLK_MQ_CPU_WORK_BATCH = 8,
677695 };
678696 #define BLK_MQ_FLAG_TO_ALLOC_POLICY(flags) \
679697 ((flags >> BLK_MQ_F_ALLOC_POLICY_START_BIT) & \
@@ -682,8 +700,19 @@ enum { · 2 unmodified lines
682700 ((policy & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \
683701 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
684702
703+#define BLK_MQ_MAX_DEPTH (10240)
685704 #define BLK_MQ_NO_HCTX_IDX (-1U)
686705
706+enum {
707+ /* Keep hctx_state_name[] in sync with the definitions below */
708+ BLK_MQ_S_STOPPED,
709+ BLK_MQ_S_TAG_ACTIVE,
710+ BLK_MQ_S_SCHED_RESTART,
711+ /* hw queue is inactive after all its CPUs become offline */
712+ BLK_MQ_S_INACTIVE,
713+ BLK_MQ_S_MAX
714+};
715+
687716 struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set,
688717 struct queue_limits *lim, void *queuedata,
689718 struct lock_class_key *lkclass);
include/linux/blk_types.h+1−0
@@ -354,6 +354,7 @@ enum req_op { · 353 unmodified lines
354354 REQ_OP_LAST = (__force blk_opf_t)36,
355355 };
356356
357+/* Keep cmd_flag_name[] in sync with the definitions below */
357358 enum req_flag_bits {
358359 __REQ_FAILFAST_DEV = /* no driver retries of device errors */
359360 REQ_OP_BITS,
include/linux/blkdev.h+16−15
@@ -588,27 +588,28 @@ struct request_queue { · 587 unmodified lines
588588 };
589589
590590 /* Keep blk_queue_flag_name[] in sync with the definitions below */
591−#define QUEUE_FLAG_STOPPED 0 /* queue is stopped */
592−#define QUEUE_FLAG_DYING 1 /* queue being torn down */
593−#define QUEUE_FLAG_NOMERGES 3 /* disable merge attempts */
594−#define QUEUE_FLAG_SAME_COMP 4 /* complete on same CPU-group */
595−#define QUEUE_FLAG_FAIL_IO 5 /* fake timeout */
596−#define QUEUE_FLAG_NOXMERGES 9 /* No extended merges */
597−#define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */
598−#define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */
599−#define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
600−#define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
601−#define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
602−#define QUEUE_FLAG_RQ_ALLOC_TIME 27 /* record rq->alloc_time_ns */
603−#define QUEUE_FLAG_HCTX_ACTIVE 28 /* at least one blk-mq hctx is active */
604−#define QUEUE_FLAG_SQ_SCHED 30 /* single queue style io dispatch */
591+enum {
592+ QUEUE_FLAG_DYING, /* queue being torn down */
593+ QUEUE_FLAG_NOMERGES, /* disable merge attempts */
594+ QUEUE_FLAG_SAME_COMP, /* complete on same CPU-group */
595+ QUEUE_FLAG_FAIL_IO, /* fake timeout */
596+ QUEUE_FLAG_NOXMERGES, /* No extended merges */
597+ QUEUE_FLAG_SAME_FORCE, /* force complete on same CPU */
598+ QUEUE_FLAG_INIT_DONE, /* queue is initialized */
599+ QUEUE_FLAG_STATS, /* track IO start and completion times */
600+ QUEUE_FLAG_REGISTERED, /* queue has been registered to a disk */
601+ QUEUE_FLAG_QUIESCED, /* queue has been quiesced */
602+ QUEUE_FLAG_RQ_ALLOC_TIME, /* record rq->alloc_time_ns */
603+ QUEUE_FLAG_HCTX_ACTIVE, /* at least one blk-mq hctx is active */
604+ QUEUE_FLAG_SQ_SCHED, /* single queue style io dispatch */
605+ QUEUE_FLAG_MAX
606+};
605607
606608 #define QUEUE_FLAG_MQ_DEFAULT (1UL << QUEUE_FLAG_SAME_COMP)
607609
608610 void blk_queue_flag_set(unsigned int flag, struct request_queue *q);
609611 void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);
610612
611−#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
612613 #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)
613614 #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags)
614615 #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
include/linux/cgroup-defs.h+0−3
@@ -539,9 +539,6 @@ struct cgroup { · 538 unmodified lines
539539 /* used to store eBPF programs */
540540 struct cgroup_bpf bpf;
541541
542− /* If there is block congestion on this cgroup. */
543− atomic_t congestion_count;
544−
545542 /* Used to store internal freezer state */
546543 struct cgroup_freezer_state freezer;
547544
include/linux/sbitmap.h+5−0
@@ -36,6 +36,11 @@ struct sbitmap_word { · 35 unmodified lines
3636 * @cleared: word holding cleared bits
3737 */
3838 unsigned long cleared ____cacheline_aligned_in_smp;
39+
40+ /**
41+ * @swap_lock: serializes simultaneous updates of ->word and ->cleared
42+ */
43+ spinlock_t swap_lock;
3944 } ____cacheline_aligned_in_smp;
4045
4146 /**
lib/sbitmap.c+29−7
@@ -60,12 +60,30 @@ static inline void update_alloc_hint_after_get(struct sbitmap *sb, · 59 unmodified lines
6060 /*
6161 * See if we have deferred clears that we can batch move
6262 */
63−static inline bool sbitmap_deferred_clear(struct sbitmap_word *map)
63+static inline bool sbitmap_deferred_clear(struct sbitmap_word *map,
64+ unsigned int depth, unsigned int alloc_hint, bool wrap)
6465 {
65− unsigned long mask;
66+ unsigned long mask, word_mask;
6667
67− if (!READ_ONCE(map->cleared))
68− return false;
68+ guard(spinlock_irqsave)(&map->swap_lock);
69+
70+ if (!map->cleared) {
71+ if (depth == 0)
72+ return false;
73+
74+ word_mask = (~0UL) >> (BITS_PER_LONG - depth);
75+ /*
76+ * The current behavior is to always retry after moving
77+ * ->cleared to word, and we change it to retry in case
78+ * of any free bits. To avoid an infinite loop, we need
79+ * to take wrap & alloc_hint into account, otherwise a
80+ * soft lockup may occur.
81+ */
82+ if (!wrap && alloc_hint)
83+ word_mask &= ~((1UL << alloc_hint) - 1);
84+
85+ return (READ_ONCE(map->word) & word_mask) != word_mask;
86+ }
6987
7088 /*
7189 * First get a stable cleared mask, setting the old mask to 0.
@@ -85,6 +103,7 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift, · 13 unmodified lines
85103 bool alloc_hint)
86104 {
87105 unsigned int bits_per_word;
106+ int i;
88107
89108 if (shift < 0)
90109 shift = sbitmap_calculate_shift(depth);
@@ -116,6 +135,9 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift, · 25 unmodified lines
116135 return -ENOMEM;
117136 }
118137
138+ for (i = 0; i < sb->map_nr; i++)
139+ spin_lock_init(&sb->map[i].swap_lock);
140+
119141 return 0;
120142 }
121143 EXPORT_SYMBOL_GPL(sbitmap_init_node);
@@ -126,7 +148,7 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth) · 4 unmodified lines
126148 unsigned int i;
127149
128150 for (i = 0; i < sb->map_nr; i++)
129− sbitmap_deferred_clear(&sb->map[i]);
151+ sbitmap_deferred_clear(&sb->map[i], 0, 0, 0);
130152
131153 sb->depth = depth;
132154 sb->map_nr = DIV_ROUND_UP(sb->depth, bits_per_word);
@@ -179,7 +201,7 @@ static int sbitmap_find_bit_in_word(struct sbitmap_word *map, · 46 unmodified lines
179201 alloc_hint, wrap);
180202 if (nr != -1)
181203 break;
182− if (!sbitmap_deferred_clear(map))
204+ if (!sbitmap_deferred_clear(map, depth, alloc_hint, wrap))
183205 break;
184206 } while (1);
185207
@@ -496,7 +518,7 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags, · 310 unmodified lines
496518 unsigned int map_depth = __map_depth(sb, index);
497519 unsigned long val;
498520
499− sbitmap_deferred_clear(map);
521+ sbitmap_deferred_clear(map, 0, 0, 0);
500522 val = READ_ONCE(map->word);
501523 if (val == (1UL << (map_depth - 1)) - 1)
502524 goto next;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t