Skip to content

Commit 3e1e21c

Browse files
committed
Merge branch 'for-4.5/nvme' of git://git.kernel.dk/linux-block
Pull NVMe updates from Jens Axboe: "Last branch for this series is the nvme changes. It's in a separate branch to avoid splitting too much between core and NVMe changes, since NVMe is still helping drive some blk-mq changes. That said, not a huge amount of core changes in here. The grunt of the work is the continued split of the code" * 'for-4.5/nvme' of git://git.kernel.dk/linux-block: (67 commits) uapi: update install list after nvme.h rename NVMe: Export NVMe attributes to sysfs group NVMe: Shutdown controller only for power-off NVMe: IO queue deletion re-write NVMe: Remove queue freezing on resets NVMe: Use a retryable error code on reset NVMe: Fix admin queue ring wrap nvme: make SG_IO support optional nvme: fixes for NVME_IOCTL_IO_CMD on the char device nvme: synchronize access to ctrl->namespaces nvme: Move nvme_freeze/unfreeze_queues to nvme core PCI/AER: include header file NVMe: Export namespace attributes to sysfs NVMe: Add pci error handlers block: remove REQ_NO_TIMEOUT flag nvme: merge iod and cmd_info nvme: meta_sg doesn't have to be an array nvme: properly free resources for cancelled command nvme: simplify completion handling nvme: special case AEN requests ...
2 parents 0a13dae + a9cf828 commit 3e1e21c

File tree

19 files changed

+2608
-2209
lines changed

19 files changed

+2608
-2209
lines changed

block/bio-integrity.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
6666
}
6767

6868
if (unlikely(!bip))
69-
return NULL;
69+
return ERR_PTR(-ENOMEM);
7070

7171
memset(bip, 0, sizeof(*bip));
7272

@@ -89,7 +89,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
8989
return bip;
9090
err:
9191
mempool_free(bip, bs->bio_integrity_pool);
92-
return NULL;
92+
return ERR_PTR(-ENOMEM);
9393
}
9494
EXPORT_SYMBOL(bio_integrity_alloc);
9595

@@ -298,10 +298,10 @@ int bio_integrity_prep(struct bio *bio)
298298

299299
/* Allocate bio integrity payload and integrity vectors */
300300
bip = bio_integrity_alloc(bio, GFP_NOIO, nr_pages);
301-
if (unlikely(bip == NULL)) {
301+
if (IS_ERR(bip)) {
302302
printk(KERN_ERR "could not allocate data integrity bioset\n");
303303
kfree(buf);
304-
return -EIO;
304+
return PTR_ERR(bip);
305305
}
306306

307307
bip->bip_flags |= BIP_BLOCK_INTEGRITY;
@@ -465,9 +465,8 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
465465
BUG_ON(bip_src == NULL);
466466

467467
bip = bio_integrity_alloc(bio, gfp_mask, bip_src->bip_vcnt);
468-
469-
if (bip == NULL)
470-
return -EIO;
468+
if (IS_ERR(bip))
469+
return PTR_ERR(bip);
471470

472471
memcpy(bip->bip_vec, bip_src->bip_vec,
473472
bip_src->bip_vcnt * sizeof(struct bio_vec));

block/blk-core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,13 @@ static void blk_queue_usage_counter_release(struct percpu_ref *ref)
680680
wake_up_all(&q->mq_freeze_wq);
681681
}
682682

683+
static void blk_rq_timed_out_timer(unsigned long data)
684+
{
685+
struct request_queue *q = (struct request_queue *)data;
686+
687+
kblockd_schedule_work(&q->timeout_work);
688+
}
689+
683690
struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
684691
{
685692
struct request_queue *q;
@@ -841,6 +848,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
841848
if (blk_init_rl(&q->root_rl, q, GFP_KERNEL))
842849
goto fail;
843850

851+
INIT_WORK(&q->timeout_work, blk_timeout_work);
844852
q->request_fn = rfn;
845853
q->prep_rq_fn = NULL;
846854
q->unprep_rq_fn = NULL;

block/blk-mq.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,6 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
603603
blk_mq_complete_request(rq, -EIO);
604604
return;
605605
}
606-
if (rq->cmd_flags & REQ_NO_TIMEOUT)
607-
return;
608606

609607
if (time_after_eq(jiffies, rq->deadline)) {
610608
if (!blk_mark_rq_complete(rq))
@@ -615,15 +613,19 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
615613
}
616614
}
617615

618-
static void blk_mq_rq_timer(unsigned long priv)
616+
static void blk_mq_timeout_work(struct work_struct *work)
619617
{
620-
struct request_queue *q = (struct request_queue *)priv;
618+
struct request_queue *q =
619+
container_of(work, struct request_queue, timeout_work);
621620
struct blk_mq_timeout_data data = {
622621
.next = 0,
623622
.next_set = 0,
624623
};
625624
int i;
626625

626+
if (blk_queue_enter(q, true))
627+
return;
628+
627629
blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &data);
628630

629631
if (data.next_set) {
@@ -638,6 +640,7 @@ static void blk_mq_rq_timer(unsigned long priv)
638640
blk_mq_tag_idle(hctx);
639641
}
640642
}
643+
blk_queue_exit(q);
641644
}
642645

643646
/*
@@ -2008,7 +2011,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
20082011
hctxs[i]->queue_num = i;
20092012
}
20102013

2011-
setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q);
2014+
INIT_WORK(&q->timeout_work, blk_mq_timeout_work);
20122015
blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30 * HZ);
20132016

20142017
q->nr_queues = nr_cpu_ids;

block/blk-timeout.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ static void blk_rq_check_expired(struct request *rq, unsigned long *next_timeout
127127
}
128128
}
129129

130-
void blk_rq_timed_out_timer(unsigned long data)
130+
void blk_timeout_work(struct work_struct *work)
131131
{
132-
struct request_queue *q = (struct request_queue *) data;
132+
struct request_queue *q =
133+
container_of(work, struct request_queue, timeout_work);
133134
unsigned long flags, next = 0;
134135
struct request *rq, *tmp;
135136
int next_set = 0;
136137

138+
if (blk_queue_enter(q, true))
139+
return;
137140
spin_lock_irqsave(q->queue_lock, flags);
138141

139142
list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)
@@ -143,6 +146,7 @@ void blk_rq_timed_out_timer(unsigned long data)
143146
mod_timer(&q->timeout, round_jiffies_up(next));
144147

145148
spin_unlock_irqrestore(q->queue_lock, flags);
149+
blk_queue_exit(q);
146150
}
147151

148152
/**
@@ -193,9 +197,6 @@ void blk_add_timer(struct request *req)
193197
struct request_queue *q = req->q;
194198
unsigned long expiry;
195199

196-
if (req->cmd_flags & REQ_NO_TIMEOUT)
197-
return;
198-
199200
/* blk-mq has its own handler, so we don't need ->rq_timed_out_fn */
200201
if (!q->mq_ops && !q->rq_timed_out_fn)
201202
return;

block/blk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static inline void blk_flush_integrity(void)
9393
}
9494
#endif
9595

96-
void blk_rq_timed_out_timer(unsigned long data);
96+
void blk_timeout_work(struct work_struct *work);
9797
unsigned long blk_rq_timeout(unsigned long timeout);
9898
void blk_add_timer(struct request *req);
9999
void blk_delete_timer(struct request *);

drivers/nvme/host/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ config BLK_DEV_NVME
88

99
To compile this driver as a module, choose M here: the
1010
module will be called nvme.
11+
12+
config BLK_DEV_NVME_SCSI
13+
bool "SCSI emulation for NVMe device nodes"
14+
depends on BLK_DEV_NVME
15+
---help---
16+
This adds support for the SG_IO ioctl on the NVMe character
17+
and block devices nodes, as well a a translation for a small
18+
number of selected SCSI commands to NVMe commands to the NVMe
19+
driver. If you don't know what this means you probably want
20+
to say N here, and if you know what it means you probably
21+
want to say N as well.

drivers/nvme/host/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
obj-$(CONFIG_BLK_DEV_NVME) += nvme.o
33

4-
lightnvm-$(CONFIG_NVM) := lightnvm.o
5-
nvme-y += pci.o scsi.o $(lightnvm-y)
4+
lightnvm-$(CONFIG_NVM) := lightnvm.o
5+
nvme-y += core.o pci.o $(lightnvm-y)
6+
nvme-$(CONFIG_BLK_DEV_NVME_SCSI) += scsi.o

0 commit comments

Comments
 (0)