Commit 08be8f07 authored by Peng Tao's avatar Peng Tao Committed by Greg Kroah-Hartman

nfs41: .init_read and .init_write can be called with valid pg_lseg

commit cb5d04bc upstream.

With pgio refactoring in v3.15, .init_read and .init_write can be
called with valid pgio->pg_lseg. file layout was fixed at that time
by commit c6194271 (pnfs: filelayout: support non page aligned
layouts). But the generic helper still needs to be fixed.
Signed-off-by: default avatarPeng Tao <tao.peng@primarydata.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 052f8db4
...@@ -1445,19 +1445,19 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r ...@@ -1445,19 +1445,19 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r
{ {
u64 rd_size = req->wb_bytes; u64 rd_size = req->wb_bytes;
WARN_ON_ONCE(pgio->pg_lseg != NULL); if (pgio->pg_lseg == NULL) {
if (pgio->pg_dreq == NULL)
if (pgio->pg_dreq == NULL) rd_size = i_size_read(pgio->pg_inode) - req_offset(req);
rd_size = i_size_read(pgio->pg_inode) - req_offset(req); else
else rd_size = nfs_dreq_bytes_left(pgio->pg_dreq);
rd_size = nfs_dreq_bytes_left(pgio->pg_dreq);
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, req->wb_context,
req->wb_context, req_offset(req),
req_offset(req), rd_size,
rd_size, IOMODE_READ,
IOMODE_READ, GFP_KERNEL);
GFP_KERNEL); }
/* If no lseg, fall back to read through mds */ /* If no lseg, fall back to read through mds */
if (pgio->pg_lseg == NULL) if (pgio->pg_lseg == NULL)
nfs_pageio_reset_read_mds(pgio); nfs_pageio_reset_read_mds(pgio);
...@@ -1469,14 +1469,13 @@ void ...@@ -1469,14 +1469,13 @@ void
pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,
struct nfs_page *req, u64 wb_size) struct nfs_page *req, u64 wb_size)
{ {
WARN_ON_ONCE(pgio->pg_lseg != NULL); if (pgio->pg_lseg == NULL)
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, req->wb_context,
req->wb_context, req_offset(req),
req_offset(req), wb_size,
wb_size, IOMODE_RW,
IOMODE_RW, GFP_NOFS);
GFP_NOFS);
/* If no lseg, fall back to write through mds */ /* If no lseg, fall back to write through mds */
if (pgio->pg_lseg == NULL) if (pgio->pg_lseg == NULL)
nfs_pageio_reset_write_mds(pgio); nfs_pageio_reset_write_mds(pgio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment