Message ID | 20180530194807.31657-12-longli@linuxonhyperv.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 5/30/2018 3:48 PM, Long Li wrote: > From: Long Li <longli@microsoft.com> > > When calculating signature for the packet, it needs to read into the > correct page offset for the data. > > Signed-off-by: Long Li <longli@microsoft.com> > --- > fs/cifs/cifsencrypt.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c > index a6ef088..e88303c 100644 > --- a/fs/cifs/cifsencrypt.c > +++ b/fs/cifs/cifsencrypt.c > @@ -68,11 +68,12 @@ int __cifs_calc_signature(struct smb_rqst *rqst, > > /* now hash over the rq_pages array */ > for (i = 0; i < rqst->rq_npages; i++) { > - void *kaddr = kmap(rqst->rq_pages[i]); > - size_t len = rqst->rq_pagesz; > + void *kaddr; > + unsigned int len, offset; > > - if (i == rqst->rq_npages - 1) > - len = rqst->rq_tailsz; > + rqst_page_get_length(rqst, i, &len, &offset); > + > + kaddr = (char *) kmap(rqst->rq_pages[i]) + offset; I suppose it's more robust to map a page at a time, but it's pretty expensive. Is this the only way to iterate over a potentially very large block of data? For example, a 1MB segment means 256 kmap/kunmaps. Tom. > > crypto_shash_update(shash, kaddr, len); > > -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Subject: Re: [Patch v2 11/15] CIFS: Pass page offset for calculating signature > > On 5/30/2018 3:48 PM, Long Li wrote: > > From: Long Li <longli@microsoft.com> > > > > When calculating signature for the packet, it needs to read into the > > correct page offset for the data. > > > > Signed-off-by: Long Li <longli@microsoft.com> > > --- > > fs/cifs/cifsencrypt.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index > > a6ef088..e88303c 100644 > > --- a/fs/cifs/cifsencrypt.c > > +++ b/fs/cifs/cifsencrypt.c > > @@ -68,11 +68,12 @@ int __cifs_calc_signature(struct smb_rqst *rqst, > > > > /* now hash over the rq_pages array */ > > for (i = 0; i < rqst->rq_npages; i++) { > > - void *kaddr = kmap(rqst->rq_pages[i]); > > - size_t len = rqst->rq_pagesz; > > + void *kaddr; > > + unsigned int len, offset; > > > > - if (i == rqst->rq_npages - 1) > > - len = rqst->rq_tailsz; > > + rqst_page_get_length(rqst, i, &len, &offset); > > + > > + kaddr = (char *) kmap(rqst->rq_pages[i]) + offset; > > I suppose it's more robust to map a page at a time, but it's pretty expensive. > Is this the only way to iterate over a potentially very large block of data? For > example, a 1MB segment means 256 kmap/kunmaps. I will look into not mapping those pages while doing I/O. This code path is for RDMA send/receive, and it's rarely used for transferring large amount of data. > > Tom. > > > > > crypto_shash_update(shash, kaddr, len); > > > >
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index a6ef088..e88303c 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -68,11 +68,12 @@ int __cifs_calc_signature(struct smb_rqst *rqst, /* now hash over the rq_pages array */ for (i = 0; i < rqst->rq_npages; i++) { - void *kaddr = kmap(rqst->rq_pages[i]); - size_t len = rqst->rq_pagesz; + void *kaddr; + unsigned int len, offset; - if (i == rqst->rq_npages - 1) - len = rqst->rq_tailsz; + rqst_page_get_length(rqst, i, &len, &offset); + + kaddr = (char *) kmap(rqst->rq_pages[i]) + offset; crypto_shash_update(shash, kaddr, len);