diff mbox

[RFC,1/3] lightnvm: check mm before use

Message ID 1449058583-27940-1-git-send-email-m@bjorling.me (mailing list archive)
State New, archived
Headers show

Commit Message

Matias Bjorling Dec. 2, 2015, 12:16 p.m. UTC
The core can initialize I/Os before a media manager is registered with
the lightnvm subsystem. Make sure that we don't call the media manager
prematurely.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/nvme/host/lightnvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wenwei Tao Dec. 4, 2015, 8:02 a.m. UTC | #1
2015-12-02 20:16 GMT+08:00 Matias Bjørling <m@bjorling.me>:
> The core can initialize I/Os before a media manager is registered with
> the lightnvm subsystem. Make sure that we don't call the media manager
> prematurely.
>
> Signed-off-by: Matias Bjørling <m@bjorling.me>
> ---
>  drivers/nvme/host/lightnvm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index 06c3364..762c9a7 100644
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -455,7 +455,7 @@ static void nvme_nvm_end_io(struct request *rq, int error)
>         struct nvm_rq *rqd = rq->end_io_data;
>         struct nvm_dev *dev = rqd->dev;
>
> -       if (dev->mt->end_io(rqd, error))
> +       if (dev->mt && dev->mt->end_io(rqd, error))

Is there any chance core can initialize IOs on device without register
with a media manger ?
In my understanding core cannot create target on device without a
media manger, if core doesn't have a target how can core initialize
IOs on these devices?  If I'm wrong about this, please correct me.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matias Bjorling Dec. 4, 2015, 9:51 a.m. UTC | #2
> Is there any chance core can initialize IOs on device without register
> with a media manger ?
> In my understanding core cannot create target on device without a
> media manger, if core doesn't have a target how can core initialize
> IOs on these devices?  If I'm wrong about this, please correct me.
>

You're right. This is preparation patches for system blocks. The core 
gets features added to work with the device, before gennvm is 
initialized. For that case, no media manager will have been initialized, 
and we therefore can't call it.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 06c3364..762c9a7 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -455,7 +455,7 @@  static void nvme_nvm_end_io(struct request *rq, int error)
 	struct nvm_rq *rqd = rq->end_io_data;
 	struct nvm_dev *dev = rqd->dev;
 
-	if (dev->mt->end_io(rqd, error))
+	if (dev->mt && dev->mt->end_io(rqd, error))
 		pr_err("nvme: err status: %x result: %lx\n",
 				rq->errors, (unsigned long)rq->special);