On Wed, May 8, 2024 at 10:50 AM Benjamin Coddington <bcodding@xxxxxxxxxx> wrote: > > On 7 May 2024, at 15:59, Olga Kornievskaia wrote: > > > From: Olga Kornievskaia <kolga@xxxxxxxxxx> > > > > Before doing the IO, check that we have the layout covering the range of > > IO. > > > > Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx> > > --- > > fs/nfs/filelayout/filelayout.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c > > index 85d2dc9bc212..bf3ba2e98f33 100644 > > --- a/fs/nfs/filelayout/filelayout.c > > +++ b/fs/nfs/filelayout/filelayout.c > > @@ -868,6 +868,7 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio, > > struct nfs_page *req) > > { > > pnfs_generic_pg_check_layout(pgio); > > + pnfs_generic_pg_check_range(pgio, req); > > if (!pgio->pg_lseg) { > > pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode, > > nfs_req_openctx(req), > > @@ -892,6 +893,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio, > > struct nfs_page *req) > > { > > pnfs_generic_pg_check_layout(pgio); > > + pnfs_generic_pg_check_range(pgio, req); > > if (!pgio->pg_lseg) { > > pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode, > > nfs_req_openctx(req), > > -- > > 2.39.1 > > Looks right, less duplication to just call pnfs_generic_pg_check_range() > from pnfs_generic_pg_check_layout() now. filelayout.c is not the only caller of pnfs_generic_pg_check_layout(). flexfilelayout has a wrapper around those 2 functions and calls that. however, the argument about duplicated code frustrates me because currently the code has 4lines. but if we were to re-write the same with a function, it would be more lines used in total (flexfiles has 8 lines for it). > > Reviewed-by: Benjamin Coddington <bcodding@xxxxxxxxxx> > > Ben >