@@ -296,7 +296,7 @@ extern int nfs_access_cache_shrinker(struct shrinker *shrink,
extern int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
const struct rpc_call_ops *call_ops);
extern void nfs_read_prepare(struct rpc_task *task, void *calldata);
-extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc,
+extern int nfs_pagein_one(struct nfs_pageio_descriptor *desc,
struct list_head *head);
extern void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio);
@@ -1356,7 +1356,7 @@ struct pnfs_layout_segment *
LIST_HEAD(head);
int ret;
- ret = nfs_generic_pagein(desc, &head);
+ ret = nfs_pagein_one(desc, &head);
if (ret != 0) {
put_lseg(desc->pg_lseg);
desc->pg_lseg = NULL;
@@ -336,7 +336,7 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc, struct list_head
return -ENOMEM;
}
-static int nfs_pagein_one(struct nfs_pageio_descriptor *desc, struct list_head *res)
+int nfs_pagein_one(struct nfs_pageio_descriptor *desc, struct list_head *res)
{
struct nfs_page *req;
struct page **pages;
@@ -369,19 +369,15 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc, struct list_head *
return ret;
}
-int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, struct list_head *head)
-{
- if (desc->pg_bsize < PAGE_CACHE_SIZE)
- return nfs_pagein_multi(desc, head);
- return nfs_pagein_one(desc, head);
-}
-
static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
{
LIST_HEAD(head);
int ret;
- ret = nfs_generic_pagein(desc, &head);
+ if (desc->pg_bsize < PAGE_CACHE_SIZE)
+ ret = nfs_pagein_multi(desc, &head);
+ else
+ ret = nfs_pagein_one(desc, &head);
if (ret == 0)
ret = nfs_do_multiple_reads(&head, desc->pg_rpc_callops);
return ret;
---------------------------------------------------------------
[2] (only writes)
Do not use nfs_pagein_multi() for layout drivers that
must not use it. (Objects and Blocks) ...
-------
@@ -68,6 +68,8 @@ enum {
enum layoutdriver_policy_flags {
/* Should the pNFS client commit and return the layout upon a setattr */
PNFS_LAYOUTRET_ON_SETATTR = 1 << 0,
+ /* Do not use nfs_xxx_partial_ops */
+ PNFS_IGNOR_RWSIZE = 2 << 0,
};
struct nfs4_deviceid_node;
@@ -315,6 +317,15 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req)
PNFS_LAYOUTRET_ON_SETATTR;
}
+static inline bool
+pnfs_ld_ignore_rwsize(struct inode *inode)
+{
+ if (!pnfs_enabled_sb(NFS_SERVER(inode)))
+ return false;
+ return NFS_SERVER(inode)->pnfs_curr_ld->flags &
+ PNFS_IGNOR_RWSIZE;
+}
+
static inline int pnfs_return_layout(struct inode *ino)
{
struct nfs_inode *nfsi = NFS_I(ino);
@@ -1029,7 +1029,8 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc, struct list_head *r
int nfs_generic_flush(struct nfs_pageio_descriptor *desc, struct list_head *head)
{
- if (desc->pg_bsize < PAGE_CACHE_SIZE)
+ if (!pnfs_ld_ignore_rwsize(desc->pg_inode) &&
+ desc->pg_bsize < PAGE_CACHE_SIZE)
return nfs_flush_multi(desc, head);
return nfs_flush_one(desc, head);
}