[dm-devel] [PATCH v6 1/6] pmem: Add functions for reading/writing page to/from pmem
Vivek Goyal
vgoyal at redhat.com
Wed Mar 4 18:44:41 UTC 2020
On Sat, Feb 29, 2020 at 09:04:00AM +0100, Pankaj Gupta wrote:
> On Fri, 28 Feb 2020 at 17:35, Vivek Goyal <vgoyal at redhat.com> wrote:
> >
> > This splits pmem_do_bvec() into pmem_do_read() and pmem_do_write().
> > pmem_do_write() will be used by pmem zero_page_range() as well. Hence
> > sharing the same code.
> >
> > Suggested-by: Christoph Hellwig <hch at infradead.org>
> > Reviewed-by: Christoph Hellwig <hch at lst.de>
> > Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
> > ---
> > drivers/nvdimm/pmem.c | 86 +++++++++++++++++++++++++------------------
> > 1 file changed, 50 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> > index 4eae441f86c9..075b11682192 100644
> > --- a/drivers/nvdimm/pmem.c
> > +++ b/drivers/nvdimm/pmem.c
> > @@ -136,9 +136,25 @@ static blk_status_t read_pmem(struct page *page, unsigned int off,
> > return BLK_STS_OK;
> > }
> >
> > -static blk_status_t pmem_do_bvec(struct pmem_device *pmem, struct page *page,
> > - unsigned int len, unsigned int off, unsigned int op,
> > - sector_t sector)
> > +static blk_status_t pmem_do_read(struct pmem_device *pmem,
> > + struct page *page, unsigned int page_off,
> > + sector_t sector, unsigned int len)
> > +{
> > + blk_status_t rc;
> > + phys_addr_t pmem_off = sector * 512 + pmem->data_offset;
>
> minor nit, maybe 512 is replaced by macro? Looks like its used at multiple
> places, maybe can keep at is for now.
This came from existing code. If I end up spinning this patch series
again, I will replace it with (sector << SECTOR_SHIFT).
Thanks
Vivek
More information about the dm-devel
mailing list