filelayout.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. /*
  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. #include <linux/nfs_fs.h>
  32. #include <linux/nfs_page.h>
  33. #include <linux/module.h>
  34. #include <linux/sunrpc/metrics.h>
  35. #include "../nfs4session.h"
  36. #include "../internal.h"
  37. #include "../delegation.h"
  38. #include "filelayout.h"
  39. #include "../nfs4trace.h"
  40. #define NFSDBG_FACILITY NFSDBG_PNFS_LD
  41. MODULE_LICENSE("GPL");
  42. MODULE_AUTHOR("Dean Hildebrand <dhildebz@umich.edu>");
  43. MODULE_DESCRIPTION("The NFSv4 file layout driver");
  44. #define FILELAYOUT_POLL_RETRY_MAX (15*HZ)
  45. static loff_t
  46. filelayout_get_dense_offset(struct nfs4_filelayout_segment *flseg,
  47. loff_t offset)
  48. {
  49. u32 stripe_width = flseg->stripe_unit * flseg->dsaddr->stripe_count;
  50. u64 stripe_no;
  51. u32 rem;
  52. offset -= flseg->pattern_offset;
  53. stripe_no = div_u64(offset, stripe_width);
  54. div_u64_rem(offset, flseg->stripe_unit, &rem);
  55. return stripe_no * flseg->stripe_unit + rem;
  56. }
  57. /* This function is used by the layout driver to calculate the
  58. * offset of the file on the dserver based on whether the
  59. * layout type is STRIPE_DENSE or STRIPE_SPARSE
  60. */
  61. static loff_t
  62. filelayout_get_dserver_offset(struct pnfs_layout_segment *lseg, loff_t offset)
  63. {
  64. struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
  65. switch (flseg->stripe_type) {
  66. case STRIPE_SPARSE:
  67. return offset;
  68. case STRIPE_DENSE:
  69. return filelayout_get_dense_offset(flseg, offset);
  70. }
  71. BUG();
  72. }
  73. static void filelayout_reset_write(struct nfs_pgio_header *hdr)
  74. {
  75. struct rpc_task *task = &hdr->task;
  76. if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {
  77. dprintk("%s Reset task %5u for i/o through MDS "
  78. "(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
  79. hdr->task.tk_pid,
  80. hdr->inode->i_sb->s_id,
  81. (unsigned long long)NFS_FILEID(hdr->inode),
  82. hdr->args.count,
  83. (unsigned long long)hdr->args.offset);
  84. task->tk_status = pnfs_write_done_resend_to_mds(hdr);
  85. }
  86. }
  87. static void filelayout_reset_read(struct nfs_pgio_header *hdr)
  88. {
  89. struct rpc_task *task = &hdr->task;
  90. if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {
  91. dprintk("%s Reset task %5u for i/o through MDS "
  92. "(req %s/%llu, %u bytes @ offset %llu)\n", __func__,
  93. hdr->task.tk_pid,
  94. hdr->inode->i_sb->s_id,
  95. (unsigned long long)NFS_FILEID(hdr->inode),
  96. hdr->args.count,
  97. (unsigned long long)hdr->args.offset);
  98. task->tk_status = pnfs_read_done_resend_to_mds(hdr);
  99. }
  100. }
  101. static int filelayout_async_handle_error(struct rpc_task *task,
  102. struct nfs4_state *state,
  103. struct nfs_client *clp,
  104. struct pnfs_layout_segment *lseg)
  105. {
  106. struct pnfs_layout_hdr *lo = lseg->pls_layout;
  107. struct inode *inode = lo->plh_inode;
  108. struct nfs_server *mds_server = NFS_SERVER(inode);
  109. struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg);
  110. struct nfs_client *mds_client = mds_server->nfs_client;
  111. struct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table;
  112. if (task->tk_status >= 0)
  113. return 0;
  114. switch (task->tk_status) {
  115. /* MDS state errors */
  116. case -NFS4ERR_DELEG_REVOKED:
  117. case -NFS4ERR_ADMIN_REVOKED:
  118. case -NFS4ERR_BAD_STATEID:
  119. case -NFS4ERR_OPENMODE:
  120. if (state == NULL)
  121. break;
  122. if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
  123. goto out_bad_stateid;
  124. goto wait_on_recovery;
  125. case -NFS4ERR_EXPIRED:
  126. if (state != NULL) {
  127. if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
  128. goto out_bad_stateid;
  129. }
  130. nfs4_schedule_lease_recovery(mds_client);
  131. goto wait_on_recovery;
  132. /* DS session errors */
  133. case -NFS4ERR_BADSESSION:
  134. case -NFS4ERR_BADSLOT:
  135. case -NFS4ERR_BAD_HIGH_SLOT:
  136. case -NFS4ERR_DEADSESSION:
  137. case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
  138. case -NFS4ERR_SEQ_FALSE_RETRY:
  139. case -NFS4ERR_SEQ_MISORDERED:
  140. dprintk("%s ERROR %d, Reset session. Exchangeid "
  141. "flags 0x%x\n", __func__, task->tk_status,
  142. clp->cl_exchange_flags);
  143. nfs4_schedule_session_recovery(clp->cl_session, task->tk_status);
  144. break;
  145. case -NFS4ERR_DELAY:
  146. case -NFS4ERR_GRACE:
  147. rpc_delay(task, FILELAYOUT_POLL_RETRY_MAX);
  148. break;
  149. case -NFS4ERR_RETRY_UNCACHED_REP:
  150. break;
  151. /* Invalidate Layout errors */
  152. case -NFS4ERR_PNFS_NO_LAYOUT:
  153. case -ESTALE: /* mapped NFS4ERR_STALE */
  154. case -EBADHANDLE: /* mapped NFS4ERR_BADHANDLE */
  155. case -EISDIR: /* mapped NFS4ERR_ISDIR */
  156. case -NFS4ERR_FHEXPIRED:
  157. case -NFS4ERR_WRONG_TYPE:
  158. dprintk("%s Invalid layout error %d\n", __func__,
  159. task->tk_status);
  160. /*
  161. * Destroy layout so new i/o will get a new layout.
  162. * Layout will not be destroyed until all current lseg
  163. * references are put. Mark layout as invalid to resend failed
  164. * i/o and all i/o waiting on the slot table to the MDS until
  165. * layout is destroyed and a new valid layout is obtained.
  166. */
  167. pnfs_destroy_layout(NFS_I(inode));
  168. rpc_wake_up(&tbl->slot_tbl_waitq);
  169. goto reset;
  170. /* RPC connection errors */
  171. case -ECONNREFUSED:
  172. case -EHOSTDOWN:
  173. case -EHOSTUNREACH:
  174. case -ENETUNREACH:
  175. case -EIO:
  176. case -ETIMEDOUT:
  177. case -EPIPE:
  178. dprintk("%s DS connection error %d\n", __func__,
  179. task->tk_status);
  180. nfs4_mark_deviceid_unavailable(devid);
  181. pnfs_error_mark_layout_for_return(inode, lseg);
  182. rpc_wake_up(&tbl->slot_tbl_waitq);
  183. /* fall through */
  184. default:
  185. reset:
  186. dprintk("%s Retry through MDS. Error %d\n", __func__,
  187. task->tk_status);
  188. return -NFS4ERR_RESET_TO_MDS;
  189. }
  190. out:
  191. task->tk_status = 0;
  192. return -EAGAIN;
  193. out_bad_stateid:
  194. task->tk_status = -EIO;
  195. return 0;
  196. wait_on_recovery:
  197. rpc_sleep_on(&mds_client->cl_rpcwaitq, task, NULL);
  198. if (test_bit(NFS4CLNT_MANAGER_RUNNING, &mds_client->cl_state) == 0)
  199. rpc_wake_up_queued_task(&mds_client->cl_rpcwaitq, task);
  200. goto out;
  201. }
  202. /* NFS_PROTO call done callback routines */
  203. static int filelayout_read_done_cb(struct rpc_task *task,
  204. struct nfs_pgio_header *hdr)
  205. {
  206. int err;
  207. trace_nfs4_pnfs_read(hdr, task->tk_status);
  208. err = filelayout_async_handle_error(task, hdr->args.context->state,
  209. hdr->ds_clp, hdr->lseg);
  210. switch (err) {
  211. case -NFS4ERR_RESET_TO_MDS:
  212. filelayout_reset_read(hdr);
  213. return task->tk_status;
  214. case -EAGAIN:
  215. rpc_restart_call_prepare(task);
  216. return -EAGAIN;
  217. }
  218. return 0;
  219. }
  220. /*
  221. * We reference the rpc_cred of the first WRITE that triggers the need for
  222. * a LAYOUTCOMMIT, and use it to send the layoutcommit compound.
  223. * rfc5661 is not clear about which credential should be used.
  224. */
  225. static void
  226. filelayout_set_layoutcommit(struct nfs_pgio_header *hdr)
  227. {
  228. if (FILELAYOUT_LSEG(hdr->lseg)->commit_through_mds ||
  229. hdr->res.verf->committed != NFS_DATA_SYNC)
  230. return;
  231. pnfs_set_layoutcommit(hdr);
  232. dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino,
  233. (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb);
  234. }
  235. bool
  236. filelayout_test_devid_unavailable(struct nfs4_deviceid_node *node)
  237. {
  238. return filelayout_test_devid_invalid(node) ||
  239. nfs4_test_deviceid_unavailable(node);
  240. }
  241. static bool
  242. filelayout_reset_to_mds(struct pnfs_layout_segment *lseg)
  243. {
  244. struct nfs4_deviceid_node *node = FILELAYOUT_DEVID_NODE(lseg);
  245. return filelayout_test_devid_unavailable(node);
  246. }
  247. /*
  248. * Call ops for the async read/write cases
  249. * In the case of dense layouts, the offset needs to be reset to its
  250. * original value.
  251. */
  252. static void filelayout_read_prepare(struct rpc_task *task, void *data)
  253. {
  254. struct nfs_pgio_header *hdr = data;
  255. if (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags))) {
  256. rpc_exit(task, -EIO);
  257. return;
  258. }
  259. if (filelayout_reset_to_mds(hdr->lseg)) {
  260. dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
  261. filelayout_reset_read(hdr);
  262. rpc_exit(task, 0);
  263. return;
  264. }
  265. hdr->pgio_done_cb = filelayout_read_done_cb;
  266. if (nfs41_setup_sequence(hdr->ds_clp->cl_session,
  267. &hdr->args.seq_args,
  268. &hdr->res.seq_res,
  269. task))
  270. return;
  271. if (nfs4_set_rw_stateid(&hdr->args.stateid, hdr->args.context,
  272. hdr->args.lock_context, FMODE_READ) == -EIO)
  273. rpc_exit(task, -EIO); /* lost lock, terminate I/O */
  274. }
  275. static void filelayout_read_call_done(struct rpc_task *task, void *data)
  276. {
  277. struct nfs_pgio_header *hdr = data;
  278. dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status);
  279. if (test_bit(NFS_IOHDR_REDO, &hdr->flags) &&
  280. task->tk_status == 0) {
  281. nfs41_sequence_done(task, &hdr->res.seq_res);
  282. return;
  283. }
  284. /* Note this may cause RPC to be resent */
  285. hdr->mds_ops->rpc_call_done(task, data);
  286. }
  287. static void filelayout_read_count_stats(struct rpc_task *task, void *data)
  288. {
  289. struct nfs_pgio_header *hdr = data;
  290. rpc_count_iostats(task, NFS_SERVER(hdr->inode)->client->cl_metrics);
  291. }
  292. static int filelayout_write_done_cb(struct rpc_task *task,
  293. struct nfs_pgio_header *hdr)
  294. {
  295. int err;
  296. trace_nfs4_pnfs_write(hdr, task->tk_status);
  297. err = filelayout_async_handle_error(task, hdr->args.context->state,
  298. hdr->ds_clp, hdr->lseg);
  299. switch (err) {
  300. case -NFS4ERR_RESET_TO_MDS:
  301. filelayout_reset_write(hdr);
  302. return task->tk_status;
  303. case -EAGAIN:
  304. rpc_restart_call_prepare(task);
  305. return -EAGAIN;
  306. }
  307. filelayout_set_layoutcommit(hdr);
  308. return 0;
  309. }
  310. static int filelayout_commit_done_cb(struct rpc_task *task,
  311. struct nfs_commit_data *data)
  312. {
  313. int err;
  314. trace_nfs4_pnfs_commit_ds(data, task->tk_status);
  315. err = filelayout_async_handle_error(task, NULL, data->ds_clp,
  316. data->lseg);
  317. switch (err) {
  318. case -NFS4ERR_RESET_TO_MDS:
  319. pnfs_generic_prepare_to_resend_writes(data);
  320. return -EAGAIN;
  321. case -EAGAIN:
  322. rpc_restart_call_prepare(task);
  323. return -EAGAIN;
  324. }
  325. if (data->verf.committed == NFS_UNSTABLE)
  326. pnfs_commit_set_layoutcommit(data);
  327. return 0;
  328. }
  329. static void filelayout_write_prepare(struct rpc_task *task, void *data)
  330. {
  331. struct nfs_pgio_header *hdr = data;
  332. if (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags))) {
  333. rpc_exit(task, -EIO);
  334. return;
  335. }
  336. if (filelayout_reset_to_mds(hdr->lseg)) {
  337. dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
  338. filelayout_reset_write(hdr);
  339. rpc_exit(task, 0);
  340. return;
  341. }
  342. if (nfs41_setup_sequence(hdr->ds_clp->cl_session,
  343. &hdr->args.seq_args,
  344. &hdr->res.seq_res,
  345. task))
  346. return;
  347. if (nfs4_set_rw_stateid(&hdr->args.stateid, hdr->args.context,
  348. hdr->args.lock_context, FMODE_WRITE) == -EIO)
  349. rpc_exit(task, -EIO); /* lost lock, terminate I/O */
  350. }
  351. static void filelayout_write_call_done(struct rpc_task *task, void *data)
  352. {
  353. struct nfs_pgio_header *hdr = data;
  354. if (test_bit(NFS_IOHDR_REDO, &hdr->flags) &&
  355. task->tk_status == 0) {
  356. nfs41_sequence_done(task, &hdr->res.seq_res);
  357. return;
  358. }
  359. /* Note this may cause RPC to be resent */
  360. hdr->mds_ops->rpc_call_done(task, data);
  361. }
  362. static void filelayout_write_count_stats(struct rpc_task *task, void *data)
  363. {
  364. struct nfs_pgio_header *hdr = data;
  365. rpc_count_iostats(task, NFS_SERVER(hdr->inode)->client->cl_metrics);
  366. }
  367. static void filelayout_commit_prepare(struct rpc_task *task, void *data)
  368. {
  369. struct nfs_commit_data *wdata = data;
  370. nfs41_setup_sequence(wdata->ds_clp->cl_session,
  371. &wdata->args.seq_args,
  372. &wdata->res.seq_res,
  373. task);
  374. }
  375. static void filelayout_commit_count_stats(struct rpc_task *task, void *data)
  376. {
  377. struct nfs_commit_data *cdata = data;
  378. rpc_count_iostats(task, NFS_SERVER(cdata->inode)->client->cl_metrics);
  379. }
  380. static const struct rpc_call_ops filelayout_read_call_ops = {
  381. .rpc_call_prepare = filelayout_read_prepare,
  382. .rpc_call_done = filelayout_read_call_done,
  383. .rpc_count_stats = filelayout_read_count_stats,
  384. .rpc_release = pnfs_generic_rw_release,
  385. };
  386. static const struct rpc_call_ops filelayout_write_call_ops = {
  387. .rpc_call_prepare = filelayout_write_prepare,
  388. .rpc_call_done = filelayout_write_call_done,
  389. .rpc_count_stats = filelayout_write_count_stats,
  390. .rpc_release = pnfs_generic_rw_release,
  391. };
  392. static const struct rpc_call_ops filelayout_commit_call_ops = {
  393. .rpc_call_prepare = filelayout_commit_prepare,
  394. .rpc_call_done = pnfs_generic_write_commit_done,
  395. .rpc_count_stats = filelayout_commit_count_stats,
  396. .rpc_release = pnfs_generic_commit_release,
  397. };
  398. static enum pnfs_try_status
  399. filelayout_read_pagelist(struct nfs_pgio_header *hdr)
  400. {
  401. struct pnfs_layout_segment *lseg = hdr->lseg;
  402. struct nfs4_pnfs_ds *ds;
  403. struct rpc_clnt *ds_clnt;
  404. loff_t offset = hdr->args.offset;
  405. u32 j, idx;
  406. struct nfs_fh *fh;
  407. dprintk("--> %s ino %lu pgbase %u req %Zu@%llu\n",
  408. __func__, hdr->inode->i_ino,
  409. hdr->args.pgbase, (size_t)hdr->args.count, offset);
  410. /* Retrieve the correct rpc_client for the byte range */
  411. j = nfs4_fl_calc_j_index(lseg, offset);
  412. idx = nfs4_fl_calc_ds_index(lseg, j);
  413. ds = nfs4_fl_prepare_ds(lseg, idx);
  414. if (!ds)
  415. return PNFS_NOT_ATTEMPTED;
  416. ds_clnt = nfs4_find_or_create_ds_client(ds->ds_clp, hdr->inode);
  417. if (IS_ERR(ds_clnt))
  418. return PNFS_NOT_ATTEMPTED;
  419. dprintk("%s USE DS: %s cl_count %d\n", __func__,
  420. ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count));
  421. /* No multipath support. Use first DS */
  422. atomic_inc(&ds->ds_clp->cl_count);
  423. hdr->ds_clp = ds->ds_clp;
  424. hdr->ds_commit_idx = idx;
  425. fh = nfs4_fl_select_ds_fh(lseg, j);
  426. if (fh)
  427. hdr->args.fh = fh;
  428. hdr->args.offset = filelayout_get_dserver_offset(lseg, offset);
  429. hdr->mds_offset = offset;
  430. /* Perform an asynchronous read to ds */
  431. nfs_initiate_pgio(ds_clnt, hdr, hdr->cred,
  432. NFS_PROTO(hdr->inode), &filelayout_read_call_ops,
  433. 0, RPC_TASK_SOFTCONN);
  434. return PNFS_ATTEMPTED;
  435. }
  436. /* Perform async writes. */
  437. static enum pnfs_try_status
  438. filelayout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
  439. {
  440. struct pnfs_layout_segment *lseg = hdr->lseg;
  441. struct nfs4_pnfs_ds *ds;
  442. struct rpc_clnt *ds_clnt;
  443. loff_t offset = hdr->args.offset;
  444. u32 j, idx;
  445. struct nfs_fh *fh;
  446. /* Retrieve the correct rpc_client for the byte range */
  447. j = nfs4_fl_calc_j_index(lseg, offset);
  448. idx = nfs4_fl_calc_ds_index(lseg, j);
  449. ds = nfs4_fl_prepare_ds(lseg, idx);
  450. if (!ds)
  451. return PNFS_NOT_ATTEMPTED;
  452. ds_clnt = nfs4_find_or_create_ds_client(ds->ds_clp, hdr->inode);
  453. if (IS_ERR(ds_clnt))
  454. return PNFS_NOT_ATTEMPTED;
  455. dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s cl_count %d\n",
  456. __func__, hdr->inode->i_ino, sync, (size_t) hdr->args.count,
  457. offset, ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count));
  458. hdr->pgio_done_cb = filelayout_write_done_cb;
  459. atomic_inc(&ds->ds_clp->cl_count);
  460. hdr->ds_clp = ds->ds_clp;
  461. hdr->ds_commit_idx = idx;
  462. fh = nfs4_fl_select_ds_fh(lseg, j);
  463. if (fh)
  464. hdr->args.fh = fh;
  465. hdr->args.offset = filelayout_get_dserver_offset(lseg, offset);
  466. /* Perform an asynchronous write */
  467. nfs_initiate_pgio(ds_clnt, hdr, hdr->cred,
  468. NFS_PROTO(hdr->inode), &filelayout_write_call_ops,
  469. sync, RPC_TASK_SOFTCONN);
  470. return PNFS_ATTEMPTED;
  471. }
  472. /*
  473. * filelayout_check_layout()
  474. *
  475. * Make sure layout segment parameters are sane WRT the device.
  476. * At this point no generic layer initialization of the lseg has occurred,
  477. * and nothing has been added to the layout_hdr cache.
  478. *
  479. */
  480. static int
  481. filelayout_check_layout(struct pnfs_layout_hdr *lo,
  482. struct nfs4_filelayout_segment *fl,
  483. struct nfs4_layoutget_res *lgr,
  484. struct nfs4_deviceid *id,
  485. gfp_t gfp_flags)
  486. {
  487. struct nfs4_deviceid_node *d;
  488. struct nfs4_file_layout_dsaddr *dsaddr;
  489. int status = -EINVAL;
  490. dprintk("--> %s\n", __func__);
  491. /* FIXME: remove this check when layout segment support is added */
  492. if (lgr->range.offset != 0 ||
  493. lgr->range.length != NFS4_MAX_UINT64) {
  494. dprintk("%s Only whole file layouts supported. Use MDS i/o\n",
  495. __func__);
  496. goto out;
  497. }
  498. if (fl->pattern_offset > lgr->range.offset) {
  499. dprintk("%s pattern_offset %lld too large\n",
  500. __func__, fl->pattern_offset);
  501. goto out;
  502. }
  503. if (!fl->stripe_unit) {
  504. dprintk("%s Invalid stripe unit (%u)\n",
  505. __func__, fl->stripe_unit);
  506. goto out;
  507. }
  508. /* find and reference the deviceid */
  509. d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), id,
  510. lo->plh_lc_cred, gfp_flags);
  511. if (d == NULL)
  512. goto out;
  513. dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
  514. /* Found deviceid is unavailable */
  515. if (filelayout_test_devid_unavailable(&dsaddr->id_node))
  516. goto out_put;
  517. fl->dsaddr = dsaddr;
  518. if (fl->first_stripe_index >= dsaddr->stripe_count) {
  519. dprintk("%s Bad first_stripe_index %u\n",
  520. __func__, fl->first_stripe_index);
  521. goto out_put;
  522. }
  523. if ((fl->stripe_type == STRIPE_SPARSE &&
  524. fl->num_fh > 1 && fl->num_fh != dsaddr->ds_num) ||
  525. (fl->stripe_type == STRIPE_DENSE &&
  526. fl->num_fh != dsaddr->stripe_count)) {
  527. dprintk("%s num_fh %u not valid for given packing\n",
  528. __func__, fl->num_fh);
  529. goto out_put;
  530. }
  531. status = 0;
  532. out:
  533. dprintk("--> %s returns %d\n", __func__, status);
  534. return status;
  535. out_put:
  536. nfs4_fl_put_deviceid(dsaddr);
  537. goto out;
  538. }
  539. static void filelayout_free_fh_array(struct nfs4_filelayout_segment *fl)
  540. {
  541. int i;
  542. for (i = 0; i < fl->num_fh; i++) {
  543. if (!fl->fh_array[i])
  544. break;
  545. kfree(fl->fh_array[i]);
  546. }
  547. kfree(fl->fh_array);
  548. fl->fh_array = NULL;
  549. }
  550. static void
  551. _filelayout_free_lseg(struct nfs4_filelayout_segment *fl)
  552. {
  553. filelayout_free_fh_array(fl);
  554. kfree(fl);
  555. }
  556. static int
  557. filelayout_decode_layout(struct pnfs_layout_hdr *flo,
  558. struct nfs4_filelayout_segment *fl,
  559. struct nfs4_layoutget_res *lgr,
  560. struct nfs4_deviceid *id,
  561. gfp_t gfp_flags)
  562. {
  563. struct xdr_stream stream;
  564. struct xdr_buf buf;
  565. struct page *scratch;
  566. __be32 *p;
  567. uint32_t nfl_util;
  568. int i;
  569. dprintk("%s: set_layout_map Begin\n", __func__);
  570. scratch = alloc_page(gfp_flags);
  571. if (!scratch)
  572. return -ENOMEM;
  573. xdr_init_decode_pages(&stream, &buf, lgr->layoutp->pages, lgr->layoutp->len);
  574. xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
  575. /* 20 = ufl_util (4), first_stripe_index (4), pattern_offset (8),
  576. * num_fh (4) */
  577. p = xdr_inline_decode(&stream, NFS4_DEVICEID4_SIZE + 20);
  578. if (unlikely(!p))
  579. goto out_err;
  580. memcpy(id, p, sizeof(*id));
  581. p += XDR_QUADLEN(NFS4_DEVICEID4_SIZE);
  582. nfs4_print_deviceid(id);
  583. nfl_util = be32_to_cpup(p++);
  584. if (nfl_util & NFL4_UFLG_COMMIT_THRU_MDS)
  585. fl->commit_through_mds = 1;
  586. if (nfl_util & NFL4_UFLG_DENSE)
  587. fl->stripe_type = STRIPE_DENSE;
  588. else
  589. fl->stripe_type = STRIPE_SPARSE;
  590. fl->stripe_unit = nfl_util & ~NFL4_UFLG_MASK;
  591. fl->first_stripe_index = be32_to_cpup(p++);
  592. p = xdr_decode_hyper(p, &fl->pattern_offset);
  593. fl->num_fh = be32_to_cpup(p++);
  594. dprintk("%s: nfl_util 0x%X num_fh %u fsi %u po %llu\n",
  595. __func__, nfl_util, fl->num_fh, fl->first_stripe_index,
  596. fl->pattern_offset);
  597. /* Note that a zero value for num_fh is legal for STRIPE_SPARSE.
  598. * Futher checking is done in filelayout_check_layout */
  599. if (fl->num_fh >
  600. max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
  601. goto out_err;
  602. if (fl->num_fh > 0) {
  603. fl->fh_array = kcalloc(fl->num_fh, sizeof(fl->fh_array[0]),
  604. gfp_flags);
  605. if (!fl->fh_array)
  606. goto out_err;
  607. }
  608. for (i = 0; i < fl->num_fh; i++) {
  609. /* Do we want to use a mempool here? */
  610. fl->fh_array[i] = kmalloc(sizeof(struct nfs_fh), gfp_flags);
  611. if (!fl->fh_array[i])
  612. goto out_err_free;
  613. p = xdr_inline_decode(&stream, 4);
  614. if (unlikely(!p))
  615. goto out_err_free;
  616. fl->fh_array[i]->size = be32_to_cpup(p++);
  617. if (sizeof(struct nfs_fh) < fl->fh_array[i]->size) {
  618. printk(KERN_ERR "NFS: Too big fh %d received %d\n",
  619. i, fl->fh_array[i]->size);
  620. goto out_err_free;
  621. }
  622. p = xdr_inline_decode(&stream, fl->fh_array[i]->size);
  623. if (unlikely(!p))
  624. goto out_err_free;
  625. memcpy(fl->fh_array[i]->data, p, fl->fh_array[i]->size);
  626. dprintk("DEBUG: %s: fh len %d\n", __func__,
  627. fl->fh_array[i]->size);
  628. }
  629. __free_page(scratch);
  630. return 0;
  631. out_err_free:
  632. filelayout_free_fh_array(fl);
  633. out_err:
  634. __free_page(scratch);
  635. return -EIO;
  636. }
  637. static void
  638. filelayout_free_lseg(struct pnfs_layout_segment *lseg)
  639. {
  640. struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
  641. dprintk("--> %s\n", __func__);
  642. nfs4_fl_put_deviceid(fl->dsaddr);
  643. /* This assumes a single RW lseg */
  644. if (lseg->pls_range.iomode == IOMODE_RW) {
  645. struct nfs4_filelayout *flo;
  646. flo = FILELAYOUT_FROM_HDR(lseg->pls_layout);
  647. flo->commit_info.nbuckets = 0;
  648. kfree(flo->commit_info.buckets);
  649. flo->commit_info.buckets = NULL;
  650. }
  651. _filelayout_free_lseg(fl);
  652. }
  653. static int
  654. filelayout_alloc_commit_info(struct pnfs_layout_segment *lseg,
  655. struct nfs_commit_info *cinfo,
  656. gfp_t gfp_flags)
  657. {
  658. struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
  659. struct pnfs_commit_bucket *buckets;
  660. int size, i;
  661. if (fl->commit_through_mds)
  662. return 0;
  663. size = (fl->stripe_type == STRIPE_SPARSE) ?
  664. fl->dsaddr->ds_num : fl->dsaddr->stripe_count;
  665. if (cinfo->ds->nbuckets >= size) {
  666. /* This assumes there is only one IOMODE_RW lseg. What
  667. * we really want to do is have a layout_hdr level
  668. * dictionary of <multipath_list4, fh> keys, each
  669. * associated with a struct list_head, populated by calls
  670. * to filelayout_write_pagelist().
  671. * */
  672. return 0;
  673. }
  674. buckets = kcalloc(size, sizeof(struct pnfs_commit_bucket),
  675. gfp_flags);
  676. if (!buckets)
  677. return -ENOMEM;
  678. for (i = 0; i < size; i++) {
  679. INIT_LIST_HEAD(&buckets[i].written);
  680. INIT_LIST_HEAD(&buckets[i].committing);
  681. /* mark direct verifier as unset */
  682. buckets[i].direct_verf.committed = NFS_INVALID_STABLE_HOW;
  683. }
  684. spin_lock(cinfo->lock);
  685. if (cinfo->ds->nbuckets >= size)
  686. goto out;
  687. for (i = 0; i < cinfo->ds->nbuckets; i++) {
  688. list_splice(&cinfo->ds->buckets[i].written,
  689. &buckets[i].written);
  690. list_splice(&cinfo->ds->buckets[i].committing,
  691. &buckets[i].committing);
  692. buckets[i].direct_verf.committed =
  693. cinfo->ds->buckets[i].direct_verf.committed;
  694. buckets[i].wlseg = cinfo->ds->buckets[i].wlseg;
  695. buckets[i].clseg = cinfo->ds->buckets[i].clseg;
  696. }
  697. swap(cinfo->ds->buckets, buckets);
  698. cinfo->ds->nbuckets = size;
  699. out:
  700. spin_unlock(cinfo->lock);
  701. kfree(buckets);
  702. return 0;
  703. }
  704. static struct pnfs_layout_segment *
  705. filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
  706. struct nfs4_layoutget_res *lgr,
  707. gfp_t gfp_flags)
  708. {
  709. struct nfs4_filelayout_segment *fl;
  710. int rc;
  711. struct nfs4_deviceid id;
  712. dprintk("--> %s\n", __func__);
  713. fl = kzalloc(sizeof(*fl), gfp_flags);
  714. if (!fl)
  715. return NULL;
  716. rc = filelayout_decode_layout(layoutid, fl, lgr, &id, gfp_flags);
  717. if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, &id, gfp_flags)) {
  718. _filelayout_free_lseg(fl);
  719. return NULL;
  720. }
  721. return &fl->generic_hdr;
  722. }
  723. /*
  724. * filelayout_pg_test(). Called by nfs_can_coalesce_requests()
  725. *
  726. * Return 0 if @req cannot be coalesced into @pgio, otherwise return the number
  727. * of bytes (maximum @req->wb_bytes) that can be coalesced.
  728. */
  729. static size_t
  730. filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
  731. struct nfs_page *req)
  732. {
  733. unsigned int size;
  734. u64 p_stripe, r_stripe;
  735. u32 stripe_offset;
  736. u64 segment_offset = pgio->pg_lseg->pls_range.offset;
  737. u32 stripe_unit = FILELAYOUT_LSEG(pgio->pg_lseg)->stripe_unit;
  738. /* calls nfs_generic_pg_test */
  739. size = pnfs_generic_pg_test(pgio, prev, req);
  740. if (!size)
  741. return 0;
  742. /* see if req and prev are in the same stripe */
  743. if (prev) {
  744. p_stripe = (u64)req_offset(prev) - segment_offset;
  745. r_stripe = (u64)req_offset(req) - segment_offset;
  746. do_div(p_stripe, stripe_unit);
  747. do_div(r_stripe, stripe_unit);
  748. if (p_stripe != r_stripe)
  749. return 0;
  750. }
  751. /* calculate remaining bytes in the current stripe */
  752. div_u64_rem((u64)req_offset(req) - segment_offset,
  753. stripe_unit,
  754. &stripe_offset);
  755. WARN_ON_ONCE(stripe_offset > stripe_unit);
  756. if (stripe_offset >= stripe_unit)
  757. return 0;
  758. return min(stripe_unit - (unsigned int)stripe_offset, size);
  759. }
  760. static void
  761. filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
  762. struct nfs_page *req)
  763. {
  764. if (!pgio->pg_lseg)
  765. pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
  766. req->wb_context,
  767. 0,
  768. NFS4_MAX_UINT64,
  769. IOMODE_READ,
  770. GFP_KERNEL);
  771. /* If no lseg, fall back to read through mds */
  772. if (pgio->pg_lseg == NULL)
  773. nfs_pageio_reset_read_mds(pgio);
  774. }
  775. static void
  776. filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
  777. struct nfs_page *req)
  778. {
  779. struct nfs_commit_info cinfo;
  780. int status;
  781. if (!pgio->pg_lseg)
  782. pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
  783. req->wb_context,
  784. 0,
  785. NFS4_MAX_UINT64,
  786. IOMODE_RW,
  787. GFP_NOFS);
  788. /* If no lseg, fall back to write through mds */
  789. if (pgio->pg_lseg == NULL)
  790. goto out_mds;
  791. nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq);
  792. status = filelayout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS);
  793. if (status < 0) {
  794. pnfs_put_lseg(pgio->pg_lseg);
  795. pgio->pg_lseg = NULL;
  796. goto out_mds;
  797. }
  798. return;
  799. out_mds:
  800. nfs_pageio_reset_write_mds(pgio);
  801. }
  802. static const struct nfs_pageio_ops filelayout_pg_read_ops = {
  803. .pg_init = filelayout_pg_init_read,
  804. .pg_test = filelayout_pg_test,
  805. .pg_doio = pnfs_generic_pg_readpages,
  806. .pg_cleanup = pnfs_generic_pg_cleanup,
  807. };
  808. static const struct nfs_pageio_ops filelayout_pg_write_ops = {
  809. .pg_init = filelayout_pg_init_write,
  810. .pg_test = filelayout_pg_test,
  811. .pg_doio = pnfs_generic_pg_writepages,
  812. .pg_cleanup = pnfs_generic_pg_cleanup,
  813. };
  814. static u32 select_bucket_index(struct nfs4_filelayout_segment *fl, u32 j)
  815. {
  816. if (fl->stripe_type == STRIPE_SPARSE)
  817. return nfs4_fl_calc_ds_index(&fl->generic_hdr, j);
  818. else
  819. return j;
  820. }
  821. static void
  822. filelayout_mark_request_commit(struct nfs_page *req,
  823. struct pnfs_layout_segment *lseg,
  824. struct nfs_commit_info *cinfo,
  825. u32 ds_commit_idx)
  826. {
  827. struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
  828. u32 i, j;
  829. if (fl->commit_through_mds) {
  830. nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo);
  831. } else {
  832. /* Note that we are calling nfs4_fl_calc_j_index on each page
  833. * that ends up being committed to a data server. An attractive
  834. * alternative is to add a field to nfs_write_data and nfs_page
  835. * to store the value calculated in filelayout_write_pagelist
  836. * and just use that here.
  837. */
  838. j = nfs4_fl_calc_j_index(lseg, req_offset(req));
  839. i = select_bucket_index(fl, j);
  840. pnfs_layout_mark_request_commit(req, lseg, cinfo, i);
  841. }
  842. }
  843. static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i)
  844. {
  845. struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
  846. if (flseg->stripe_type == STRIPE_SPARSE)
  847. return i;
  848. else
  849. return nfs4_fl_calc_ds_index(lseg, i);
  850. }
  851. static struct nfs_fh *
  852. select_ds_fh_from_commit(struct pnfs_layout_segment *lseg, u32 i)
  853. {
  854. struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
  855. if (flseg->stripe_type == STRIPE_SPARSE) {
  856. if (flseg->num_fh == 1)
  857. i = 0;
  858. else if (flseg->num_fh == 0)
  859. /* Use the MDS OPEN fh set in nfs_read_rpcsetup */
  860. return NULL;
  861. }
  862. return flseg->fh_array[i];
  863. }
  864. static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
  865. {
  866. struct pnfs_layout_segment *lseg = data->lseg;
  867. struct nfs4_pnfs_ds *ds;
  868. struct rpc_clnt *ds_clnt;
  869. u32 idx;
  870. struct nfs_fh *fh;
  871. idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
  872. ds = nfs4_fl_prepare_ds(lseg, idx);
  873. if (!ds)
  874. goto out_err;
  875. ds_clnt = nfs4_find_or_create_ds_client(ds->ds_clp, data->inode);
  876. if (IS_ERR(ds_clnt))
  877. goto out_err;
  878. dprintk("%s ino %lu, how %d cl_count %d\n", __func__,
  879. data->inode->i_ino, how, atomic_read(&ds->ds_clp->cl_count));
  880. data->commit_done_cb = filelayout_commit_done_cb;
  881. atomic_inc(&ds->ds_clp->cl_count);
  882. data->ds_clp = ds->ds_clp;
  883. fh = select_ds_fh_from_commit(lseg, data->ds_commit_index);
  884. if (fh)
  885. data->args.fh = fh;
  886. return nfs_initiate_commit(ds_clnt, data, NFS_PROTO(data->inode),
  887. &filelayout_commit_call_ops, how,
  888. RPC_TASK_SOFTCONN);
  889. out_err:
  890. pnfs_generic_prepare_to_resend_writes(data);
  891. pnfs_generic_commit_release(data);
  892. return -EAGAIN;
  893. }
  894. /* filelayout_search_commit_reqs - Search lists in @cinfo for the head reqest
  895. * for @page
  896. * @cinfo - commit info for current inode
  897. * @page - page to search for matching head request
  898. *
  899. * Returns a the head request if one is found, otherwise returns NULL.
  900. */
  901. static struct nfs_page *
  902. filelayout_search_commit_reqs(struct nfs_commit_info *cinfo, struct page *page)
  903. {
  904. struct nfs_page *freq, *t;
  905. struct pnfs_commit_bucket *b;
  906. int i;
  907. /* Linearly search the commit lists for each bucket until a matching
  908. * request is found */
  909. for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) {
  910. list_for_each_entry_safe(freq, t, &b->written, wb_list) {
  911. if (freq->wb_page == page)
  912. return freq->wb_head;
  913. }
  914. list_for_each_entry_safe(freq, t, &b->committing, wb_list) {
  915. if (freq->wb_page == page)
  916. return freq->wb_head;
  917. }
  918. }
  919. return NULL;
  920. }
  921. static int
  922. filelayout_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
  923. int how, struct nfs_commit_info *cinfo)
  924. {
  925. return pnfs_generic_commit_pagelist(inode, mds_pages, how, cinfo,
  926. filelayout_initiate_commit);
  927. }
  928. static struct nfs4_deviceid_node *
  929. filelayout_alloc_deviceid_node(struct nfs_server *server,
  930. struct pnfs_device *pdev, gfp_t gfp_flags)
  931. {
  932. struct nfs4_file_layout_dsaddr *dsaddr;
  933. dsaddr = nfs4_fl_alloc_deviceid_node(server, pdev, gfp_flags);
  934. if (!dsaddr)
  935. return NULL;
  936. return &dsaddr->id_node;
  937. }
  938. static void
  939. filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
  940. {
  941. nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
  942. }
  943. static struct pnfs_layout_hdr *
  944. filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
  945. {
  946. struct nfs4_filelayout *flo;
  947. flo = kzalloc(sizeof(*flo), gfp_flags);
  948. return flo != NULL ? &flo->generic_hdr : NULL;
  949. }
  950. static void
  951. filelayout_free_layout_hdr(struct pnfs_layout_hdr *lo)
  952. {
  953. kfree(FILELAYOUT_FROM_HDR(lo));
  954. }
  955. static struct pnfs_ds_commit_info *
  956. filelayout_get_ds_info(struct inode *inode)
  957. {
  958. struct pnfs_layout_hdr *layout = NFS_I(inode)->layout;
  959. if (layout == NULL)
  960. return NULL;
  961. else
  962. return &FILELAYOUT_FROM_HDR(layout)->commit_info;
  963. }
  964. static struct pnfs_layoutdriver_type filelayout_type = {
  965. .id = LAYOUT_NFSV4_1_FILES,
  966. .name = "LAYOUT_NFSV4_1_FILES",
  967. .owner = THIS_MODULE,
  968. .alloc_layout_hdr = filelayout_alloc_layout_hdr,
  969. .free_layout_hdr = filelayout_free_layout_hdr,
  970. .alloc_lseg = filelayout_alloc_lseg,
  971. .free_lseg = filelayout_free_lseg,
  972. .pg_read_ops = &filelayout_pg_read_ops,
  973. .pg_write_ops = &filelayout_pg_write_ops,
  974. .get_ds_info = &filelayout_get_ds_info,
  975. .mark_request_commit = filelayout_mark_request_commit,
  976. .clear_request_commit = pnfs_generic_clear_request_commit,
  977. .scan_commit_lists = pnfs_generic_scan_commit_lists,
  978. .recover_commit_reqs = pnfs_generic_recover_commit_reqs,
  979. .search_commit_reqs = filelayout_search_commit_reqs,
  980. .commit_pagelist = filelayout_commit_pagelist,
  981. .read_pagelist = filelayout_read_pagelist,
  982. .write_pagelist = filelayout_write_pagelist,
  983. .alloc_deviceid_node = filelayout_alloc_deviceid_node,
  984. .free_deviceid_node = filelayout_free_deveiceid_node,
  985. };
  986. static int __init nfs4filelayout_init(void)
  987. {
  988. printk(KERN_INFO "%s: NFSv4 File Layout Driver Registering...\n",
  989. __func__);
  990. return pnfs_register_layoutdriver(&filelayout_type);
  991. }
  992. static void __exit nfs4filelayout_exit(void)
  993. {
  994. printk(KERN_INFO "%s: NFSv4 File Layout Driver Unregistering...\n",
  995. __func__);
  996. pnfs_unregister_layoutdriver(&filelayout_type);
  997. }
  998. MODULE_ALIAS("nfs-layouttype4-1");
  999. module_init(nfs4filelayout_init);
  1000. module_exit(nfs4filelayout_exit);