mirror of https://gitee.com/openkylin/linux.git
NFSv4.1: File layout only supports whole file layouts
Ask for whole file layouts. Until support for layout segments is fully supported in the file layout code, discard non-whole file layouts. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
47cb498e93
commit
7c24d9489f
|
@ -427,6 +427,14 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
|
|||
|
||||
dprintk("--> %s\n", __func__);
|
||||
|
||||
/* FIXME: remove this check when layout segment support is added */
|
||||
if (lgr->range.offset != 0 ||
|
||||
lgr->range.length != NFS4_MAX_UINT64) {
|
||||
dprintk("%s Only whole file layouts supported. Use MDS i/o\n",
|
||||
__func__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fl->pattern_offset > lgr->range.offset) {
|
||||
dprintk("%s pattern_offset %lld too large\n",
|
||||
__func__, fl->pattern_offset);
|
||||
|
@ -679,14 +687,49 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
|
|||
return (p_stripe == r_stripe);
|
||||
}
|
||||
|
||||
void
|
||||
filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
|
||||
struct nfs_page *req)
|
||||
{
|
||||
BUG_ON(pgio->pg_lseg != NULL);
|
||||
|
||||
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
|
||||
req->wb_context,
|
||||
0,
|
||||
NFS4_MAX_UINT64,
|
||||
IOMODE_READ,
|
||||
GFP_KERNEL);
|
||||
/* If no lseg, fall back to read through mds */
|
||||
if (pgio->pg_lseg == NULL)
|
||||
nfs_pageio_init_read_mds(pgio, pgio->pg_inode);
|
||||
}
|
||||
|
||||
void
|
||||
filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
struct nfs_page *req)
|
||||
{
|
||||
BUG_ON(pgio->pg_lseg != NULL);
|
||||
|
||||
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
|
||||
req->wb_context,
|
||||
0,
|
||||
NFS4_MAX_UINT64,
|
||||
IOMODE_RW,
|
||||
GFP_NOFS);
|
||||
/* If no lseg, fall back to write through mds */
|
||||
if (pgio->pg_lseg == NULL)
|
||||
nfs_pageio_init_write_mds(pgio, pgio->pg_inode,
|
||||
pgio->pg_ioflags);
|
||||
}
|
||||
|
||||
static const struct nfs_pageio_ops filelayout_pg_read_ops = {
|
||||
.pg_init = pnfs_generic_pg_init_read,
|
||||
.pg_init = filelayout_pg_init_read,
|
||||
.pg_test = filelayout_pg_test,
|
||||
.pg_doio = nfs_generic_pg_readpages,
|
||||
};
|
||||
|
||||
static const struct nfs_pageio_ops filelayout_pg_write_ops = {
|
||||
.pg_init = pnfs_generic_pg_init_write,
|
||||
.pg_init = filelayout_pg_init_write,
|
||||
.pg_test = filelayout_pg_test,
|
||||
.pg_doio = nfs_generic_pg_writepages,
|
||||
};
|
||||
|
|
|
@ -911,7 +911,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
|
|||
* Layout segment is retreived from the server if not cached.
|
||||
* The appropriate layout segment is referenced and returned to the caller.
|
||||
*/
|
||||
static struct pnfs_layout_segment *
|
||||
struct pnfs_layout_segment *
|
||||
pnfs_update_layout(struct inode *ino,
|
||||
struct nfs_open_context *ctx,
|
||||
loff_t pos,
|
||||
|
@ -980,7 +980,8 @@ pnfs_update_layout(struct inode *ino,
|
|||
arg.offset -= pg_offset;
|
||||
arg.length += pg_offset;
|
||||
}
|
||||
arg.length = PAGE_CACHE_ALIGN(arg.length);
|
||||
if (arg.length != NFS4_MAX_UINT64)
|
||||
arg.length = PAGE_CACHE_ALIGN(arg.length);
|
||||
|
||||
lseg = send_layoutget(lo, ctx, &arg, gfp_flags);
|
||||
if (!lseg && first) {
|
||||
|
@ -998,6 +999,7 @@ pnfs_update_layout(struct inode *ino,
|
|||
spin_unlock(&ino->i_lock);
|
||||
goto out;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_update_layout);
|
||||
|
||||
int
|
||||
pnfs_layout_process(struct nfs4_layoutget *lgp)
|
||||
|
|
|
@ -185,6 +185,12 @@ int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
|
|||
int _pnfs_return_layout(struct inode *);
|
||||
int pnfs_ld_write_done(struct nfs_write_data *);
|
||||
int pnfs_ld_read_done(struct nfs_read_data *);
|
||||
struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
|
||||
struct nfs_open_context *ctx,
|
||||
loff_t pos,
|
||||
u64 count,
|
||||
enum pnfs_iomode iomode,
|
||||
gfp_t gfp_flags);
|
||||
|
||||
/* pnfs_dev.c */
|
||||
struct nfs4_deviceid_node {
|
||||
|
|
|
@ -120,6 +120,7 @@ void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio,
|
|||
nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops,
|
||||
NFS_SERVER(inode)->rsize, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs_pageio_init_read_mds);
|
||||
|
||||
static void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
|
||||
struct inode *inode)
|
||||
|
|
|
@ -1046,6 +1046,7 @@ void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio,
|
|||
nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops,
|
||||
NFS_SERVER(inode)->wsize, ioflags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs_pageio_init_write_mds);
|
||||
|
||||
static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
struct inode *inode, int ioflags)
|
||||
|
|
Loading…
Reference in New Issue