NFS: Create an write_pageio_init() function
pNFS needs to select a write function based on the layout driver currently in use, so I let each NFS version decide how to best handle initializing writes. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Родитель
1abb50886a
Коммит
57208fa7e5
|
@ -320,7 +320,7 @@ extern struct nfs_write_header *nfs_writehdr_alloc(void);
|
|||
extern void nfs_writehdr_free(struct nfs_pgio_header *hdr);
|
||||
extern int nfs_generic_flush(struct nfs_pageio_descriptor *desc,
|
||||
struct nfs_pgio_header *hdr);
|
||||
extern void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio,
|
||||
extern void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
struct inode *inode, int ioflags,
|
||||
const struct nfs_pgio_completion_ops *compl_ops);
|
||||
extern void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio);
|
||||
|
|
|
@ -925,6 +925,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
|
|||
.read_rpc_prepare = nfs3_proc_read_rpc_prepare,
|
||||
.read_done = nfs3_read_done,
|
||||
.write_setup = nfs3_proc_write_setup,
|
||||
.write_pageio_init = nfs_pageio_init_write,
|
||||
.write_rpc_prepare = nfs3_proc_write_rpc_prepare,
|
||||
.write_done = nfs3_write_done,
|
||||
.commit_setup = nfs3_proc_commit_setup,
|
||||
|
|
|
@ -6796,6 +6796,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
|
|||
.read_rpc_prepare = nfs4_proc_read_rpc_prepare,
|
||||
.read_done = nfs4_read_done,
|
||||
.write_setup = nfs4_proc_write_setup,
|
||||
.write_pageio_init = pnfs_pageio_init_write,
|
||||
.write_rpc_prepare = nfs4_proc_write_rpc_prepare,
|
||||
.write_done = nfs4_write_done,
|
||||
.commit_setup = nfs4_proc_commit_setup,
|
||||
|
|
|
@ -1222,7 +1222,7 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode,
|
|||
nfs_pageio_init(pgio, inode, ld->pg_read_ops, compl_ops, server->rsize, 0);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode,
|
||||
int ioflags,
|
||||
const struct nfs_pgio_completion_ops *compl_ops)
|
||||
|
@ -1231,10 +1231,9 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode,
|
|||
struct pnfs_layoutdriver_type *ld = server->pnfs_curr_ld;
|
||||
|
||||
if (ld == NULL)
|
||||
return false;
|
||||
nfs_pageio_init(pgio, inode, ld->pg_write_ops, compl_ops,
|
||||
server->wsize, ioflags);
|
||||
return true;
|
||||
nfs_pageio_init_write(pgio, inode, ioflags, compl_ops);
|
||||
else
|
||||
nfs_pageio_init(pgio, inode, ld->pg_write_ops, compl_ops, server->wsize, ioflags);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1271,7 +1270,7 @@ int pnfs_write_done_resend_to_mds(struct inode *inode,
|
|||
LIST_HEAD(failed);
|
||||
|
||||
/* Resend all requests through the MDS */
|
||||
nfs_pageio_init_write_mds(&pgio, inode, FLUSH_STABLE, compl_ops);
|
||||
nfs_pageio_init_write(&pgio, inode, FLUSH_STABLE, compl_ops);
|
||||
while (!list_empty(head)) {
|
||||
struct nfs_page *req = nfs_list_entry(head->next);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void put_lseg(struct pnfs_layout_segment *lseg);
|
|||
|
||||
void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *,
|
||||
const struct nfs_pgio_completion_ops *);
|
||||
bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *,
|
||||
void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *,
|
||||
int, const struct nfs_pgio_completion_ops *);
|
||||
|
||||
void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32);
|
||||
|
@ -444,10 +444,10 @@ static inline void pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, str
|
|||
nfs_pageio_init_read(pgio, inode, compl_ops);
|
||||
}
|
||||
|
||||
static inline bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags,
|
||||
static inline void pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags,
|
||||
const struct nfs_pgio_completion_ops *compl_ops)
|
||||
{
|
||||
return false;
|
||||
nfs_pageio_init_write(pgio, inode, ioflags, compl_ops);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
|
|
@ -782,6 +782,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
|
|||
.read_rpc_prepare = nfs_proc_read_rpc_prepare,
|
||||
.read_done = nfs_read_done,
|
||||
.write_setup = nfs_proc_write_setup,
|
||||
.write_pageio_init = nfs_pageio_init_write,
|
||||
.write_rpc_prepare = nfs_proc_write_rpc_prepare,
|
||||
.write_done = nfs_write_done,
|
||||
.commit_setup = nfs_proc_commit_setup,
|
||||
|
|
|
@ -336,8 +336,10 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc
|
|||
struct nfs_pageio_descriptor pgio;
|
||||
int err;
|
||||
|
||||
nfs_pageio_init_write(&pgio, page->mapping->host, wb_priority(wbc),
|
||||
&nfs_async_write_completion_ops);
|
||||
NFS_PROTO(page->mapping->host)->write_pageio_init(&pgio,
|
||||
page->mapping->host,
|
||||
wb_priority(wbc),
|
||||
&nfs_async_write_completion_ops);
|
||||
err = nfs_do_writepage(page, wbc, &pgio);
|
||||
nfs_pageio_complete(&pgio);
|
||||
if (err < 0)
|
||||
|
@ -380,8 +382,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
|
|||
|
||||
nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES);
|
||||
|
||||
nfs_pageio_init_write(&pgio, inode, wb_priority(wbc),
|
||||
&nfs_async_write_completion_ops);
|
||||
NFS_PROTO(inode)->write_pageio_init(&pgio, inode, wb_priority(wbc), &nfs_async_write_completion_ops);
|
||||
err = write_cache_pages(mapping, wbc, nfs_writepages_callback, &pgio);
|
||||
nfs_pageio_complete(&pgio);
|
||||
|
||||
|
@ -1202,7 +1203,7 @@ static const struct nfs_pageio_ops nfs_pageio_write_ops = {
|
|||
.pg_doio = nfs_generic_pg_writepages,
|
||||
};
|
||||
|
||||
void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio,
|
||||
void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
struct inode *inode, int ioflags,
|
||||
const struct nfs_pgio_completion_ops *compl_ops)
|
||||
{
|
||||
|
@ -1217,13 +1218,6 @@ void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(nfs_pageio_reset_write_mds);
|
||||
|
||||
void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
struct inode *inode, int ioflags,
|
||||
const struct nfs_pgio_completion_ops *compl_ops)
|
||||
{
|
||||
if (!pnfs_pageio_init_write(pgio, inode, ioflags, compl_ops))
|
||||
nfs_pageio_init_write_mds(pgio, inode, ioflags, compl_ops);
|
||||
}
|
||||
|
||||
void nfs_write_prepare(struct rpc_task *task, void *calldata)
|
||||
{
|
||||
|
|
|
@ -1413,6 +1413,8 @@ struct nfs_rpc_ops {
|
|||
void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
|
||||
int (*read_done) (struct rpc_task *, struct nfs_read_data *);
|
||||
void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
|
||||
void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
|
||||
const struct nfs_pgio_completion_ops *);
|
||||
void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
|
||||
int (*write_done) (struct rpc_task *, struct nfs_write_data *);
|
||||
void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче