Commit fbe77c30 authored by Benjamin Coddington's avatar Benjamin Coddington Committed by Trond Myklebust

NFS: move rw_mode to nfs_pageio_header

Let's try to have it in a cacheline in nfs4_proc_pgio_rpc_prepare().
Signed-off-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 8ef9b0b9
...@@ -4610,7 +4610,7 @@ static int nfs4_proc_pgio_rpc_prepare(struct rpc_task *task, ...@@ -4610,7 +4610,7 @@ static int nfs4_proc_pgio_rpc_prepare(struct rpc_task *task,
return 0; return 0;
if (nfs4_set_rw_stateid(&hdr->args.stateid, hdr->args.context, if (nfs4_set_rw_stateid(&hdr->args.stateid, hdr->args.context,
hdr->args.lock_context, hdr->args.lock_context,
hdr->rw_ops->rw_mode) == -EIO) hdr->rw_mode) == -EIO)
return -EIO; return -EIO;
if (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags))) if (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags)))
return -EIO; return -EIO;
......
...@@ -664,11 +664,11 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, ...@@ -664,11 +664,11 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
const struct nfs_pgio_completion_ops *compl_ops, const struct nfs_pgio_completion_ops *compl_ops,
const struct nfs_rw_ops *rw_ops, const struct nfs_rw_ops *rw_ops,
size_t bsize, size_t bsize,
int io_flags) int io_flags,
gfp_t gfp_flags)
{ {
struct nfs_pgio_mirror *new; struct nfs_pgio_mirror *new;
int i; int i;
gfp_t gfp_flags = GFP_KERNEL;
desc->pg_moreio = 0; desc->pg_moreio = 0;
desc->pg_inode = inode; desc->pg_inode = inode;
...@@ -688,8 +688,6 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, ...@@ -688,8 +688,6 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
if (pg_ops->pg_get_mirror_count) { if (pg_ops->pg_get_mirror_count) {
/* until we have a request, we don't have an lseg and no /* until we have a request, we don't have an lseg and no
* idea how many mirrors there will be */ * idea how many mirrors there will be */
if (desc->pg_rw_ops->rw_mode == FMODE_WRITE)
gfp_flags = GFP_NOIO;
new = kcalloc(NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX, new = kcalloc(NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX,
sizeof(struct nfs_pgio_mirror), gfp_flags); sizeof(struct nfs_pgio_mirror), gfp_flags);
desc->pg_mirrors_dynamic = new; desc->pg_mirrors_dynamic = new;
...@@ -753,7 +751,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, ...@@ -753,7 +751,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc,
if (pagecount <= ARRAY_SIZE(pg_array->page_array)) if (pagecount <= ARRAY_SIZE(pg_array->page_array))
pg_array->pagevec = pg_array->page_array; pg_array->pagevec = pg_array->page_array;
else { else {
if (desc->pg_rw_ops->rw_mode == FMODE_WRITE) if (hdr->rw_mode == FMODE_WRITE)
gfp_flags = GFP_NOIO; gfp_flags = GFP_NOIO;
pg_array->pagevec = kcalloc(pagecount, sizeof(struct page *), gfp_flags); pg_array->pagevec = kcalloc(pagecount, sizeof(struct page *), gfp_flags);
if (!pg_array->pagevec) { if (!pg_array->pagevec) {
......
...@@ -35,7 +35,11 @@ static struct kmem_cache *nfs_rdata_cachep; ...@@ -35,7 +35,11 @@ static struct kmem_cache *nfs_rdata_cachep;
static struct nfs_pgio_header *nfs_readhdr_alloc(void) static struct nfs_pgio_header *nfs_readhdr_alloc(void)
{ {
return kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL); struct nfs_pgio_header *p = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL);
if (p)
p->rw_mode = FMODE_READ;
return p;
} }
static void nfs_readhdr_free(struct nfs_pgio_header *rhdr) static void nfs_readhdr_free(struct nfs_pgio_header *rhdr)
...@@ -64,7 +68,7 @@ void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, ...@@ -64,7 +68,7 @@ void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
pg_ops = server->pnfs_curr_ld->pg_read_ops; pg_ops = server->pnfs_curr_ld->pg_read_ops;
#endif #endif
nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_read_ops, nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_read_ops,
server->rsize, 0); server->rsize, 0, GFP_KERNEL);
} }
EXPORT_SYMBOL_GPL(nfs_pageio_init_read); EXPORT_SYMBOL_GPL(nfs_pageio_init_read);
...@@ -451,7 +455,6 @@ void nfs_destroy_readpagecache(void) ...@@ -451,7 +455,6 @@ void nfs_destroy_readpagecache(void)
} }
static const struct nfs_rw_ops nfs_rw_read_ops = { static const struct nfs_rw_ops nfs_rw_read_ops = {
.rw_mode = FMODE_READ,
.rw_alloc_header = nfs_readhdr_alloc, .rw_alloc_header = nfs_readhdr_alloc,
.rw_free_header = nfs_readhdr_free, .rw_free_header = nfs_readhdr_free,
.rw_done = nfs_readpage_done, .rw_done = nfs_readpage_done,
......
...@@ -96,7 +96,10 @@ static struct nfs_pgio_header *nfs_writehdr_alloc(void) ...@@ -96,7 +96,10 @@ static struct nfs_pgio_header *nfs_writehdr_alloc(void)
{ {
struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO); struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO);
if (p) {
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
p->rw_mode = FMODE_WRITE;
}
return p; return p;
} }
...@@ -1381,7 +1384,7 @@ void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, ...@@ -1381,7 +1384,7 @@ void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
pg_ops = server->pnfs_curr_ld->pg_write_ops; pg_ops = server->pnfs_curr_ld->pg_write_ops;
#endif #endif
nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_write_ops, nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_write_ops,
server->wsize, ioflags); server->wsize, ioflags, GFP_NOIO);
} }
EXPORT_SYMBOL_GPL(nfs_pageio_init_write); EXPORT_SYMBOL_GPL(nfs_pageio_init_write);
...@@ -2115,7 +2118,6 @@ void nfs_destroy_writepagecache(void) ...@@ -2115,7 +2118,6 @@ void nfs_destroy_writepagecache(void)
} }
static const struct nfs_rw_ops nfs_rw_write_ops = { static const struct nfs_rw_ops nfs_rw_write_ops = {
.rw_mode = FMODE_WRITE,
.rw_alloc_header = nfs_writehdr_alloc, .rw_alloc_header = nfs_writehdr_alloc,
.rw_free_header = nfs_writehdr_free, .rw_free_header = nfs_writehdr_free,
.rw_done = nfs_writeback_done, .rw_done = nfs_writeback_done,
......
...@@ -64,7 +64,6 @@ struct nfs_pageio_ops { ...@@ -64,7 +64,6 @@ struct nfs_pageio_ops {
}; };
struct nfs_rw_ops { struct nfs_rw_ops {
const fmode_t rw_mode;
struct nfs_pgio_header *(*rw_alloc_header)(void); struct nfs_pgio_header *(*rw_alloc_header)(void);
void (*rw_free_header)(struct nfs_pgio_header *); void (*rw_free_header)(struct nfs_pgio_header *);
int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *, int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *,
...@@ -124,7 +123,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, ...@@ -124,7 +123,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
const struct nfs_pgio_completion_ops *compl_ops, const struct nfs_pgio_completion_ops *compl_ops,
const struct nfs_rw_ops *rw_ops, const struct nfs_rw_ops *rw_ops,
size_t bsize, size_t bsize,
int how); int how,
gfp_t gfp_flags);
extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
struct nfs_page *); struct nfs_page *);
extern int nfs_pageio_resend(struct nfs_pageio_descriptor *, extern int nfs_pageio_resend(struct nfs_pageio_descriptor *,
......
...@@ -1427,6 +1427,7 @@ struct nfs_pgio_header { ...@@ -1427,6 +1427,7 @@ struct nfs_pgio_header {
struct list_head pages; struct list_head pages;
struct nfs_page *req; struct nfs_page *req;
struct nfs_writeverf verf; /* Used for writes */ struct nfs_writeverf verf; /* Used for writes */
fmode_t rw_mode;
struct pnfs_layout_segment *lseg; struct pnfs_layout_segment *lseg;
loff_t io_start; loff_t io_start;
const struct rpc_call_ops *mds_ops; const struct rpc_call_ops *mds_ops;
......
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