[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAC5umyh6hdcAnTCDK=7nX8VxFz7LiFY6ttUmcBPXfmXN4r88rw@mail.gmail.com>
Date: Tue, 14 May 2019 23:06:21 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>
Cc: "minwoo.im@...sung.com" <minwoo.im@...sung.com>,
"linux-nvme@...ts.infradead.org" <linux-nvme@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Keith Busch <keith.busch@...el.com>,
Sagi Grimberg <sagi@...mberg.me>,
Kenneth Heitke <kenneth.heitke@...el.com>,
Jens Axboe <axboe@...com>, Minwoo Im <minwoo.im.dev@...il.com>,
Johannes Berg <johannes@...solutions.net>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v3 5/7] nvme-pci: add device coredump infrastructure
2019年5月14日(火) 0:23 Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>:
>
> On 05/13/2019 12:46 AM, Minwoo Im wrote:
> >> +static int nvme_get_telemetry_log_blocks(struct nvme_ctrl *ctrl, void *buf,
> >> + size_t bytes, loff_t offset)
> >> +{
> >> + loff_t pos = 0;
> >> + u32 chunk_size;
> >> +
> >> + if (check_mul_overflow(ctrl->max_hw_sectors, 512u, &chunk_size))
> >> + chunk_size = UINT_MAX;
> >> +
> >> + while (pos < bytes) {
> >> + size_t size = min_t(size_t, bytes - pos, chunk_size);
> >> + int ret;
> >> +
> >> + ret = nvme_get_log(ctrl, NVME_NSID_ALL,
> >> NVME_LOG_TELEMETRY_CTRL,
> >> + 0, buf + pos, size, offset + pos);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + pos += size;
> >> + }
> >> +
> >> + return 0;
> >> +}
> >> +
> >> +static int nvme_get_telemetry_log(struct nvme_ctrl *ctrl,
> >> + struct sg_table *table, size_t bytes)
> >> +{
> >> + int n = sg_nents(table->sgl);
> >> + struct scatterlist *sg;
> >> + size_t offset = 0;
> >> + int i;
> >> +
> A little comment would be nice if you are using sg operations.
> >> + for_each_sg(table->sgl, sg, n, i) {
> >> + struct page *page = sg_page(sg);
> >> + size_t size = min_t(int, bytes - offset, sg->length);
> >> + int ret;
> >> +
> >> + ret = nvme_get_telemetry_log_blocks(ctrl,
> >> page_address(page),
> >> + size, offset);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + offset += size;
> >> + }
> >> +
> >> + return 0;
> >> +}
> >
> > Can we have those two in nvme-core module instead of being in pci module?
>
> Since they are based on the controller they should be moved next to
> nvme_get_log() in the ${KERN_DIR}/drivers/nvme/host/core.c.
OK. But these functions will be changed to use bio_vec instead of sg in
the next version.
Powered by blists - more mailing lists