[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210223233809epcms2p1482aac5e531d692f00cf0fc5ee8c7f4a@epcms2p1>
Date: Wed, 24 Feb 2021 08:38:09 +0900
From: Daejun Park <daejun7.park@...sung.com>
To: Avri Altman <Avri.Altman@....com>,
Daejun Park <daejun7.park@...sung.com>,
Greg KH <gregkh@...uxfoundation.org>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
"cang@...eaurora.org" <cang@...eaurora.org>,
"bvanassche@....org" <bvanassche@....org>,
"huobean@...il.com" <huobean@...il.com>,
ALIM AKHTAR <alim.akhtar@...sung.com>,
Javier Gonzalez <javier.gonz@...sung.com>
CC: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
JinHwan Park <jh.i.park@...sung.com>,
SEUNGUK SHIN <seunguk.shin@...sung.com>,
Sung-Jun Park <sungjun07.park@...sung.com>,
yongmyung lee <ymhungry.lee@...sung.com>,
Jinyoung CHOI <j-young.choi@...sung.com>,
BoRam Shin <boram.shin@...sung.com>
Subject: RE: RE: [PATCH v22 3/4] scsi: ufs: Prepare HPB read for cached
sub-region
> > +static int ufshpb_fill_ppn_from_page(struct ufshpb_lu *hpb,
> > + struct ufshpb_map_ctx *mctx, int pos,
> > + int len, u64 *ppn_buf)
> > +{
> > + struct page *page;
> > + int index, offset;
> > + int copied;
> > +
> > + index = pos / (PAGE_SIZE / HPB_ENTRY_SIZE);
> > + offset = pos % (PAGE_SIZE / HPB_ENTRY_SIZE);
> Maybe cache hpb->entries_per_page in ufshpb_lu_parameter_init as well?
They are just defined constants and complier will optimize them.
Thanks,
Daejun
> > +
> > + if ((offset + len) <= (PAGE_SIZE / HPB_ENTRY_SIZE))
> > + copied = len;
> > + else
> > + copied = (PAGE_SIZE / HPB_ENTRY_SIZE) - offset;
> > +
> > + page = mctx->m_page[index];
> > + if (unlikely(!page)) {
> > + dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> > + "error. cannot find page in mctx\n");
> > + return -ENOMEM;
> > + }
> > +
> > + memcpy(ppn_buf, page_address(page) + (offset * HPB_ENTRY_SIZE),
> > + copied * HPB_ENTRY_SIZE);
> > +
> > + return copied;
> > +}
>
>
>
Powered by blists - more mailing lists