blob: 47e8f3435d3811591dedfacefcf5cd1070c22241 [file] [log] [blame]
Dean Hildebrand7ab672c2010-10-20 00:18:00 -04001/*
2 * Module for the pnfs nfs4 file layout driver.
3 * Defines all I/O and Policy interface operations, plus code
4 * to register itself with the pNFS client.
5 *
6 * Copyright (c) 2002
7 * The Regents of the University of Michigan
8 * All Rights Reserved
9 *
10 * Dean Hildebrand <dhildebz@umich.edu>
11 *
12 * Permission is granted to use, copy, create derivative works, and
13 * redistribute this software and such derivative works for any purpose,
14 * so long as the name of the University of Michigan is not used in
15 * any advertising or publicity pertaining to the use or distribution
16 * of this software without specific, written prior authorization. If
17 * the above copyright notice or any other identification of the
18 * University of Michigan is included in any copy of any portion of
19 * this software, then the disclaimer below must also be included.
20 *
21 * This software is provided as is, without representation or warranty
22 * of any kind either express or implied, including without limitation
23 * the implied warranties of merchantability, fitness for a particular
24 * purpose, or noninfringement. The Regents of the University of
25 * Michigan shall not be liable for any damages, including special,
26 * indirect, incidental, or consequential damages, with respect to any
27 * claim arising out of or in connection with the use of the software,
28 * even if it has been or is hereafter advised of the possibility of
29 * such damages.
30 */
31
32#include <linux/nfs_fs.h>
Benny Halevy19345cb2011-06-19 18:33:46 -040033#include <linux/nfs_page.h>
Paul Gortmaker143cb492011-07-01 14:23:34 -040034#include <linux/module.h>
Andy Adamson16b374c2010-10-20 00:18:04 -040035
Weston Andros Adamson0a702192012-02-17 13:15:24 -050036#include <linux/sunrpc/metrics.h>
37
Andy Adamson16b374c2010-10-20 00:18:04 -040038#include "internal.h"
39#include "nfs4filelayout.h"
Dean Hildebrand7ab672c2010-10-20 00:18:00 -040040
41#define NFSDBG_FACILITY NFSDBG_PNFS_LD
42
43MODULE_LICENSE("GPL");
44MODULE_AUTHOR("Dean Hildebrand <dhildebz@umich.edu>");
45MODULE_DESCRIPTION("The NFSv4 file layout driver");
46
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +000047#define FILELAYOUT_POLL_RETRY_MAX (15*HZ)
48
Fred Isamancfe7f412011-03-01 01:34:18 +000049static loff_t
50filelayout_get_dense_offset(struct nfs4_filelayout_segment *flseg,
51 loff_t offset)
52{
53 u32 stripe_width = flseg->stripe_unit * flseg->dsaddr->stripe_count;
Chris Metcalf3476f112011-08-11 13:54:28 -070054 u64 stripe_no;
55 u32 rem;
Fred Isamancfe7f412011-03-01 01:34:18 +000056
57 offset -= flseg->pattern_offset;
Chris Metcalf3476f112011-08-11 13:54:28 -070058 stripe_no = div_u64(offset, stripe_width);
59 div_u64_rem(offset, flseg->stripe_unit, &rem);
Fred Isamancfe7f412011-03-01 01:34:18 +000060
Chris Metcalf3476f112011-08-11 13:54:28 -070061 return stripe_no * flseg->stripe_unit + rem;
Fred Isamancfe7f412011-03-01 01:34:18 +000062}
63
64/* This function is used by the layout driver to calculate the
65 * offset of the file on the dserver based on whether the
66 * layout type is STRIPE_DENSE or STRIPE_SPARSE
67 */
68static loff_t
69filelayout_get_dserver_offset(struct pnfs_layout_segment *lseg, loff_t offset)
70{
71 struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
72
73 switch (flseg->stripe_type) {
74 case STRIPE_SPARSE:
75 return offset;
76
77 case STRIPE_DENSE:
78 return filelayout_get_dense_offset(flseg, offset);
79 }
80
81 BUG();
82}
83
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +000084static int filelayout_async_handle_error(struct rpc_task *task,
85 struct nfs4_state *state,
86 struct nfs_client *clp,
87 int *reset)
88{
89 if (task->tk_status >= 0)
90 return 0;
91
92 *reset = 0;
93
94 switch (task->tk_status) {
95 case -NFS4ERR_BADSESSION:
96 case -NFS4ERR_BADSLOT:
97 case -NFS4ERR_BAD_HIGH_SLOT:
98 case -NFS4ERR_DEADSESSION:
99 case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
100 case -NFS4ERR_SEQ_FALSE_RETRY:
101 case -NFS4ERR_SEQ_MISORDERED:
102 dprintk("%s ERROR %d, Reset session. Exchangeid "
103 "flags 0x%x\n", __func__, task->tk_status,
104 clp->cl_exchange_flags);
105 nfs4_schedule_session_recovery(clp->cl_session);
106 break;
107 case -NFS4ERR_DELAY:
108 case -NFS4ERR_GRACE:
109 case -EKEYEXPIRED:
110 rpc_delay(task, FILELAYOUT_POLL_RETRY_MAX);
111 break;
Andy Adamsona8a4ae32011-05-03 13:43:03 -0400112 case -NFS4ERR_RETRY_UNCACHED_REP:
113 break;
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000114 default:
115 dprintk("%s DS error. Retry through MDS %d\n", __func__,
116 task->tk_status);
117 *reset = 1;
118 break;
119 }
120 task->tk_status = 0;
121 return -EAGAIN;
122}
123
124/* NFS_PROTO call done callback routines */
125
126static int filelayout_read_done_cb(struct rpc_task *task,
127 struct nfs_read_data *data)
128{
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000129 int reset = 0;
130
131 dprintk("%s DS read\n", __func__);
132
133 if (filelayout_async_handle_error(task, data->args.context->state,
134 data->ds_clp, &reset) == -EAGAIN) {
135 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
136 __func__, data->ds_clp, data->ds_clp->cl_session);
137 if (reset) {
Peng Tao1b0ae062011-09-22 21:50:12 -0400138 pnfs_set_lo_fail(data->lseg);
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000139 nfs4_reset_read(task, data);
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000140 }
Trond Myklebustd00c5d42011-10-19 12:17:29 -0700141 rpc_restart_call_prepare(task);
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000142 return -EAGAIN;
143 }
144
145 return 0;
146}
147
Andy Adamson16b374c2010-10-20 00:18:04 -0400148/*
Andy Adamson863a3c62011-03-23 13:27:54 +0000149 * We reference the rpc_cred of the first WRITE that triggers the need for
150 * a LAYOUTCOMMIT, and use it to send the layoutcommit compound.
151 * rfc5661 is not clear about which credential should be used.
152 */
153static void
154filelayout_set_layoutcommit(struct nfs_write_data *wdata)
155{
156 if (FILELAYOUT_LSEG(wdata->lseg)->commit_through_mds ||
157 wdata->res.verf->committed == NFS_FILE_SYNC)
158 return;
159
160 pnfs_set_layoutcommit(wdata);
161 dprintk("%s ionde %lu pls_end_pos %lu\n", __func__, wdata->inode->i_ino,
Peng Taoacff58802011-07-30 20:52:31 -0400162 (unsigned long) NFS_I(wdata->inode)->layout->plh_lwb);
Andy Adamson863a3c62011-03-23 13:27:54 +0000163}
164
165/*
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000166 * Call ops for the async read/write cases
167 * In the case of dense layouts, the offset needs to be reset to its
168 * original value.
169 */
170static void filelayout_read_prepare(struct rpc_task *task, void *data)
171{
172 struct nfs_read_data *rdata = (struct nfs_read_data *)data;
173
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +0000174 rdata->read_done_cb = filelayout_read_done_cb;
175
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000176 if (nfs41_setup_sequence(rdata->ds_clp->cl_session,
177 &rdata->args.seq_args, &rdata->res.seq_res,
Trond Myklebust9d12b212012-01-17 22:04:25 -0500178 task))
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000179 return;
180
181 rpc_call_start(task);
182}
183
184static void filelayout_read_call_done(struct rpc_task *task, void *data)
185{
186 struct nfs_read_data *rdata = (struct nfs_read_data *)data;
187
188 dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status);
189
190 /* Note this may cause RPC to be resent */
191 rdata->mds_ops->rpc_call_done(task, data);
192}
193
Weston Andros Adamson0a702192012-02-17 13:15:24 -0500194static void filelayout_read_count_stats(struct rpc_task *task, void *data)
195{
196 struct nfs_read_data *rdata = (struct nfs_read_data *)data;
197
198 rpc_count_iostats(task, NFS_SERVER(rdata->inode)->client->cl_metrics);
199}
200
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000201static void filelayout_read_release(void *data)
202{
203 struct nfs_read_data *rdata = (struct nfs_read_data *)data;
204
205 rdata->mds_ops->rpc_release(data);
206}
207
Fred Isamana69aef12011-03-03 15:13:47 +0000208static int filelayout_write_done_cb(struct rpc_task *task,
209 struct nfs_write_data *data)
210{
211 int reset = 0;
212
213 if (filelayout_async_handle_error(task, data->args.context->state,
214 data->ds_clp, &reset) == -EAGAIN) {
Fred Isamana69aef12011-03-03 15:13:47 +0000215 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
216 __func__, data->ds_clp, data->ds_clp->cl_session);
217 if (reset) {
Peng Tao1b0ae062011-09-22 21:50:12 -0400218 pnfs_set_lo_fail(data->lseg);
Fred Isamana69aef12011-03-03 15:13:47 +0000219 nfs4_reset_write(task, data);
Trond Myklebustd00c5d42011-10-19 12:17:29 -0700220 }
221 rpc_restart_call_prepare(task);
Fred Isamana69aef12011-03-03 15:13:47 +0000222 return -EAGAIN;
223 }
224
Andy Adamson863a3c62011-03-23 13:27:54 +0000225 filelayout_set_layoutcommit(data);
Fred Isamana69aef12011-03-03 15:13:47 +0000226 return 0;
227}
228
Fred Isamane0c2b382011-03-23 13:27:53 +0000229/* Fake up some data that will cause nfs_commit_release to retry the writes. */
230static void prepare_to_resend_writes(struct nfs_write_data *data)
231{
232 struct nfs_page *first = nfs_list_entry(data->pages.next);
233
234 data->task.tk_status = 0;
235 memcpy(data->verf.verifier, first->wb_verf.verifier,
236 sizeof(first->wb_verf.verifier));
237 data->verf.verifier[0]++; /* ensure verifier mismatch */
238}
239
240static int filelayout_commit_done_cb(struct rpc_task *task,
241 struct nfs_write_data *data)
242{
243 int reset = 0;
244
245 if (filelayout_async_handle_error(task, data->args.context->state,
246 data->ds_clp, &reset) == -EAGAIN) {
247 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
248 __func__, data->ds_clp, data->ds_clp->cl_session);
249 if (reset) {
250 prepare_to_resend_writes(data);
Peng Tao1b0ae062011-09-22 21:50:12 -0400251 pnfs_set_lo_fail(data->lseg);
Fred Isamane0c2b382011-03-23 13:27:53 +0000252 } else
Trond Myklebustd00c5d42011-10-19 12:17:29 -0700253 rpc_restart_call_prepare(task);
Fred Isamane0c2b382011-03-23 13:27:53 +0000254 return -EAGAIN;
255 }
256
257 return 0;
258}
259
Fred Isamana69aef12011-03-03 15:13:47 +0000260static void filelayout_write_prepare(struct rpc_task *task, void *data)
261{
262 struct nfs_write_data *wdata = (struct nfs_write_data *)data;
263
264 if (nfs41_setup_sequence(wdata->ds_clp->cl_session,
265 &wdata->args.seq_args, &wdata->res.seq_res,
Trond Myklebust9d12b212012-01-17 22:04:25 -0500266 task))
Fred Isamana69aef12011-03-03 15:13:47 +0000267 return;
268
269 rpc_call_start(task);
270}
271
272static void filelayout_write_call_done(struct rpc_task *task, void *data)
273{
274 struct nfs_write_data *wdata = (struct nfs_write_data *)data;
275
276 /* Note this may cause RPC to be resent */
277 wdata->mds_ops->rpc_call_done(task, data);
278}
279
Weston Andros Adamson0a702192012-02-17 13:15:24 -0500280static void filelayout_write_count_stats(struct rpc_task *task, void *data)
281{
282 struct nfs_write_data *wdata = (struct nfs_write_data *)data;
283
284 rpc_count_iostats(task, NFS_SERVER(wdata->inode)->client->cl_metrics);
285}
286
Fred Isamana69aef12011-03-03 15:13:47 +0000287static void filelayout_write_release(void *data)
288{
289 struct nfs_write_data *wdata = (struct nfs_write_data *)data;
290
291 wdata->mds_ops->rpc_release(data);
292}
293
Fred Isamane0c2b382011-03-23 13:27:53 +0000294static void filelayout_commit_release(void *data)
295{
296 struct nfs_write_data *wdata = (struct nfs_write_data *)data;
297
298 nfs_commit_release_pages(wdata);
299 if (atomic_dec_and_test(&NFS_I(wdata->inode)->commits_outstanding))
300 nfs_commit_clear_lock(NFS_I(wdata->inode));
301 nfs_commitdata_release(wdata);
302}
303
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000304struct rpc_call_ops filelayout_read_call_ops = {
305 .rpc_call_prepare = filelayout_read_prepare,
306 .rpc_call_done = filelayout_read_call_done,
Weston Andros Adamson0a702192012-02-17 13:15:24 -0500307 .rpc_count_stats = filelayout_read_count_stats,
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000308 .rpc_release = filelayout_read_release,
309};
310
Fred Isamana69aef12011-03-03 15:13:47 +0000311struct rpc_call_ops filelayout_write_call_ops = {
312 .rpc_call_prepare = filelayout_write_prepare,
313 .rpc_call_done = filelayout_write_call_done,
Weston Andros Adamson0a702192012-02-17 13:15:24 -0500314 .rpc_count_stats = filelayout_write_count_stats,
Fred Isamana69aef12011-03-03 15:13:47 +0000315 .rpc_release = filelayout_write_release,
316};
317
Fred Isamane0c2b382011-03-23 13:27:53 +0000318struct rpc_call_ops filelayout_commit_call_ops = {
319 .rpc_call_prepare = filelayout_write_prepare,
320 .rpc_call_done = filelayout_write_call_done,
Weston Andros Adamson0a702192012-02-17 13:15:24 -0500321 .rpc_count_stats = filelayout_write_count_stats,
Fred Isamane0c2b382011-03-23 13:27:53 +0000322 .rpc_release = filelayout_commit_release,
323};
324
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000325static enum pnfs_try_status
326filelayout_read_pagelist(struct nfs_read_data *data)
327{
328 struct pnfs_layout_segment *lseg = data->lseg;
329 struct nfs4_pnfs_ds *ds;
330 loff_t offset = data->args.offset;
331 u32 j, idx;
332 struct nfs_fh *fh;
333 int status;
334
335 dprintk("--> %s ino %lu pgbase %u req %Zu@%llu\n",
336 __func__, data->inode->i_ino,
337 data->args.pgbase, (size_t)data->args.count, offset);
338
Andy Adamsonc47abcf2011-06-15 17:52:40 -0400339 if (test_bit(NFS_DEVICEID_INVALID, &FILELAYOUT_DEVID_NODE(lseg)->flags))
340 return PNFS_NOT_ATTEMPTED;
341
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000342 /* Retrieve the correct rpc_client for the byte range */
343 j = nfs4_fl_calc_j_index(lseg, offset);
344 idx = nfs4_fl_calc_ds_index(lseg, j);
345 ds = nfs4_fl_prepare_ds(lseg, idx);
346 if (!ds) {
Andy Adamson568e8c42011-03-01 01:34:22 +0000347 /* Either layout fh index faulty, or ds connect failed */
348 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
349 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000350 return PNFS_NOT_ATTEMPTED;
351 }
Weston Andros Adamsonc9895cb2011-05-31 18:48:56 -0400352 dprintk("%s USE DS: %s\n", __func__, ds->ds_remotestr);
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000353
354 /* No multipath support. Use first DS */
355 data->ds_clp = ds->ds_clp;
356 fh = nfs4_fl_select_ds_fh(lseg, j);
357 if (fh)
358 data->args.fh = fh;
359
360 data->args.offset = filelayout_get_dserver_offset(lseg, offset);
361 data->mds_offset = offset;
362
363 /* Perform an asynchronous read to ds */
364 status = nfs_initiate_read(data, ds->ds_clp->cl_rpcclient,
365 &filelayout_read_call_ops);
366 BUG_ON(status != 0);
367 return PNFS_ATTEMPTED;
368}
369
Fred Isamana69aef12011-03-03 15:13:47 +0000370/* Perform async writes. */
Andy Adamson0382b742011-03-03 15:13:45 +0000371static enum pnfs_try_status
372filelayout_write_pagelist(struct nfs_write_data *data, int sync)
373{
Fred Isamana69aef12011-03-03 15:13:47 +0000374 struct pnfs_layout_segment *lseg = data->lseg;
375 struct nfs4_pnfs_ds *ds;
376 loff_t offset = data->args.offset;
377 u32 j, idx;
378 struct nfs_fh *fh;
379 int status;
380
Andy Adamsonc47abcf2011-06-15 17:52:40 -0400381 if (test_bit(NFS_DEVICEID_INVALID, &FILELAYOUT_DEVID_NODE(lseg)->flags))
382 return PNFS_NOT_ATTEMPTED;
383
Fred Isamana69aef12011-03-03 15:13:47 +0000384 /* Retrieve the correct rpc_client for the byte range */
385 j = nfs4_fl_calc_j_index(lseg, offset);
386 idx = nfs4_fl_calc_ds_index(lseg, j);
387 ds = nfs4_fl_prepare_ds(lseg, idx);
388 if (!ds) {
Weston Andros Adamsona0308892012-01-26 13:32:23 -0500389 printk(KERN_ERR "NFS: %s: prepare_ds failed, use MDS\n",
390 __func__);
Fred Isamana69aef12011-03-03 15:13:47 +0000391 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
392 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
393 return PNFS_NOT_ATTEMPTED;
394 }
Weston Andros Adamsonc9895cb2011-05-31 18:48:56 -0400395 dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s\n", __func__,
Fred Isamana69aef12011-03-03 15:13:47 +0000396 data->inode->i_ino, sync, (size_t) data->args.count, offset,
Weston Andros Adamsonc9895cb2011-05-31 18:48:56 -0400397 ds->ds_remotestr);
Fred Isamana69aef12011-03-03 15:13:47 +0000398
Fred Isamana69aef12011-03-03 15:13:47 +0000399 data->write_done_cb = filelayout_write_done_cb;
400 data->ds_clp = ds->ds_clp;
401 fh = nfs4_fl_select_ds_fh(lseg, j);
402 if (fh)
403 data->args.fh = fh;
404 /*
405 * Get the file offset on the dserver. Set the write offset to
406 * this offset and save the original offset.
407 */
408 data->args.offset = filelayout_get_dserver_offset(lseg, offset);
Fred Isamana69aef12011-03-03 15:13:47 +0000409
410 /* Perform an asynchronous write */
411 status = nfs_initiate_write(data, ds->ds_clp->cl_rpcclient,
412 &filelayout_write_call_ops, sync);
413 BUG_ON(status != 0);
414 return PNFS_ATTEMPTED;
Andy Adamson0382b742011-03-03 15:13:45 +0000415}
416
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000417/*
Andy Adamson16b374c2010-10-20 00:18:04 -0400418 * filelayout_check_layout()
419 *
420 * Make sure layout segment parameters are sane WRT the device.
421 * At this point no generic layer initialization of the lseg has occurred,
422 * and nothing has been added to the layout_hdr cache.
423 *
424 */
425static int
426filelayout_check_layout(struct pnfs_layout_hdr *lo,
427 struct nfs4_filelayout_segment *fl,
428 struct nfs4_layoutget_res *lgr,
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400429 struct nfs4_deviceid *id,
430 gfp_t gfp_flags)
Andy Adamson16b374c2010-10-20 00:18:04 -0400431{
Benny Halevya1eaecb2011-05-19 22:14:47 -0400432 struct nfs4_deviceid_node *d;
Andy Adamson16b374c2010-10-20 00:18:04 -0400433 struct nfs4_file_layout_dsaddr *dsaddr;
434 int status = -EINVAL;
Fred Isamanb7edfaa2011-01-06 11:36:21 +0000435 struct nfs_server *nfss = NFS_SERVER(lo->plh_inode);
Andy Adamson16b374c2010-10-20 00:18:04 -0400436
437 dprintk("--> %s\n", __func__);
438
Andy Adamson7c24d942011-06-13 18:22:38 -0400439 /* FIXME: remove this check when layout segment support is added */
440 if (lgr->range.offset != 0 ||
441 lgr->range.length != NFS4_MAX_UINT64) {
442 dprintk("%s Only whole file layouts supported. Use MDS i/o\n",
443 __func__);
444 goto out;
445 }
446
Andy Adamson16b374c2010-10-20 00:18:04 -0400447 if (fl->pattern_offset > lgr->range.offset) {
Jim Rees3b6445a2011-02-22 19:31:57 -0500448 dprintk("%s pattern_offset %lld too large\n",
Andy Adamson16b374c2010-10-20 00:18:04 -0400449 __func__, fl->pattern_offset);
450 goto out;
451 }
452
Benny Halevy75247af2011-02-22 15:56:01 -0800453 if (!fl->stripe_unit || fl->stripe_unit % PAGE_SIZE) {
454 dprintk("%s Invalid stripe unit (%u)\n",
Andy Adamson16b374c2010-10-20 00:18:04 -0400455 __func__, fl->stripe_unit);
456 goto out;
457 }
458
459 /* find and reference the deviceid */
Benny Halevy35c8bb52011-05-24 18:04:02 +0300460 d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode)->pnfs_curr_ld,
461 NFS_SERVER(lo->plh_inode)->nfs_client, id);
Benny Halevya1eaecb2011-05-19 22:14:47 -0400462 if (d == NULL) {
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400463 dsaddr = get_device_info(lo->plh_inode, id, gfp_flags);
Andy Adamson16b374c2010-10-20 00:18:04 -0400464 if (dsaddr == NULL)
465 goto out;
Benny Halevya1eaecb2011-05-19 22:14:47 -0400466 } else
467 dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
Andy Adamsonc47abcf2011-06-15 17:52:40 -0400468 /* Found deviceid is being reaped */
469 if (test_bit(NFS_DEVICEID_INVALID, &dsaddr->id_node.flags))
470 goto out_put;
471
Andy Adamson16b374c2010-10-20 00:18:04 -0400472 fl->dsaddr = dsaddr;
473
Chuck Levere4149662011-10-25 12:18:03 -0400474 if (fl->first_stripe_index >= dsaddr->stripe_count) {
475 dprintk("%s Bad first_stripe_index %u\n",
Andy Adamson16b374c2010-10-20 00:18:04 -0400476 __func__, fl->first_stripe_index);
477 goto out_put;
478 }
479
480 if ((fl->stripe_type == STRIPE_SPARSE &&
481 fl->num_fh > 1 && fl->num_fh != dsaddr->ds_num) ||
482 (fl->stripe_type == STRIPE_DENSE &&
483 fl->num_fh != dsaddr->stripe_count)) {
484 dprintk("%s num_fh %u not valid for given packing\n",
485 __func__, fl->num_fh);
486 goto out_put;
487 }
488
489 if (fl->stripe_unit % nfss->rsize || fl->stripe_unit % nfss->wsize) {
490 dprintk("%s Stripe unit (%u) not aligned with rsize %u "
491 "wsize %u\n", __func__, fl->stripe_unit, nfss->rsize,
492 nfss->wsize);
493 }
494
495 status = 0;
496out:
497 dprintk("--> %s returns %d\n", __func__, status);
498 return status;
499out_put:
Christoph Hellwigea8eecd2011-03-01 01:34:21 +0000500 nfs4_fl_put_deviceid(dsaddr);
Andy Adamson16b374c2010-10-20 00:18:04 -0400501 goto out;
502}
503
504static void filelayout_free_fh_array(struct nfs4_filelayout_segment *fl)
505{
506 int i;
507
508 for (i = 0; i < fl->num_fh; i++) {
509 if (!fl->fh_array[i])
510 break;
511 kfree(fl->fh_array[i]);
512 }
513 kfree(fl->fh_array);
514 fl->fh_array = NULL;
515}
516
517static void
518_filelayout_free_lseg(struct nfs4_filelayout_segment *fl)
519{
520 filelayout_free_fh_array(fl);
521 kfree(fl);
522}
523
524static int
525filelayout_decode_layout(struct pnfs_layout_hdr *flo,
526 struct nfs4_filelayout_segment *fl,
527 struct nfs4_layoutget_res *lgr,
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400528 struct nfs4_deviceid *id,
529 gfp_t gfp_flags)
Andy Adamson16b374c2010-10-20 00:18:04 -0400530{
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400531 struct xdr_stream stream;
Benny Halevyf7da7a12011-05-19 14:16:47 -0400532 struct xdr_buf buf;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400533 struct page *scratch;
534 __be32 *p;
Andy Adamson16b374c2010-10-20 00:18:04 -0400535 uint32_t nfl_util;
536 int i;
537
538 dprintk("%s: set_layout_map Begin\n", __func__);
539
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400540 scratch = alloc_page(gfp_flags);
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400541 if (!scratch)
542 return -ENOMEM;
543
Benny Halevyf7da7a12011-05-19 14:16:47 -0400544 xdr_init_decode_pages(&stream, &buf, lgr->layoutp->pages, lgr->layoutp->len);
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400545 xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
546
547 /* 20 = ufl_util (4), first_stripe_index (4), pattern_offset (8),
548 * num_fh (4) */
549 p = xdr_inline_decode(&stream, NFS4_DEVICEID4_SIZE + 20);
550 if (unlikely(!p))
551 goto out_err;
552
Andy Adamson16b374c2010-10-20 00:18:04 -0400553 memcpy(id, p, sizeof(*id));
554 p += XDR_QUADLEN(NFS4_DEVICEID4_SIZE);
Benny Halevya1eaecb2011-05-19 22:14:47 -0400555 nfs4_print_deviceid(id);
Andy Adamson16b374c2010-10-20 00:18:04 -0400556
557 nfl_util = be32_to_cpup(p++);
558 if (nfl_util & NFL4_UFLG_COMMIT_THRU_MDS)
559 fl->commit_through_mds = 1;
560 if (nfl_util & NFL4_UFLG_DENSE)
561 fl->stripe_type = STRIPE_DENSE;
562 else
563 fl->stripe_type = STRIPE_SPARSE;
564 fl->stripe_unit = nfl_util & ~NFL4_UFLG_MASK;
565
566 fl->first_stripe_index = be32_to_cpup(p++);
567 p = xdr_decode_hyper(p, &fl->pattern_offset);
568 fl->num_fh = be32_to_cpup(p++);
569
570 dprintk("%s: nfl_util 0x%X num_fh %u fsi %u po %llu\n",
571 __func__, nfl_util, fl->num_fh, fl->first_stripe_index,
572 fl->pattern_offset);
573
Andy Adamsoncec765c2011-06-13 18:36:17 -0400574 /* Note that a zero value for num_fh is legal for STRIPE_SPARSE.
575 * Futher checking is done in filelayout_check_layout */
Chuck Levere4149662011-10-25 12:18:03 -0400576 if (fl->num_fh >
Andy Adamsoncec765c2011-06-13 18:36:17 -0400577 max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400578 goto out_err;
579
Andy Adamsoncec765c2011-06-13 18:36:17 -0400580 if (fl->num_fh > 0) {
581 fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
582 gfp_flags);
583 if (!fl->fh_array)
584 goto out_err;
585 }
Andy Adamson16b374c2010-10-20 00:18:04 -0400586
587 for (i = 0; i < fl->num_fh; i++) {
588 /* Do we want to use a mempool here? */
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400589 fl->fh_array[i] = kmalloc(sizeof(struct nfs_fh), gfp_flags);
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400590 if (!fl->fh_array[i])
591 goto out_err_free;
592
593 p = xdr_inline_decode(&stream, 4);
594 if (unlikely(!p))
595 goto out_err_free;
Andy Adamson16b374c2010-10-20 00:18:04 -0400596 fl->fh_array[i]->size = be32_to_cpup(p++);
597 if (sizeof(struct nfs_fh) < fl->fh_array[i]->size) {
Weston Andros Adamsonf9fd2d92012-01-26 13:32:22 -0500598 printk(KERN_ERR "NFS: Too big fh %d received %d\n",
Andy Adamson16b374c2010-10-20 00:18:04 -0400599 i, fl->fh_array[i]->size);
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400600 goto out_err_free;
Andy Adamson16b374c2010-10-20 00:18:04 -0400601 }
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400602
603 p = xdr_inline_decode(&stream, fl->fh_array[i]->size);
604 if (unlikely(!p))
605 goto out_err_free;
Andy Adamson16b374c2010-10-20 00:18:04 -0400606 memcpy(fl->fh_array[i]->data, p, fl->fh_array[i]->size);
Andy Adamson16b374c2010-10-20 00:18:04 -0400607 dprintk("DEBUG: %s: fh len %d\n", __func__,
608 fl->fh_array[i]->size);
609 }
610
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400611 __free_page(scratch);
Andy Adamson16b374c2010-10-20 00:18:04 -0400612 return 0;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400613
614out_err_free:
615 filelayout_free_fh_array(fl);
616out_err:
617 __free_page(scratch);
618 return -EIO;
Andy Adamson16b374c2010-10-20 00:18:04 -0400619}
620
Fred Isamanc8795132011-03-23 13:27:49 +0000621static void
622filelayout_free_lseg(struct pnfs_layout_segment *lseg)
623{
624 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
625
626 dprintk("--> %s\n", __func__);
627 nfs4_fl_put_deviceid(fl->dsaddr);
Fred Isaman425eb732011-03-23 13:27:50 +0000628 kfree(fl->commit_buckets);
Fred Isamanc8795132011-03-23 13:27:49 +0000629 _filelayout_free_lseg(fl);
630}
631
Andy Adamson16b374c2010-10-20 00:18:04 -0400632static struct pnfs_layout_segment *
633filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400634 struct nfs4_layoutget_res *lgr,
635 gfp_t gfp_flags)
Andy Adamson16b374c2010-10-20 00:18:04 -0400636{
637 struct nfs4_filelayout_segment *fl;
638 int rc;
639 struct nfs4_deviceid id;
640
641 dprintk("--> %s\n", __func__);
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400642 fl = kzalloc(sizeof(*fl), gfp_flags);
Andy Adamson16b374c2010-10-20 00:18:04 -0400643 if (!fl)
644 return NULL;
645
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400646 rc = filelayout_decode_layout(layoutid, fl, lgr, &id, gfp_flags);
647 if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, &id, gfp_flags)) {
Andy Adamson16b374c2010-10-20 00:18:04 -0400648 _filelayout_free_lseg(fl);
649 return NULL;
650 }
Fred Isaman425eb732011-03-23 13:27:50 +0000651
652 /* This assumes there is only one IOMODE_RW lseg. What
653 * we really want to do is have a layout_hdr level
654 * dictionary of <multipath_list4, fh> keys, each
655 * associated with a struct list_head, populated by calls
656 * to filelayout_write_pagelist().
657 * */
658 if ((!fl->commit_through_mds) && (lgr->range.iomode == IOMODE_RW)) {
659 int i;
660 int size = (fl->stripe_type == STRIPE_SPARSE) ?
661 fl->dsaddr->ds_num : fl->dsaddr->stripe_count;
662
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400663 fl->commit_buckets = kcalloc(size, sizeof(struct list_head), gfp_flags);
Fred Isaman425eb732011-03-23 13:27:50 +0000664 if (!fl->commit_buckets) {
665 filelayout_free_lseg(&fl->generic_hdr);
666 return NULL;
667 }
668 fl->number_of_buckets = size;
669 for (i = 0; i < size; i++)
670 INIT_LIST_HEAD(&fl->commit_buckets[i]);
671 }
Andy Adamson16b374c2010-10-20 00:18:04 -0400672 return &fl->generic_hdr;
673}
674
Fred Isaman94ad1c82011-03-01 01:34:14 +0000675/*
676 * filelayout_pg_test(). Called by nfs_can_coalesce_requests()
677 *
Benny Halevy18ad0a92011-05-25 21:03:56 +0300678 * return true : coalesce page
679 * return false : don't coalesce page
Fred Isaman94ad1c82011-03-01 01:34:14 +0000680 */
Trond Myklebust1751c362011-06-10 13:30:23 -0400681static bool
Fred Isaman94ad1c82011-03-01 01:34:14 +0000682filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
683 struct nfs_page *req)
684{
685 u64 p_stripe, r_stripe;
686 u32 stripe_unit;
687
Benny Halevy19345cb2011-06-19 18:33:46 -0400688 if (!pnfs_generic_pg_test(pgio, prev, req) ||
689 !nfs_generic_pg_test(pgio, prev, req))
690 return false;
Benny Halevy89a58e32011-05-25 20:54:40 +0300691
Fred Isaman94ad1c82011-03-01 01:34:14 +0000692 p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT;
693 r_stripe = (u64)req->wb_index << PAGE_CACHE_SHIFT;
694 stripe_unit = FILELAYOUT_LSEG(pgio->pg_lseg)->stripe_unit;
695
696 do_div(p_stripe, stripe_unit);
697 do_div(r_stripe, stripe_unit);
698
699 return (p_stripe == r_stripe);
700}
701
Andy Adamson7c24d942011-06-13 18:22:38 -0400702void
703filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
704 struct nfs_page *req)
705{
706 BUG_ON(pgio->pg_lseg != NULL);
707
708 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
709 req->wb_context,
710 0,
711 NFS4_MAX_UINT64,
712 IOMODE_READ,
713 GFP_KERNEL);
714 /* If no lseg, fall back to read through mds */
715 if (pgio->pg_lseg == NULL)
Trond Myklebust1f945352011-07-13 15:59:57 -0400716 nfs_pageio_reset_read_mds(pgio);
Andy Adamson7c24d942011-06-13 18:22:38 -0400717}
718
719void
720filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
721 struct nfs_page *req)
722{
723 BUG_ON(pgio->pg_lseg != NULL);
724
725 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
726 req->wb_context,
727 0,
728 NFS4_MAX_UINT64,
729 IOMODE_RW,
730 GFP_NOFS);
731 /* If no lseg, fall back to write through mds */
732 if (pgio->pg_lseg == NULL)
Trond Myklebust1f945352011-07-13 15:59:57 -0400733 nfs_pageio_reset_write_mds(pgio);
Andy Adamson7c24d942011-06-13 18:22:38 -0400734}
735
Trond Myklebust1751c362011-06-10 13:30:23 -0400736static const struct nfs_pageio_ops filelayout_pg_read_ops = {
Andy Adamson7c24d942011-06-13 18:22:38 -0400737 .pg_init = filelayout_pg_init_read,
Trond Myklebust1751c362011-06-10 13:30:23 -0400738 .pg_test = filelayout_pg_test,
Trond Myklebust493292d2011-07-13 15:58:28 -0400739 .pg_doio = pnfs_generic_pg_readpages,
Trond Myklebust1751c362011-06-10 13:30:23 -0400740};
741
742static const struct nfs_pageio_ops filelayout_pg_write_ops = {
Andy Adamson7c24d942011-06-13 18:22:38 -0400743 .pg_init = filelayout_pg_init_write,
Trond Myklebust1751c362011-06-10 13:30:23 -0400744 .pg_test = filelayout_pg_test,
Trond Myklebustdce81292011-07-13 15:59:19 -0400745 .pg_doio = pnfs_generic_pg_writepages,
Trond Myklebust1751c362011-06-10 13:30:23 -0400746};
747
Fred Isamane0c2b382011-03-23 13:27:53 +0000748static bool filelayout_mark_pnfs_commit(struct pnfs_layout_segment *lseg)
749{
750 return !FILELAYOUT_LSEG(lseg)->commit_through_mds;
751}
752
753static u32 select_bucket_index(struct nfs4_filelayout_segment *fl, u32 j)
754{
755 if (fl->stripe_type == STRIPE_SPARSE)
756 return nfs4_fl_calc_ds_index(&fl->generic_hdr, j);
757 else
758 return j;
759}
760
761struct list_head *filelayout_choose_commit_list(struct nfs_page *req)
762{
763 struct pnfs_layout_segment *lseg = req->wb_commit_lseg;
764 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
765 u32 i, j;
766 struct list_head *list;
767
768 /* Note that we are calling nfs4_fl_calc_j_index on each page
769 * that ends up being committed to a data server. An attractive
770 * alternative is to add a field to nfs_write_data and nfs_page
771 * to store the value calculated in filelayout_write_pagelist
772 * and just use that here.
773 */
774 j = nfs4_fl_calc_j_index(lseg,
775 (loff_t)req->wb_index << PAGE_CACHE_SHIFT);
776 i = select_bucket_index(fl, j);
777 list = &fl->commit_buckets[i];
778 if (list_empty(list)) {
779 /* Non-empty buckets hold a reference on the lseg */
780 get_lseg(lseg);
781 }
782 return list;
783}
784
785static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
786{
787 struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
788
789 if (flseg->stripe_type == STRIPE_SPARSE)
790 return i;
791 else
792 return nfs4_fl_calc_ds_index(lseg, i);
793}
794
795static struct nfs_fh *
796select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i)
797{
798 struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
799
800 if (flseg->stripe_type == STRIPE_SPARSE) {
801 if (flseg->num_fh == 1)
802 i = 0;
803 else if (flseg->num_fh == 0)
804 /* Use the MDS OPEN fh set in nfs_read_rpcsetup */
805 return NULL;
806 }
807 return flseg->fh_array[i];
808}
809
810static int filelayout_initiate_commit(struct nfs_write_data *data, int how)
811{
812 struct pnfs_layout_segment *lseg = data->lseg;
813 struct nfs4_pnfs_ds *ds;
814 u32 idx;
815 struct nfs_fh *fh;
816
817 idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
818 ds = nfs4_fl_prepare_ds(lseg, idx);
819 if (!ds) {
Weston Andros Adamsona0308892012-01-26 13:32:23 -0500820 printk(KERN_ERR "NFS: %s: prepare_ds failed, use MDS\n",
821 __func__);
Fred Isamane0c2b382011-03-23 13:27:53 +0000822 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
823 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
824 prepare_to_resend_writes(data);
825 data->mds_ops->rpc_release(data);
826 return -EAGAIN;
827 }
828 dprintk("%s ino %lu, how %d\n", __func__, data->inode->i_ino, how);
829 data->write_done_cb = filelayout_commit_done_cb;
830 data->ds_clp = ds->ds_clp;
831 fh = select_ds_fh_from_commit(lseg, data->ds_commit_index);
832 if (fh)
833 data->args.fh = fh;
834 return nfs_initiate_commit(data, ds->ds_clp->cl_rpcclient,
835 &filelayout_commit_call_ops, how);
836}
837
838/*
839 * This is only useful while we are using whole file layouts.
840 */
841static struct pnfs_layout_segment *find_only_write_lseg(struct inode *inode)
842{
843 struct pnfs_layout_segment *lseg, *rv = NULL;
844
845 spin_lock(&inode->i_lock);
846 list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list)
847 if (lseg->pls_range.iomode == IOMODE_RW)
848 rv = get_lseg(lseg);
849 spin_unlock(&inode->i_lock);
850 return rv;
851}
852
853static int alloc_ds_commits(struct inode *inode, struct list_head *list)
854{
855 struct pnfs_layout_segment *lseg;
856 struct nfs4_filelayout_segment *fl;
857 struct nfs_write_data *data;
858 int i, j;
859
860 /* Won't need this when non-whole file layout segments are supported
861 * instead we will use a pnfs_layout_hdr structure */
862 lseg = find_only_write_lseg(inode);
863 if (!lseg)
864 return 0;
865 fl = FILELAYOUT_LSEG(lseg);
866 for (i = 0; i < fl->number_of_buckets; i++) {
867 if (list_empty(&fl->commit_buckets[i]))
868 continue;
869 data = nfs_commitdata_alloc();
870 if (!data)
871 goto out_bad;
872 data->ds_commit_index = i;
873 data->lseg = lseg;
874 list_add(&data->pages, list);
875 }
876 put_lseg(lseg);
877 return 0;
878
879out_bad:
880 for (j = i; j < fl->number_of_buckets; j++) {
881 if (list_empty(&fl->commit_buckets[i]))
882 continue;
883 nfs_retry_commit(&fl->commit_buckets[i], lseg);
884 put_lseg(lseg); /* associated with emptying bucket */
885 }
886 put_lseg(lseg);
887 /* Caller will clean up entries put on list */
888 return -ENOMEM;
889}
890
891/* This follows nfs_commit_list pretty closely */
892static int
893filelayout_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
894 int how)
895{
896 struct nfs_write_data *data, *tmp;
897 LIST_HEAD(list);
898
899 if (!list_empty(mds_pages)) {
900 data = nfs_commitdata_alloc();
901 if (!data)
902 goto out_bad;
903 data->lseg = NULL;
904 list_add(&data->pages, &list);
905 }
906
907 if (alloc_ds_commits(inode, &list))
908 goto out_bad;
909
910 list_for_each_entry_safe(data, tmp, &list, pages) {
911 list_del_init(&data->pages);
912 atomic_inc(&NFS_I(inode)->commits_outstanding);
913 if (!data->lseg) {
914 nfs_init_commit(data, mds_pages, NULL);
915 nfs_initiate_commit(data, NFS_CLIENT(inode),
916 data->mds_ops, how);
917 } else {
918 nfs_init_commit(data, &FILELAYOUT_LSEG(data->lseg)->commit_buckets[data->ds_commit_index], data->lseg);
919 filelayout_initiate_commit(data, how);
920 }
921 }
922 return 0;
923 out_bad:
924 list_for_each_entry_safe(data, tmp, &list, pages) {
925 nfs_retry_commit(&data->pages, data->lseg);
926 list_del_init(&data->pages);
927 nfs_commit_free(data);
928 }
929 nfs_retry_commit(mds_pages, NULL);
930 nfs_commit_clear_lock(NFS_I(inode));
931 return -ENOMEM;
932}
933
Benny Halevy1775bc32011-05-20 13:47:33 +0200934static void
935filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
936{
937 nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
938}
939
Dean Hildebrand7ab672c2010-10-20 00:18:00 -0400940static struct pnfs_layoutdriver_type filelayout_type = {
Christoph Hellwigea8eecd2011-03-01 01:34:21 +0000941 .id = LAYOUT_NFSV4_1_FILES,
942 .name = "LAYOUT_NFSV4_1_FILES",
943 .owner = THIS_MODULE,
944 .alloc_lseg = filelayout_alloc_lseg,
945 .free_lseg = filelayout_free_lseg,
Trond Myklebust1751c362011-06-10 13:30:23 -0400946 .pg_read_ops = &filelayout_pg_read_ops,
947 .pg_write_ops = &filelayout_pg_write_ops,
Fred Isamane0c2b382011-03-23 13:27:53 +0000948 .mark_pnfs_commit = filelayout_mark_pnfs_commit,
949 .choose_commit_list = filelayout_choose_commit_list,
950 .commit_pagelist = filelayout_commit_pagelist,
Andy Adamsondc70d7b2011-03-01 01:34:19 +0000951 .read_pagelist = filelayout_read_pagelist,
Andy Adamson0382b742011-03-03 15:13:45 +0000952 .write_pagelist = filelayout_write_pagelist,
Benny Halevy1775bc32011-05-20 13:47:33 +0200953 .free_deviceid_node = filelayout_free_deveiceid_node,
Dean Hildebrand7ab672c2010-10-20 00:18:00 -0400954};
955
956static int __init nfs4filelayout_init(void)
957{
958 printk(KERN_INFO "%s: NFSv4 File Layout Driver Registering...\n",
959 __func__);
960 return pnfs_register_layoutdriver(&filelayout_type);
961}
962
963static void __exit nfs4filelayout_exit(void)
964{
965 printk(KERN_INFO "%s: NFSv4 File Layout Driver Unregistering...\n",
966 __func__);
967 pnfs_unregister_layoutdriver(&filelayout_type);
968}
969
J. Bruce Fieldsf85ef692011-07-15 19:18:42 -0400970MODULE_ALIAS("nfs-layouttype4-1");
971
Dean Hildebrand7ab672c2010-10-20 00:18:00 -0400972module_init(nfs4filelayout_init);
973module_exit(nfs4filelayout_exit);