read.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. * linux/fs/nfs/read.c
  3. *
  4. * Block I/O for NFS
  5. *
  6. * Partial copy of Linus' read cache modifications to fs/nfs/file.c
  7. * modified for async RPC by okir@monad.swb.de
  8. */
  9. #include <linux/time.h>
  10. #include <linux/kernel.h>
  11. #include <linux/errno.h>
  12. #include <linux/fcntl.h>
  13. #include <linux/stat.h>
  14. #include <linux/mm.h>
  15. #include <linux/slab.h>
  16. #include <linux/pagemap.h>
  17. #include <linux/sunrpc/clnt.h>
  18. #include <linux/nfs_fs.h>
  19. #include <linux/nfs_page.h>
  20. #include <asm/system.h>
  21. #include "nfs4_fs.h"
  22. #include "internal.h"
  23. #include "iostat.h"
  24. #include "fscache.h"
  25. #include "pnfs.h"
  26. #define NFSDBG_FACILITY NFSDBG_PAGECACHE
  27. static int nfs_pagein_multi(struct inode *, struct list_head *, unsigned int, size_t, int);
  28. static int nfs_pagein_one(struct inode *, struct list_head *, unsigned int, size_t, int);
  29. static const struct rpc_call_ops nfs_read_partial_ops;
  30. static const struct rpc_call_ops nfs_read_full_ops;
  31. static struct kmem_cache *nfs_rdata_cachep;
  32. static mempool_t *nfs_rdata_mempool;
  33. #define MIN_POOL_READ (32)
  34. struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
  35. {
  36. struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, GFP_KERNEL);
  37. if (p) {
  38. memset(p, 0, sizeof(*p));
  39. INIT_LIST_HEAD(&p->pages);
  40. p->npages = pagecount;
  41. if (pagecount <= ARRAY_SIZE(p->page_array))
  42. p->pagevec = p->page_array;
  43. else {
  44. p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);
  45. if (!p->pagevec) {
  46. mempool_free(p, nfs_rdata_mempool);
  47. p = NULL;
  48. }
  49. }
  50. }
  51. return p;
  52. }
  53. void nfs_readdata_free(struct nfs_read_data *p)
  54. {
  55. if (p && (p->pagevec != &p->page_array[0]))
  56. kfree(p->pagevec);
  57. mempool_free(p, nfs_rdata_mempool);
  58. }
  59. static void nfs_readdata_release(struct nfs_read_data *rdata)
  60. {
  61. put_nfs_open_context(rdata->args.context);
  62. nfs_readdata_free(rdata);
  63. }
  64. static
  65. int nfs_return_empty_page(struct page *page)
  66. {
  67. zero_user(page, 0, PAGE_CACHE_SIZE);
  68. SetPageUptodate(page);
  69. unlock_page(page);
  70. return 0;
  71. }
  72. static void nfs_readpage_truncate_uninitialised_page(struct nfs_read_data *data)
  73. {
  74. unsigned int remainder = data->args.count - data->res.count;
  75. unsigned int base = data->args.pgbase + data->res.count;
  76. unsigned int pglen;
  77. struct page **pages;
  78. if (data->res.eof == 0 || remainder == 0)
  79. return;
  80. /*
  81. * Note: "remainder" can never be negative, since we check for
  82. * this in the XDR code.
  83. */
  84. pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
  85. base &= ~PAGE_CACHE_MASK;
  86. pglen = PAGE_CACHE_SIZE - base;
  87. for (;;) {
  88. if (remainder <= pglen) {
  89. zero_user(*pages, base, remainder);
  90. break;
  91. }
  92. zero_user(*pages, base, pglen);
  93. pages++;
  94. remainder -= pglen;
  95. pglen = PAGE_CACHE_SIZE;
  96. base = 0;
  97. }
  98. }
  99. int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
  100. struct page *page)
  101. {
  102. LIST_HEAD(one_request);
  103. struct nfs_page *new;
  104. unsigned int len;
  105. len = nfs_page_length(page);
  106. if (len == 0)
  107. return nfs_return_empty_page(page);
  108. pnfs_update_layout(inode, ctx, IOMODE_READ);
  109. new = nfs_create_request(ctx, inode, page, 0, len);
  110. if (IS_ERR(new)) {
  111. unlock_page(page);
  112. return PTR_ERR(new);
  113. }
  114. if (len < PAGE_CACHE_SIZE)
  115. zero_user_segment(page, len, PAGE_CACHE_SIZE);
  116. nfs_list_add_request(new, &one_request);
  117. if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE)
  118. nfs_pagein_multi(inode, &one_request, 1, len, 0);
  119. else
  120. nfs_pagein_one(inode, &one_request, 1, len, 0);
  121. return 0;
  122. }
  123. static void nfs_readpage_release(struct nfs_page *req)
  124. {
  125. struct inode *d_inode = req->wb_context->path.dentry->d_inode;
  126. if (PageUptodate(req->wb_page))
  127. nfs_readpage_to_fscache(d_inode, req->wb_page, 0);
  128. unlock_page(req->wb_page);
  129. dprintk("NFS: read done (%s/%Ld %d@%Ld)\n",
  130. req->wb_context->path.dentry->d_inode->i_sb->s_id,
  131. (long long)NFS_FILEID(req->wb_context->path.dentry->d_inode),
  132. req->wb_bytes,
  133. (long long)req_offset(req));
  134. nfs_clear_request(req);
  135. nfs_release_request(req);
  136. }
  137. /*
  138. * Set up the NFS read request struct
  139. */
  140. static int nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
  141. const struct rpc_call_ops *call_ops,
  142. unsigned int count, unsigned int offset)
  143. {
  144. struct inode *inode = req->wb_context->path.dentry->d_inode;
  145. int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
  146. struct rpc_task *task;
  147. struct rpc_message msg = {
  148. .rpc_argp = &data->args,
  149. .rpc_resp = &data->res,
  150. .rpc_cred = req->wb_context->cred,
  151. };
  152. struct rpc_task_setup task_setup_data = {
  153. .task = &data->task,
  154. .rpc_client = NFS_CLIENT(inode),
  155. .rpc_message = &msg,
  156. .callback_ops = call_ops,
  157. .callback_data = data,
  158. .workqueue = nfsiod_workqueue,
  159. .flags = RPC_TASK_ASYNC | swap_flags,
  160. };
  161. data->req = req;
  162. data->inode = inode;
  163. data->cred = msg.rpc_cred;
  164. data->args.fh = NFS_FH(inode);
  165. data->args.offset = req_offset(req) + offset;
  166. data->args.pgbase = req->wb_pgbase + offset;
  167. data->args.pages = data->pagevec;
  168. data->args.count = count;
  169. data->args.context = get_nfs_open_context(req->wb_context);
  170. data->args.lock_context = req->wb_lock_context;
  171. data->res.fattr = &data->fattr;
  172. data->res.count = count;
  173. data->res.eof = 0;
  174. nfs_fattr_init(&data->fattr);
  175. /* Set up the initial task struct. */
  176. NFS_PROTO(inode)->read_setup(data, &msg);
  177. dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
  178. data->task.tk_pid,
  179. inode->i_sb->s_id,
  180. (long long)NFS_FILEID(inode),
  181. count,
  182. (unsigned long long)data->args.offset);
  183. task = rpc_run_task(&task_setup_data);
  184. if (IS_ERR(task))
  185. return PTR_ERR(task);
  186. rpc_put_task(task);
  187. return 0;
  188. }
  189. static void
  190. nfs_async_read_error(struct list_head *head)
  191. {
  192. struct nfs_page *req;
  193. while (!list_empty(head)) {
  194. req = nfs_list_entry(head->next);
  195. nfs_list_remove_request(req);
  196. SetPageError(req->wb_page);
  197. nfs_readpage_release(req);
  198. }
  199. }
  200. /*
  201. * Generate multiple requests to fill a single page.
  202. *
  203. * We optimize to reduce the number of read operations on the wire. If we
  204. * detect that we're reading a page, or an area of a page, that is past the
  205. * end of file, we do not generate NFS read operations but just clear the
  206. * parts of the page that would have come back zero from the server anyway.
  207. *
  208. * We rely on the cached value of i_size to make this determination; another
  209. * client can fill pages on the server past our cached end-of-file, but we
  210. * won't see the new data until our attribute cache is updated. This is more
  211. * or less conventional NFS client behavior.
  212. */
  213. static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags)
  214. {
  215. struct nfs_page *req = nfs_list_entry(head->next);
  216. struct page *page = req->wb_page;
  217. struct nfs_read_data *data;
  218. size_t rsize = NFS_SERVER(inode)->rsize, nbytes;
  219. unsigned int offset;
  220. int requests = 0;
  221. int ret = 0;
  222. LIST_HEAD(list);
  223. nfs_list_remove_request(req);
  224. nbytes = count;
  225. do {
  226. size_t len = min(nbytes,rsize);
  227. data = nfs_readdata_alloc(1);
  228. if (!data)
  229. goto out_bad;
  230. list_add(&data->pages, &list);
  231. requests++;
  232. nbytes -= len;
  233. } while(nbytes != 0);
  234. atomic_set(&req->wb_complete, requests);
  235. ClearPageError(page);
  236. offset = 0;
  237. nbytes = count;
  238. do {
  239. int ret2;
  240. data = list_entry(list.next, struct nfs_read_data, pages);
  241. list_del_init(&data->pages);
  242. data->pagevec[0] = page;
  243. if (nbytes < rsize)
  244. rsize = nbytes;
  245. ret2 = nfs_read_rpcsetup(req, data, &nfs_read_partial_ops,
  246. rsize, offset);
  247. if (ret == 0)
  248. ret = ret2;
  249. offset += rsize;
  250. nbytes -= rsize;
  251. } while (nbytes != 0);
  252. return ret;
  253. out_bad:
  254. while (!list_empty(&list)) {
  255. data = list_entry(list.next, struct nfs_read_data, pages);
  256. list_del(&data->pages);
  257. nfs_readdata_free(data);
  258. }
  259. SetPageError(page);
  260. nfs_readpage_release(req);
  261. return -ENOMEM;
  262. }
  263. static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags)
  264. {
  265. struct nfs_page *req;
  266. struct page **pages;
  267. struct nfs_read_data *data;
  268. int ret = -ENOMEM;
  269. data = nfs_readdata_alloc(npages);
  270. if (!data)
  271. goto out_bad;
  272. pages = data->pagevec;
  273. while (!list_empty(head)) {
  274. req = nfs_list_entry(head->next);
  275. nfs_list_remove_request(req);
  276. nfs_list_add_request(req, &data->pages);
  277. ClearPageError(req->wb_page);
  278. *pages++ = req->wb_page;
  279. }
  280. req = nfs_list_entry(data->pages.next);
  281. return nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0);
  282. out_bad:
  283. nfs_async_read_error(head);
  284. return ret;
  285. }
  286. /*
  287. * This is the callback from RPC telling us whether a reply was
  288. * received or some error occurred (timeout or socket shutdown).
  289. */
  290. int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data)
  291. {
  292. int status;
  293. dprintk("NFS: %s: %5u, (status %d)\n", __func__, task->tk_pid,
  294. task->tk_status);
  295. status = NFS_PROTO(data->inode)->read_done(task, data);
  296. if (status != 0)
  297. return status;
  298. nfs_add_stats(data->inode, NFSIOS_SERVERREADBYTES, data->res.count);
  299. if (task->tk_status == -ESTALE) {
  300. set_bit(NFS_INO_STALE, &NFS_I(data->inode)->flags);
  301. nfs_mark_for_revalidate(data->inode);
  302. }
  303. return 0;
  304. }
  305. static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data)
  306. {
  307. struct nfs_readargs *argp = &data->args;
  308. struct nfs_readres *resp = &data->res;
  309. if (resp->eof || resp->count == argp->count)
  310. return;
  311. /* This is a short read! */
  312. nfs_inc_stats(data->inode, NFSIOS_SHORTREAD);
  313. /* Has the server at least made some progress? */
  314. if (resp->count == 0)
  315. return;
  316. /* Yes, so retry the read at the end of the data */
  317. argp->offset += resp->count;
  318. argp->pgbase += resp->count;
  319. argp->count -= resp->count;
  320. nfs_restart_rpc(task, NFS_SERVER(data->inode)->nfs_client);
  321. }
  322. /*
  323. * Handle a read reply that fills part of a page.
  324. */
  325. static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata)
  326. {
  327. struct nfs_read_data *data = calldata;
  328. if (nfs_readpage_result(task, data) != 0)
  329. return;
  330. if (task->tk_status < 0)
  331. return;
  332. nfs_readpage_truncate_uninitialised_page(data);
  333. nfs_readpage_retry(task, data);
  334. }
  335. static void nfs_readpage_release_partial(void *calldata)
  336. {
  337. struct nfs_read_data *data = calldata;
  338. struct nfs_page *req = data->req;
  339. struct page *page = req->wb_page;
  340. int status = data->task.tk_status;
  341. if (status < 0)
  342. SetPageError(page);
  343. if (atomic_dec_and_test(&req->wb_complete)) {
  344. if (!PageError(page))
  345. SetPageUptodate(page);
  346. nfs_readpage_release(req);
  347. }
  348. nfs_readdata_release(calldata);
  349. }
  350. #if defined(CONFIG_NFS_V4_1)
  351. void nfs_read_prepare(struct rpc_task *task, void *calldata)
  352. {
  353. struct nfs_read_data *data = calldata;
  354. if (nfs4_setup_sequence(NFS_SERVER(data->inode),
  355. &data->args.seq_args, &data->res.seq_res,
  356. 0, task))
  357. return;
  358. rpc_call_start(task);
  359. }
  360. #endif /* CONFIG_NFS_V4_1 */
  361. static const struct rpc_call_ops nfs_read_partial_ops = {
  362. #if defined(CONFIG_NFS_V4_1)
  363. .rpc_call_prepare = nfs_read_prepare,
  364. #endif /* CONFIG_NFS_V4_1 */
  365. .rpc_call_done = nfs_readpage_result_partial,
  366. .rpc_release = nfs_readpage_release_partial,
  367. };
  368. static void nfs_readpage_set_pages_uptodate(struct nfs_read_data *data)
  369. {
  370. unsigned int count = data->res.count;
  371. unsigned int base = data->args.pgbase;
  372. struct page **pages;
  373. if (data->res.eof)
  374. count = data->args.count;
  375. if (unlikely(count == 0))
  376. return;
  377. pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
  378. base &= ~PAGE_CACHE_MASK;
  379. count += base;
  380. for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++)
  381. SetPageUptodate(*pages);
  382. if (count == 0)
  383. return;
  384. /* Was this a short read? */
  385. if (data->res.eof || data->res.count == data->args.count)
  386. SetPageUptodate(*pages);
  387. }
  388. /*
  389. * This is the callback from RPC telling us whether a reply was
  390. * received or some error occurred (timeout or socket shutdown).
  391. */
  392. static void nfs_readpage_result_full(struct rpc_task *task, void *calldata)
  393. {
  394. struct nfs_read_data *data = calldata;
  395. if (nfs_readpage_result(task, data) != 0)
  396. return;
  397. if (task->tk_status < 0)
  398. return;
  399. /*
  400. * Note: nfs_readpage_retry may change the values of
  401. * data->args. In the multi-page case, we therefore need
  402. * to ensure that we call nfs_readpage_set_pages_uptodate()
  403. * first.
  404. */
  405. nfs_readpage_truncate_uninitialised_page(data);
  406. nfs_readpage_set_pages_uptodate(data);
  407. nfs_readpage_retry(task, data);
  408. }
  409. static void nfs_readpage_release_full(void *calldata)
  410. {
  411. struct nfs_read_data *data = calldata;
  412. while (!list_empty(&data->pages)) {
  413. struct nfs_page *req = nfs_list_entry(data->pages.next);
  414. nfs_list_remove_request(req);
  415. nfs_readpage_release(req);
  416. }
  417. nfs_readdata_release(calldata);
  418. }
  419. static const struct rpc_call_ops nfs_read_full_ops = {
  420. #if defined(CONFIG_NFS_V4_1)
  421. .rpc_call_prepare = nfs_read_prepare,
  422. #endif /* CONFIG_NFS_V4_1 */
  423. .rpc_call_done = nfs_readpage_result_full,
  424. .rpc_release = nfs_readpage_release_full,
  425. };
  426. /*
  427. * Read a page over NFS.
  428. * We read the page synchronously in the following case:
  429. * - The error flag is set for this page. This happens only when a
  430. * previous async read operation failed.
  431. */
  432. int nfs_readpage(struct file *file, struct page *page)
  433. {
  434. struct nfs_open_context *ctx;
  435. struct inode *inode = page->mapping->host;
  436. int error;
  437. dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
  438. page, PAGE_CACHE_SIZE, page->index);
  439. nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
  440. nfs_add_stats(inode, NFSIOS_READPAGES, 1);
  441. /*
  442. * Try to flush any pending writes to the file..
  443. *
  444. * NOTE! Because we own the page lock, there cannot
  445. * be any new pending writes generated at this point
  446. * for this page (other pages can be written to).
  447. */
  448. error = nfs_wb_page(inode, page);
  449. if (error)
  450. goto out_unlock;
  451. if (PageUptodate(page))
  452. goto out_unlock;
  453. error = -ESTALE;
  454. if (NFS_STALE(inode))
  455. goto out_unlock;
  456. if (file == NULL) {
  457. error = -EBADF;
  458. ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
  459. if (ctx == NULL)
  460. goto out_unlock;
  461. } else
  462. ctx = get_nfs_open_context(nfs_file_open_context(file));
  463. if (!IS_SYNC(inode)) {
  464. error = nfs_readpage_from_fscache(ctx, inode, page);
  465. if (error == 0)
  466. goto out;
  467. }
  468. error = nfs_readpage_async(ctx, inode, page);
  469. out:
  470. put_nfs_open_context(ctx);
  471. return error;
  472. out_unlock:
  473. unlock_page(page);
  474. return error;
  475. }
  476. struct nfs_readdesc {
  477. struct nfs_pageio_descriptor *pgio;
  478. struct nfs_open_context *ctx;
  479. };
  480. static int
  481. readpage_async_filler(void *data, struct page *page)
  482. {
  483. struct nfs_readdesc *desc = (struct nfs_readdesc *)data;
  484. struct inode *inode = page->mapping->host;
  485. struct nfs_page *new;
  486. unsigned int len;
  487. int error;
  488. len = nfs_page_length(page);
  489. if (len == 0)
  490. return nfs_return_empty_page(page);
  491. new = nfs_create_request(desc->ctx, inode, page, 0, len);
  492. if (IS_ERR(new))
  493. goto out_error;
  494. if (len < PAGE_CACHE_SIZE)
  495. zero_user_segment(page, len, PAGE_CACHE_SIZE);
  496. if (!nfs_pageio_add_request(desc->pgio, new)) {
  497. error = desc->pgio->pg_error;
  498. goto out_unlock;
  499. }
  500. return 0;
  501. out_error:
  502. error = PTR_ERR(new);
  503. SetPageError(page);
  504. out_unlock:
  505. unlock_page(page);
  506. return error;
  507. }
  508. int nfs_readpages(struct file *filp, struct address_space *mapping,
  509. struct list_head *pages, unsigned nr_pages)
  510. {
  511. struct nfs_pageio_descriptor pgio;
  512. struct nfs_readdesc desc = {
  513. .pgio = &pgio,
  514. };
  515. struct inode *inode = mapping->host;
  516. struct nfs_server *server = NFS_SERVER(inode);
  517. size_t rsize = server->rsize;
  518. unsigned long npages;
  519. int ret = -ESTALE;
  520. dprintk("NFS: nfs_readpages (%s/%Ld %d)\n",
  521. inode->i_sb->s_id,
  522. (long long)NFS_FILEID(inode),
  523. nr_pages);
  524. nfs_inc_stats(inode, NFSIOS_VFSREADPAGES);
  525. if (NFS_STALE(inode))
  526. goto out;
  527. if (filp == NULL) {
  528. desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
  529. if (desc.ctx == NULL)
  530. return -EBADF;
  531. } else
  532. desc.ctx = get_nfs_open_context(nfs_file_open_context(filp));
  533. /* attempt to read as many of the pages as possible from the cache
  534. * - this returns -ENOBUFS immediately if the cookie is negative
  535. */
  536. ret = nfs_readpages_from_fscache(desc.ctx, inode, mapping,
  537. pages, &nr_pages);
  538. if (ret == 0)
  539. goto read_complete; /* all pages were read */
  540. pnfs_update_layout(inode, desc.ctx, IOMODE_READ);
  541. if (rsize < PAGE_CACHE_SIZE)
  542. nfs_pageio_init(&pgio, inode, nfs_pagein_multi, rsize, 0);
  543. else
  544. nfs_pageio_init(&pgio, inode, nfs_pagein_one, rsize, 0);
  545. ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc);
  546. nfs_pageio_complete(&pgio);
  547. npages = (pgio.pg_bytes_written + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
  548. nfs_add_stats(inode, NFSIOS_READPAGES, npages);
  549. read_complete:
  550. put_nfs_open_context(desc.ctx);
  551. out:
  552. return ret;
  553. }
  554. int __init nfs_init_readpagecache(void)
  555. {
  556. nfs_rdata_cachep = kmem_cache_create("nfs_read_data",
  557. sizeof(struct nfs_read_data),
  558. 0, SLAB_HWCACHE_ALIGN,
  559. NULL);
  560. if (nfs_rdata_cachep == NULL)
  561. return -ENOMEM;
  562. nfs_rdata_mempool = mempool_create_slab_pool(MIN_POOL_READ,
  563. nfs_rdata_cachep);
  564. if (nfs_rdata_mempool == NULL)
  565. return -ENOMEM;
  566. return 0;
  567. }
  568. void nfs_destroy_readpagecache(void)
  569. {
  570. mempool_destroy(nfs_rdata_mempool);
  571. kmem_cache_destroy(nfs_rdata_cachep);
  572. }