Skip to content

Commit a58dfea

Browse files
committed
Merge tag 'block-5.8-2020-06-11' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "Some followup fixes for this merge window. In particular: - Seqcount write missing preemption disable for stats (Ahmed) - blktrace fixes (Chaitanya) - Redundant initializations (Colin) - Various small NVMe fixes (Chaitanya, Christoph, Daniel, Max, Niklas, Rikard) - loop flag bug regression fix (Martijn) - blk-mq tagging fixes (Christoph, Ming)" * tag 'block-5.8-2020-06-11' of git://git.kernel.dk/linux-block: umem: remove redundant initialization of variable ret pktcdvd: remove redundant initialization of variable ret nvmet: fail outstanding host posted AEN req nvme-pci: use simple suspend when a HMB is enabled nvme-fc: don't call nvme_cleanup_cmd() for AENs nvmet-tcp: constify nvmet_tcp_ops nvme-tcp: constify nvme_tcp_mq_ops and nvme_tcp_admin_mq_ops nvme: do not call del_gendisk() on a disk that was never added blk-mq: fix blk_mq_all_tag_iter blk-mq: split out a __blk_mq_get_driver_tag helper blktrace: fix endianness for blk_log_remap() blktrace: fix endianness in get_pdu_int() blktrace: use errno instead of bi_status block: nr_sects_write(): Disable preemption on seqcount write block: remove the error argument to the block_bio_complete tracepoint loop: Fix wrong masking of status flags block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed
2 parents b359794 + 9a6a573 commit a58dfea

File tree

19 files changed

+104
-84
lines changed

19 files changed

+104
-84
lines changed

block/bio-integrity.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ bool bio_integrity_prep(struct bio *bio)
281281

282282
if (ret == 0) {
283283
printk(KERN_ERR "could not attach integrity payload\n");
284-
kfree(buf);
285284
status = BLK_STS_RESOURCE;
286285
goto err_end_io;
287286
}

block/bio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,8 +1434,7 @@ void bio_endio(struct bio *bio)
14341434
}
14351435

14361436
if (bio->bi_disk && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
1437-
trace_block_bio_complete(bio->bi_disk->queue, bio,
1438-
blk_status_to_errno(bio->bi_status));
1437+
trace_block_bio_complete(bio->bi_disk->queue, bio);
14391438
bio_clear_flag(bio, BIO_TRACE_COMPLETION);
14401439
}
14411440

block/blk-mq-tag.c

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,33 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
191191
return tag + tag_offset;
192192
}
193193

194+
bool __blk_mq_get_driver_tag(struct request *rq)
195+
{
196+
struct sbitmap_queue *bt = &rq->mq_hctx->tags->bitmap_tags;
197+
unsigned int tag_offset = rq->mq_hctx->tags->nr_reserved_tags;
198+
bool shared = blk_mq_tag_busy(rq->mq_hctx);
199+
int tag;
200+
201+
if (blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags, rq->internal_tag)) {
202+
bt = &rq->mq_hctx->tags->breserved_tags;
203+
tag_offset = 0;
204+
}
205+
206+
if (!hctx_may_queue(rq->mq_hctx, bt))
207+
return false;
208+
tag = __sbitmap_queue_get(bt);
209+
if (tag == BLK_MQ_NO_TAG)
210+
return false;
211+
212+
rq->tag = tag + tag_offset;
213+
if (shared) {
214+
rq->rq_flags |= RQF_MQ_INFLIGHT;
215+
atomic_inc(&rq->mq_hctx->nr_active);
216+
}
217+
rq->mq_hctx->tags->rqs[rq->tag] = rq;
218+
return true;
219+
}
220+
194221
void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx,
195222
unsigned int tag)
196223
{
@@ -269,6 +296,7 @@ struct bt_tags_iter_data {
269296

270297
#define BT_TAG_ITER_RESERVED (1 << 0)
271298
#define BT_TAG_ITER_STARTED (1 << 1)
299+
#define BT_TAG_ITER_STATIC_RQS (1 << 2)
272300

273301
static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
274302
{
@@ -282,9 +310,12 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
282310

283311
/*
284312
* We can hit rq == NULL here, because the tagging functions
285-
* test and set the bit before assining ->rqs[].
313+
* test and set the bit before assigning ->rqs[].
286314
*/
287-
rq = tags->rqs[bitnr];
315+
if (iter_data->flags & BT_TAG_ITER_STATIC_RQS)
316+
rq = tags->static_rqs[bitnr];
317+
else
318+
rq = tags->rqs[bitnr];
288319
if (!rq)
289320
return true;
290321
if ((iter_data->flags & BT_TAG_ITER_STARTED) &&
@@ -339,11 +370,13 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
339370
* indicates whether or not @rq is a reserved request. Return
340371
* true to continue iterating tags, false to stop.
341372
* @priv: Will be passed as second argument to @fn.
373+
*
374+
* Caller has to pass the tag map from which requests are allocated.
342375
*/
343376
void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
344377
void *priv)
345378
{
346-
return __blk_mq_all_tag_iter(tags, fn, priv, 0);
379+
return __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS);
347380
}
348381

349382
/**

block/blk-mq-tag.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ enum {
5151
BLK_MQ_TAG_MAX = BLK_MQ_NO_TAG - 1,
5252
};
5353

54+
bool __blk_mq_get_driver_tag(struct request *rq);
55+
static inline bool blk_mq_get_driver_tag(struct request *rq)
56+
{
57+
if (rq->tag != BLK_MQ_NO_TAG)
58+
return true;
59+
return __blk_mq_get_driver_tag(rq);
60+
}
61+
5462
extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
5563
extern void __blk_mq_tag_idle(struct blk_mq_hw_ctx *);
5664

block/blk-mq.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,35 +1052,6 @@ static inline unsigned int queued_to_index(unsigned int queued)
10521052
return min(BLK_MQ_MAX_DISPATCH_ORDER - 1, ilog2(queued) + 1);
10531053
}
10541054

1055-
bool blk_mq_get_driver_tag(struct request *rq)
1056-
{
1057-
struct blk_mq_alloc_data data = {
1058-
.q = rq->q,
1059-
.hctx = rq->mq_hctx,
1060-
.flags = BLK_MQ_REQ_NOWAIT,
1061-
.cmd_flags = rq->cmd_flags,
1062-
};
1063-
bool shared;
1064-
1065-
if (rq->tag != BLK_MQ_NO_TAG)
1066-
return true;
1067-
1068-
if (blk_mq_tag_is_reserved(data.hctx->sched_tags, rq->internal_tag))
1069-
data.flags |= BLK_MQ_REQ_RESERVED;
1070-
1071-
shared = blk_mq_tag_busy(data.hctx);
1072-
rq->tag = blk_mq_get_tag(&data);
1073-
if (rq->tag >= 0) {
1074-
if (shared) {
1075-
rq->rq_flags |= RQF_MQ_INFLIGHT;
1076-
atomic_inc(&data.hctx->nr_active);
1077-
}
1078-
data.hctx->tags->rqs[rq->tag] = rq;
1079-
}
1080-
1081-
return rq->tag != BLK_MQ_NO_TAG;
1082-
}
1083-
10841055
static int blk_mq_dispatch_wake(wait_queue_entry_t *wait, unsigned mode,
10851056
int flags, void *key)
10861057
{

block/blk-mq.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ bool blk_mq_dispatch_rq_list(struct request_queue *, struct list_head *, bool);
4444
void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
4545
bool kick_requeue_list);
4646
void blk_mq_flush_busy_ctxs(struct blk_mq_hw_ctx *hctx, struct list_head *list);
47-
bool blk_mq_get_driver_tag(struct request *rq);
4847
struct request *blk_mq_dequeue_from_ctx(struct blk_mq_hw_ctx *hctx,
4948
struct blk_mq_ctx *start);
5049

block/blk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part)
420420
static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
421421
{
422422
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
423+
preempt_disable();
423424
write_seqcount_begin(&part->nr_sects_seq);
424425
part->nr_sects = size;
425426
write_seqcount_end(&part->nr_sects_seq);
427+
preempt_enable();
426428
#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
427429
preempt_disable();
428430
part->nr_sects = size;

drivers/block/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
13901390
goto out_unfreeze;
13911391

13921392
/* Mask out flags that can't be set using LOOP_SET_STATUS. */
1393-
lo->lo_flags &= ~LOOP_SET_STATUS_SETTABLE_FLAGS;
1393+
lo->lo_flags &= LOOP_SET_STATUS_SETTABLE_FLAGS;
13941394
/* For those flags, use the previous values instead */
13951395
lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_SETTABLE_FLAGS;
13961396
/* For flags that can't be cleared, use previous values too */

drivers/block/pktcdvd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ static noinline_for_stack int pkt_get_last_written(struct pktcdvd_device *pd,
16131613
disc_information di;
16141614
track_information ti;
16151615
__u32 last_track;
1616-
int ret = -1;
1616+
int ret;
16171617

16181618
ret = pkt_get_disc_info(pd, &di);
16191619
if (ret)

drivers/block/umem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ static const struct block_device_operations mm_fops = {
784784

785785
static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
786786
{
787-
int ret = -ENODEV;
787+
int ret;
788788
struct cardinfo *card = &cards[num_cards];
789789
unsigned char mem_present;
790790
unsigned char batt_status;

0 commit comments

Comments
 (0)