diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2020-11-14 00:57:44 +0300 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2021-03-22 17:18:59 +0300 |
commit | 8141d6a2bb6c655ff0c0b81ced80d9025f03e926 (patch) | |
tree | 0520451d1f3fdac50bdd3caa9e69de184463b0b8 /fs/nfsd/nfsxdr.c | |
parent | d52532002ffa217ad3fa4c3ba86c95203d21dd21 (diff) | |
download | linux-8141d6a2bb6c655ff0c0b81ced80d9025f03e926.tar.xz |
NFSD: Count bytes instead of pages in the NFSv2 READDIR encoder
Clean up: Counting the bytes used by each returned directory entry
seems less brittle to me than trying to measure consumed pages after
the fact.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfsxdr.c')
-rw-r--r-- | fs/nfsd/nfsxdr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index a87b21cfe0d0..8ae23ed6dc5d 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -584,7 +584,7 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p) p = resp->buffer; *p++ = 0; /* no more entries */ *p++ = htonl((resp->common.err == nfserr_eof)); - rqstp->rq_res.page_len = (((unsigned long)p-1) & ~PAGE_MASK)+1; + rqstp->rq_res.page_len = resp->count << 2; return 1; } @@ -667,6 +667,7 @@ nfssvc_encode_entry(void *ccdv, const char *name, cd->offset = p; /* remember pointer */ *p++ = htonl(~0U); /* offset of next entry */ + cd->count += p - cd->buffer; cd->buflen = buflen; cd->buffer = p; cd->common.err = nfs_ok; |