diff options
-rw-r--r-- | fs/nfs/client.c | 8 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 15 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 8 |
3 files changed, 24 insertions, 7 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 19ea7d9c75e6..a9b18483cb24 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -904,7 +904,9 @@ error: | |||
904 | /* | 904 | /* |
905 | * Load up the server record from information gained in an fsinfo record | 905 | * Load up the server record from information gained in an fsinfo record |
906 | */ | 906 | */ |
907 | static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *fsinfo) | 907 | static void nfs_server_set_fsinfo(struct nfs_server *server, |
908 | struct nfs_fh *mntfh, | ||
909 | struct nfs_fsinfo *fsinfo) | ||
908 | { | 910 | { |
909 | unsigned long max_rpc_payload; | 911 | unsigned long max_rpc_payload; |
910 | 912 | ||
@@ -934,7 +936,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * | |||
934 | if (server->wsize > NFS_MAX_FILE_IO_SIZE) | 936 | if (server->wsize > NFS_MAX_FILE_IO_SIZE) |
935 | server->wsize = NFS_MAX_FILE_IO_SIZE; | 937 | server->wsize = NFS_MAX_FILE_IO_SIZE; |
936 | server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 938 | server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
937 | set_pnfs_layoutdriver(server, fsinfo->layouttype); | 939 | set_pnfs_layoutdriver(server, mntfh, fsinfo->layouttype); |
938 | 940 | ||
939 | server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL); | 941 | server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL); |
940 | 942 | ||
@@ -980,7 +982,7 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str | |||
980 | if (error < 0) | 982 | if (error < 0) |
981 | goto out_error; | 983 | goto out_error; |
982 | 984 | ||
983 | nfs_server_set_fsinfo(server, &fsinfo); | 985 | nfs_server_set_fsinfo(server, mntfh, &fsinfo); |
984 | 986 | ||
985 | /* Get some general file system info */ | 987 | /* Get some general file system info */ |
986 | if (server->namelen == 0) { | 988 | if (server->namelen == 0) { |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index a7e5f17f7776..3a47f7ce1e90 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -76,8 +76,11 @@ find_pnfs_driver(u32 id) | |||
76 | void | 76 | void |
77 | unset_pnfs_layoutdriver(struct nfs_server *nfss) | 77 | unset_pnfs_layoutdriver(struct nfs_server *nfss) |
78 | { | 78 | { |
79 | if (nfss->pnfs_curr_ld) | 79 | if (nfss->pnfs_curr_ld) { |
80 | if (nfss->pnfs_curr_ld->clear_layoutdriver) | ||
81 | nfss->pnfs_curr_ld->clear_layoutdriver(nfss); | ||
80 | module_put(nfss->pnfs_curr_ld->owner); | 82 | module_put(nfss->pnfs_curr_ld->owner); |
83 | } | ||
81 | nfss->pnfs_curr_ld = NULL; | 84 | nfss->pnfs_curr_ld = NULL; |
82 | } | 85 | } |
83 | 86 | ||
@@ -88,7 +91,8 @@ unset_pnfs_layoutdriver(struct nfs_server *nfss) | |||
88 | * @id layout type. Zero (illegal layout type) indicates pNFS not in use. | 91 | * @id layout type. Zero (illegal layout type) indicates pNFS not in use. |
89 | */ | 92 | */ |
90 | void | 93 | void |
91 | set_pnfs_layoutdriver(struct nfs_server *server, u32 id) | 94 | set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh, |
95 | u32 id) | ||
92 | { | 96 | { |
93 | struct pnfs_layoutdriver_type *ld_type = NULL; | 97 | struct pnfs_layoutdriver_type *ld_type = NULL; |
94 | 98 | ||
@@ -115,6 +119,13 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id) | |||
115 | goto out_no_driver; | 119 | goto out_no_driver; |
116 | } | 120 | } |
117 | server->pnfs_curr_ld = ld_type; | 121 | server->pnfs_curr_ld = ld_type; |
122 | if (ld_type->set_layoutdriver | ||
123 | && ld_type->set_layoutdriver(server, mntfh)) { | ||
124 | printk(KERN_ERR "%s: Error initializing pNFS layout driver %u.\n", | ||
125 | __func__, id); | ||
126 | module_put(ld_type->owner); | ||
127 | goto out_no_driver; | ||
128 | } | ||
118 | 129 | ||
119 | dprintk("%s: pNFS module for %u set\n", __func__, id); | 130 | dprintk("%s: pNFS module for %u set\n", __func__, id); |
120 | return; | 131 | return; |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 7074394944a9..bddd8b997e18 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -80,6 +80,9 @@ struct pnfs_layoutdriver_type { | |||
80 | struct module *owner; | 80 | struct module *owner; |
81 | unsigned flags; | 81 | unsigned flags; |
82 | 82 | ||
83 | int (*set_layoutdriver) (struct nfs_server *, const struct nfs_fh *); | ||
84 | int (*clear_layoutdriver) (struct nfs_server *); | ||
85 | |||
83 | struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags); | 86 | struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags); |
84 | void (*free_layout_hdr) (struct pnfs_layout_hdr *); | 87 | void (*free_layout_hdr) (struct pnfs_layout_hdr *); |
85 | 88 | ||
@@ -167,7 +170,7 @@ void put_lseg(struct pnfs_layout_segment *lseg); | |||
167 | bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *); | 170 | bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *); |
168 | bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, int); | 171 | bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, int); |
169 | 172 | ||
170 | void set_pnfs_layoutdriver(struct nfs_server *, u32 id); | 173 | void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); |
171 | void unset_pnfs_layoutdriver(struct nfs_server *); | 174 | void unset_pnfs_layoutdriver(struct nfs_server *); |
172 | void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); | 175 | void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); |
173 | int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc); | 176 | int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc); |
@@ -374,7 +377,8 @@ pnfs_roc_drain(struct inode *ino, u32 *barrier) | |||
374 | return false; | 377 | return false; |
375 | } | 378 | } |
376 | 379 | ||
377 | static inline void set_pnfs_layoutdriver(struct nfs_server *s, u32 id) | 380 | static inline void set_pnfs_layoutdriver(struct nfs_server *s, |
381 | const struct nfs_fh *mntfh, u32 id); | ||
378 | { | 382 | { |
379 | } | 383 | } |
380 | 384 | ||