page.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /* Cache page management and data I/O routines
  3. *
  4. * Copyright (C) 2004-2008 Red Hat, Inc. All Rights Reserved.
  5. * Written by David Howells (dhowells@redhat.com)
  6. */
  7. #define FSCACHE_DEBUG_LEVEL PAGE
  8. #include <linux/module.h>
  9. #include <linux/fscache-cache.h>
  10. #include <linux/buffer_head.h>
  11. #include <linux/pagevec.h>
  12. #include <linux/slab.h>
  13. #include "internal.h"
  14. /*
  15. * check to see if a page is being written to the cache
  16. */
  17. bool __fscache_check_page_write(struct fscache_cookie *cookie, struct page *page)
  18. {
  19. void *val;
  20. rcu_read_lock();
  21. val = radix_tree_lookup(&cookie->stores, page->index);
  22. rcu_read_unlock();
  23. trace_fscache_check_page(cookie, page, val, 0);
  24. return val != NULL;
  25. }
  26. EXPORT_SYMBOL(__fscache_check_page_write);
  27. /*
  28. * wait for a page to finish being written to the cache
  29. */
  30. void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *page)
  31. {
  32. wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0);
  33. trace_fscache_page(cookie, page, fscache_page_write_wait);
  34. wait_event(*wq, !__fscache_check_page_write(cookie, page));
  35. }
  36. EXPORT_SYMBOL(__fscache_wait_on_page_write);
  37. /*
  38. * wait for a page to finish being written to the cache. Put a timeout here
  39. * since we might be called recursively via parent fs.
  40. */
  41. static
  42. bool release_page_wait_timeout(struct fscache_cookie *cookie, struct page *page)
  43. {
  44. wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0);
  45. return wait_event_timeout(*wq, !__fscache_check_page_write(cookie, page),
  46. HZ);
  47. }
  48. /*
  49. * decide whether a page can be released, possibly by cancelling a store to it
  50. * - we're allowed to sleep if __GFP_DIRECT_RECLAIM is flagged
  51. */
  52. bool __fscache_maybe_release_page(struct fscache_cookie *cookie,
  53. struct page *page,
  54. gfp_t gfp)
  55. {
  56. struct page *xpage;
  57. void *val;
  58. _enter("%p,%p,%x", cookie, page, gfp);
  59. trace_fscache_page(cookie, page, fscache_page_maybe_release);
  60. try_again:
  61. rcu_read_lock();
  62. val = radix_tree_lookup(&cookie->stores, page->index);
  63. if (!val) {
  64. rcu_read_unlock();
  65. fscache_stat(&fscache_n_store_vmscan_not_storing);
  66. __fscache_uncache_page(cookie, page);
  67. return true;
  68. }
  69. /* see if the page is actually undergoing storage - if so we can't get
  70. * rid of it till the cache has finished with it */
  71. if (radix_tree_tag_get(&cookie->stores, page->index,
  72. FSCACHE_COOKIE_STORING_TAG)) {
  73. rcu_read_unlock();
  74. goto page_busy;
  75. }
  76. /* the page is pending storage, so we attempt to cancel the store and
  77. * discard the store request so that the page can be reclaimed */
  78. spin_lock(&cookie->stores_lock);
  79. rcu_read_unlock();
  80. if (radix_tree_tag_get(&cookie->stores, page->index,
  81. FSCACHE_COOKIE_STORING_TAG)) {
  82. /* the page started to undergo storage whilst we were looking,
  83. * so now we can only wait or return */
  84. spin_unlock(&cookie->stores_lock);
  85. goto page_busy;
  86. }
  87. xpage = radix_tree_delete(&cookie->stores, page->index);
  88. trace_fscache_page(cookie, page, fscache_page_radix_delete);
  89. spin_unlock(&cookie->stores_lock);
  90. if (xpage) {
  91. fscache_stat(&fscache_n_store_vmscan_cancelled);
  92. fscache_stat(&fscache_n_store_radix_deletes);
  93. ASSERTCMP(xpage, ==, page);
  94. } else {
  95. fscache_stat(&fscache_n_store_vmscan_gone);
  96. }
  97. wake_up_bit(&cookie->flags, 0);
  98. trace_fscache_wake_cookie(cookie);
  99. if (xpage)
  100. put_page(xpage);
  101. __fscache_uncache_page(cookie, page);
  102. return true;
  103. page_busy:
  104. /* We will wait here if we're allowed to, but that could deadlock the
  105. * allocator as the work threads writing to the cache may all end up
  106. * sleeping on memory allocation, so we may need to impose a timeout
  107. * too. */
  108. if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS)) {
  109. fscache_stat(&fscache_n_store_vmscan_busy);
  110. return false;
  111. }
  112. fscache_stat(&fscache_n_store_vmscan_wait);
  113. if (!release_page_wait_timeout(cookie, page))
  114. _debug("fscache writeout timeout page: %p{%lx}",
  115. page, page->index);
  116. gfp &= ~__GFP_DIRECT_RECLAIM;
  117. goto try_again;
  118. }
  119. EXPORT_SYMBOL(__fscache_maybe_release_page);
  120. /*
  121. * note that a page has finished being written to the cache
  122. */
  123. static void fscache_end_page_write(struct fscache_object *object,
  124. struct page *page)
  125. {
  126. struct fscache_cookie *cookie;
  127. struct page *xpage = NULL, *val;
  128. spin_lock(&object->lock);
  129. cookie = object->cookie;
  130. if (cookie) {
  131. /* delete the page from the tree if it is now no longer
  132. * pending */
  133. spin_lock(&cookie->stores_lock);
  134. radix_tree_tag_clear(&cookie->stores, page->index,
  135. FSCACHE_COOKIE_STORING_TAG);
  136. trace_fscache_page(cookie, page, fscache_page_radix_clear_store);
  137. if (!radix_tree_tag_get(&cookie->stores, page->index,
  138. FSCACHE_COOKIE_PENDING_TAG)) {
  139. fscache_stat(&fscache_n_store_radix_deletes);
  140. xpage = radix_tree_delete(&cookie->stores, page->index);
  141. trace_fscache_page(cookie, page, fscache_page_radix_delete);
  142. trace_fscache_page(cookie, page, fscache_page_write_end);
  143. val = radix_tree_lookup(&cookie->stores, page->index);
  144. trace_fscache_check_page(cookie, page, val, 1);
  145. } else {
  146. trace_fscache_page(cookie, page, fscache_page_write_end_pend);
  147. }
  148. spin_unlock(&cookie->stores_lock);
  149. wake_up_bit(&cookie->flags, 0);
  150. trace_fscache_wake_cookie(cookie);
  151. } else {
  152. trace_fscache_page(cookie, page, fscache_page_write_end_noc);
  153. }
  154. spin_unlock(&object->lock);
  155. if (xpage)
  156. put_page(xpage);
  157. }
  158. /*
  159. * actually apply the changed attributes to a cache object
  160. */
  161. static void fscache_attr_changed_op(struct fscache_operation *op)
  162. {
  163. struct fscache_object *object = op->object;
  164. int ret;
  165. _enter("{OBJ%x OP%x}", object->debug_id, op->debug_id);
  166. fscache_stat(&fscache_n_attr_changed_calls);
  167. if (fscache_object_is_active(object)) {
  168. fscache_stat(&fscache_n_cop_attr_changed);
  169. ret = object->cache->ops->attr_changed(object);
  170. fscache_stat_d(&fscache_n_cop_attr_changed);
  171. if (ret < 0)
  172. fscache_abort_object(object);
  173. fscache_op_complete(op, ret < 0);
  174. } else {
  175. fscache_op_complete(op, true);
  176. }
  177. _leave("");
  178. }
  179. /*
  180. * notification that the attributes on an object have changed
  181. */
  182. int __fscache_attr_changed(struct fscache_cookie *cookie)
  183. {
  184. struct fscache_operation *op;
  185. struct fscache_object *object;
  186. bool wake_cookie = false;
  187. _enter("%p", cookie);
  188. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  189. fscache_stat(&fscache_n_attr_changed);
  190. op = kzalloc(sizeof(*op), GFP_KERNEL);
  191. if (!op) {
  192. fscache_stat(&fscache_n_attr_changed_nomem);
  193. _leave(" = -ENOMEM");
  194. return -ENOMEM;
  195. }
  196. fscache_operation_init(cookie, op, fscache_attr_changed_op, NULL, NULL);
  197. trace_fscache_page_op(cookie, NULL, op, fscache_page_op_attr_changed);
  198. op->flags = FSCACHE_OP_ASYNC |
  199. (1 << FSCACHE_OP_EXCLUSIVE) |
  200. (1 << FSCACHE_OP_UNUSE_COOKIE);
  201. spin_lock(&cookie->lock);
  202. if (!fscache_cookie_enabled(cookie) ||
  203. hlist_empty(&cookie->backing_objects))
  204. goto nobufs;
  205. object = hlist_entry(cookie->backing_objects.first,
  206. struct fscache_object, cookie_link);
  207. __fscache_use_cookie(cookie);
  208. if (fscache_submit_exclusive_op(object, op) < 0)
  209. goto nobufs_dec;
  210. spin_unlock(&cookie->lock);
  211. fscache_stat(&fscache_n_attr_changed_ok);
  212. fscache_put_operation(op);
  213. _leave(" = 0");
  214. return 0;
  215. nobufs_dec:
  216. wake_cookie = __fscache_unuse_cookie(cookie);
  217. nobufs:
  218. spin_unlock(&cookie->lock);
  219. fscache_put_operation(op);
  220. if (wake_cookie)
  221. __fscache_wake_unused_cookie(cookie);
  222. fscache_stat(&fscache_n_attr_changed_nobufs);
  223. _leave(" = %d", -ENOBUFS);
  224. return -ENOBUFS;
  225. }
  226. EXPORT_SYMBOL(__fscache_attr_changed);
  227. /*
  228. * Handle cancellation of a pending retrieval op
  229. */
  230. static void fscache_do_cancel_retrieval(struct fscache_operation *_op)
  231. {
  232. struct fscache_retrieval *op =
  233. container_of(_op, struct fscache_retrieval, op);
  234. atomic_set(&op->n_pages, 0);
  235. }
  236. /*
  237. * release a retrieval op reference
  238. */
  239. static void fscache_release_retrieval_op(struct fscache_operation *_op)
  240. {
  241. struct fscache_retrieval *op =
  242. container_of(_op, struct fscache_retrieval, op);
  243. _enter("{OP%x}", op->op.debug_id);
  244. ASSERTIFCMP(op->op.state != FSCACHE_OP_ST_INITIALISED,
  245. atomic_read(&op->n_pages), ==, 0);
  246. fscache_hist(fscache_retrieval_histogram, op->start_time);
  247. if (op->context)
  248. fscache_put_context(op->cookie, op->context);
  249. _leave("");
  250. }
  251. /*
  252. * allocate a retrieval op
  253. */
  254. static struct fscache_retrieval *fscache_alloc_retrieval(
  255. struct fscache_cookie *cookie,
  256. struct address_space *mapping,
  257. fscache_rw_complete_t end_io_func,
  258. void *context)
  259. {
  260. struct fscache_retrieval *op;
  261. /* allocate a retrieval operation and attempt to submit it */
  262. op = kzalloc(sizeof(*op), GFP_NOIO);
  263. if (!op) {
  264. fscache_stat(&fscache_n_retrievals_nomem);
  265. return NULL;
  266. }
  267. fscache_operation_init(cookie, &op->op, NULL,
  268. fscache_do_cancel_retrieval,
  269. fscache_release_retrieval_op);
  270. op->op.flags = FSCACHE_OP_MYTHREAD |
  271. (1UL << FSCACHE_OP_WAITING) |
  272. (1UL << FSCACHE_OP_UNUSE_COOKIE);
  273. op->cookie = cookie;
  274. op->mapping = mapping;
  275. op->end_io_func = end_io_func;
  276. op->context = context;
  277. op->start_time = jiffies;
  278. INIT_LIST_HEAD(&op->to_do);
  279. /* Pin the netfs read context in case we need to do the actual netfs
  280. * read because we've encountered a cache read failure.
  281. */
  282. if (context)
  283. fscache_get_context(op->cookie, context);
  284. return op;
  285. }
  286. /*
  287. * wait for a deferred lookup to complete
  288. */
  289. int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie)
  290. {
  291. unsigned long jif;
  292. _enter("");
  293. if (!test_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags)) {
  294. _leave(" = 0 [imm]");
  295. return 0;
  296. }
  297. fscache_stat(&fscache_n_retrievals_wait);
  298. jif = jiffies;
  299. if (wait_on_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP,
  300. TASK_INTERRUPTIBLE) != 0) {
  301. fscache_stat(&fscache_n_retrievals_intr);
  302. _leave(" = -ERESTARTSYS");
  303. return -ERESTARTSYS;
  304. }
  305. ASSERT(!test_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags));
  306. smp_rmb();
  307. fscache_hist(fscache_retrieval_delay_histogram, jif);
  308. _leave(" = 0 [dly]");
  309. return 0;
  310. }
  311. /*
  312. * wait for an object to become active (or dead)
  313. */
  314. int fscache_wait_for_operation_activation(struct fscache_object *object,
  315. struct fscache_operation *op,
  316. atomic_t *stat_op_waits,
  317. atomic_t *stat_object_dead)
  318. {
  319. int ret;
  320. if (!test_bit(FSCACHE_OP_WAITING, &op->flags))
  321. goto check_if_dead;
  322. _debug(">>> WT");
  323. if (stat_op_waits)
  324. fscache_stat(stat_op_waits);
  325. if (wait_on_bit(&op->flags, FSCACHE_OP_WAITING,
  326. TASK_INTERRUPTIBLE) != 0) {
  327. trace_fscache_op(object->cookie, op, fscache_op_signal);
  328. ret = fscache_cancel_op(op, false);
  329. if (ret == 0)
  330. return -ERESTARTSYS;
  331. /* it's been removed from the pending queue by another party,
  332. * so we should get to run shortly */
  333. wait_on_bit(&op->flags, FSCACHE_OP_WAITING,
  334. TASK_UNINTERRUPTIBLE);
  335. }
  336. _debug("<<< GO");
  337. check_if_dead:
  338. if (op->state == FSCACHE_OP_ST_CANCELLED) {
  339. if (stat_object_dead)
  340. fscache_stat(stat_object_dead);
  341. _leave(" = -ENOBUFS [cancelled]");
  342. return -ENOBUFS;
  343. }
  344. if (unlikely(fscache_object_is_dying(object) ||
  345. fscache_cache_is_broken(object))) {
  346. enum fscache_operation_state state = op->state;
  347. trace_fscache_op(object->cookie, op, fscache_op_signal);
  348. fscache_cancel_op(op, true);
  349. if (stat_object_dead)
  350. fscache_stat(stat_object_dead);
  351. _leave(" = -ENOBUFS [obj dead %d]", state);
  352. return -ENOBUFS;
  353. }
  354. return 0;
  355. }
  356. /*
  357. * read a page from the cache or allocate a block in which to store it
  358. * - we return:
  359. * -ENOMEM - out of memory, nothing done
  360. * -ERESTARTSYS - interrupted
  361. * -ENOBUFS - no backing object available in which to cache the block
  362. * -ENODATA - no data available in the backing object for this block
  363. * 0 - dispatched a read - it'll call end_io_func() when finished
  364. */
  365. int __fscache_read_or_alloc_page(struct fscache_cookie *cookie,
  366. struct page *page,
  367. fscache_rw_complete_t end_io_func,
  368. void *context,
  369. gfp_t gfp)
  370. {
  371. struct fscache_retrieval *op;
  372. struct fscache_object *object;
  373. bool wake_cookie = false;
  374. int ret;
  375. _enter("%p,%p,,,", cookie, page);
  376. fscache_stat(&fscache_n_retrievals);
  377. if (hlist_empty(&cookie->backing_objects))
  378. goto nobufs;
  379. if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) {
  380. _leave(" = -ENOBUFS [invalidating]");
  381. return -ENOBUFS;
  382. }
  383. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  384. ASSERTCMP(page, !=, NULL);
  385. if (fscache_wait_for_deferred_lookup(cookie) < 0)
  386. return -ERESTARTSYS;
  387. op = fscache_alloc_retrieval(cookie, page->mapping,
  388. end_io_func, context);
  389. if (!op) {
  390. _leave(" = -ENOMEM");
  391. return -ENOMEM;
  392. }
  393. atomic_set(&op->n_pages, 1);
  394. trace_fscache_page_op(cookie, page, &op->op, fscache_page_op_retr_one);
  395. spin_lock(&cookie->lock);
  396. if (!fscache_cookie_enabled(cookie) ||
  397. hlist_empty(&cookie->backing_objects))
  398. goto nobufs_unlock;
  399. object = hlist_entry(cookie->backing_objects.first,
  400. struct fscache_object, cookie_link);
  401. ASSERT(test_bit(FSCACHE_OBJECT_IS_LOOKED_UP, &object->flags));
  402. __fscache_use_cookie(cookie);
  403. atomic_inc(&object->n_reads);
  404. __set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags);
  405. if (fscache_submit_op(object, &op->op) < 0)
  406. goto nobufs_unlock_dec;
  407. spin_unlock(&cookie->lock);
  408. fscache_stat(&fscache_n_retrieval_ops);
  409. /* we wait for the operation to become active, and then process it
  410. * *here*, in this thread, and not in the thread pool */
  411. ret = fscache_wait_for_operation_activation(
  412. object, &op->op,
  413. __fscache_stat(&fscache_n_retrieval_op_waits),
  414. __fscache_stat(&fscache_n_retrievals_object_dead));
  415. if (ret < 0)
  416. goto error;
  417. /* ask the cache to honour the operation */
  418. if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
  419. fscache_stat(&fscache_n_cop_allocate_page);
  420. ret = object->cache->ops->allocate_page(op, page, gfp);
  421. fscache_stat_d(&fscache_n_cop_allocate_page);
  422. if (ret == 0)
  423. ret = -ENODATA;
  424. } else {
  425. fscache_stat(&fscache_n_cop_read_or_alloc_page);
  426. ret = object->cache->ops->read_or_alloc_page(op, page, gfp);
  427. fscache_stat_d(&fscache_n_cop_read_or_alloc_page);
  428. }
  429. error:
  430. if (ret == -ENOMEM)
  431. fscache_stat(&fscache_n_retrievals_nomem);
  432. else if (ret == -ERESTARTSYS)
  433. fscache_stat(&fscache_n_retrievals_intr);
  434. else if (ret == -ENODATA)
  435. fscache_stat(&fscache_n_retrievals_nodata);
  436. else if (ret < 0)
  437. fscache_stat(&fscache_n_retrievals_nobufs);
  438. else
  439. fscache_stat(&fscache_n_retrievals_ok);
  440. fscache_put_retrieval(op);
  441. _leave(" = %d", ret);
  442. return ret;
  443. nobufs_unlock_dec:
  444. atomic_dec(&object->n_reads);
  445. wake_cookie = __fscache_unuse_cookie(cookie);
  446. nobufs_unlock:
  447. spin_unlock(&cookie->lock);
  448. if (wake_cookie)
  449. __fscache_wake_unused_cookie(cookie);
  450. fscache_put_retrieval(op);
  451. nobufs:
  452. fscache_stat(&fscache_n_retrievals_nobufs);
  453. _leave(" = -ENOBUFS");
  454. return -ENOBUFS;
  455. }
  456. EXPORT_SYMBOL(__fscache_read_or_alloc_page);
  457. /*
  458. * read a list of page from the cache or allocate a block in which to store
  459. * them
  460. * - we return:
  461. * -ENOMEM - out of memory, some pages may be being read
  462. * -ERESTARTSYS - interrupted, some pages may be being read
  463. * -ENOBUFS - no backing object or space available in which to cache any
  464. * pages not being read
  465. * -ENODATA - no data available in the backing object for some or all of
  466. * the pages
  467. * 0 - dispatched a read on all pages
  468. *
  469. * end_io_func() will be called for each page read from the cache as it is
  470. * finishes being read
  471. *
  472. * any pages for which a read is dispatched will be removed from pages and
  473. * nr_pages
  474. */
  475. int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
  476. struct address_space *mapping,
  477. struct list_head *pages,
  478. unsigned *nr_pages,
  479. fscache_rw_complete_t end_io_func,
  480. void *context,
  481. gfp_t gfp)
  482. {
  483. struct fscache_retrieval *op;
  484. struct fscache_object *object;
  485. bool wake_cookie = false;
  486. int ret;
  487. _enter("%p,,%d,,,", cookie, *nr_pages);
  488. fscache_stat(&fscache_n_retrievals);
  489. if (hlist_empty(&cookie->backing_objects))
  490. goto nobufs;
  491. if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) {
  492. _leave(" = -ENOBUFS [invalidating]");
  493. return -ENOBUFS;
  494. }
  495. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  496. ASSERTCMP(*nr_pages, >, 0);
  497. ASSERT(!list_empty(pages));
  498. if (fscache_wait_for_deferred_lookup(cookie) < 0)
  499. return -ERESTARTSYS;
  500. op = fscache_alloc_retrieval(cookie, mapping, end_io_func, context);
  501. if (!op)
  502. return -ENOMEM;
  503. atomic_set(&op->n_pages, *nr_pages);
  504. trace_fscache_page_op(cookie, NULL, &op->op, fscache_page_op_retr_multi);
  505. spin_lock(&cookie->lock);
  506. if (!fscache_cookie_enabled(cookie) ||
  507. hlist_empty(&cookie->backing_objects))
  508. goto nobufs_unlock;
  509. object = hlist_entry(cookie->backing_objects.first,
  510. struct fscache_object, cookie_link);
  511. __fscache_use_cookie(cookie);
  512. atomic_inc(&object->n_reads);
  513. __set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags);
  514. if (fscache_submit_op(object, &op->op) < 0)
  515. goto nobufs_unlock_dec;
  516. spin_unlock(&cookie->lock);
  517. fscache_stat(&fscache_n_retrieval_ops);
  518. /* we wait for the operation to become active, and then process it
  519. * *here*, in this thread, and not in the thread pool */
  520. ret = fscache_wait_for_operation_activation(
  521. object, &op->op,
  522. __fscache_stat(&fscache_n_retrieval_op_waits),
  523. __fscache_stat(&fscache_n_retrievals_object_dead));
  524. if (ret < 0)
  525. goto error;
  526. /* ask the cache to honour the operation */
  527. if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
  528. fscache_stat(&fscache_n_cop_allocate_pages);
  529. ret = object->cache->ops->allocate_pages(
  530. op, pages, nr_pages, gfp);
  531. fscache_stat_d(&fscache_n_cop_allocate_pages);
  532. } else {
  533. fscache_stat(&fscache_n_cop_read_or_alloc_pages);
  534. ret = object->cache->ops->read_or_alloc_pages(
  535. op, pages, nr_pages, gfp);
  536. fscache_stat_d(&fscache_n_cop_read_or_alloc_pages);
  537. }
  538. error:
  539. if (ret == -ENOMEM)
  540. fscache_stat(&fscache_n_retrievals_nomem);
  541. else if (ret == -ERESTARTSYS)
  542. fscache_stat(&fscache_n_retrievals_intr);
  543. else if (ret == -ENODATA)
  544. fscache_stat(&fscache_n_retrievals_nodata);
  545. else if (ret < 0)
  546. fscache_stat(&fscache_n_retrievals_nobufs);
  547. else
  548. fscache_stat(&fscache_n_retrievals_ok);
  549. fscache_put_retrieval(op);
  550. _leave(" = %d", ret);
  551. return ret;
  552. nobufs_unlock_dec:
  553. atomic_dec(&object->n_reads);
  554. wake_cookie = __fscache_unuse_cookie(cookie);
  555. nobufs_unlock:
  556. spin_unlock(&cookie->lock);
  557. fscache_put_retrieval(op);
  558. if (wake_cookie)
  559. __fscache_wake_unused_cookie(cookie);
  560. nobufs:
  561. fscache_stat(&fscache_n_retrievals_nobufs);
  562. _leave(" = -ENOBUFS");
  563. return -ENOBUFS;
  564. }
  565. EXPORT_SYMBOL(__fscache_read_or_alloc_pages);
  566. /*
  567. * allocate a block in the cache on which to store a page
  568. * - we return:
  569. * -ENOMEM - out of memory, nothing done
  570. * -ERESTARTSYS - interrupted
  571. * -ENOBUFS - no backing object available in which to cache the block
  572. * 0 - block allocated
  573. */
  574. int __fscache_alloc_page(struct fscache_cookie *cookie,
  575. struct page *page,
  576. gfp_t gfp)
  577. {
  578. struct fscache_retrieval *op;
  579. struct fscache_object *object;
  580. bool wake_cookie = false;
  581. int ret;
  582. _enter("%p,%p,,,", cookie, page);
  583. fscache_stat(&fscache_n_allocs);
  584. if (hlist_empty(&cookie->backing_objects))
  585. goto nobufs;
  586. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  587. ASSERTCMP(page, !=, NULL);
  588. if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) {
  589. _leave(" = -ENOBUFS [invalidating]");
  590. return -ENOBUFS;
  591. }
  592. if (fscache_wait_for_deferred_lookup(cookie) < 0)
  593. return -ERESTARTSYS;
  594. op = fscache_alloc_retrieval(cookie, page->mapping, NULL, NULL);
  595. if (!op)
  596. return -ENOMEM;
  597. atomic_set(&op->n_pages, 1);
  598. trace_fscache_page_op(cookie, page, &op->op, fscache_page_op_alloc_one);
  599. spin_lock(&cookie->lock);
  600. if (!fscache_cookie_enabled(cookie) ||
  601. hlist_empty(&cookie->backing_objects))
  602. goto nobufs_unlock;
  603. object = hlist_entry(cookie->backing_objects.first,
  604. struct fscache_object, cookie_link);
  605. __fscache_use_cookie(cookie);
  606. if (fscache_submit_op(object, &op->op) < 0)
  607. goto nobufs_unlock_dec;
  608. spin_unlock(&cookie->lock);
  609. fscache_stat(&fscache_n_alloc_ops);
  610. ret = fscache_wait_for_operation_activation(
  611. object, &op->op,
  612. __fscache_stat(&fscache_n_alloc_op_waits),
  613. __fscache_stat(&fscache_n_allocs_object_dead));
  614. if (ret < 0)
  615. goto error;
  616. /* ask the cache to honour the operation */
  617. fscache_stat(&fscache_n_cop_allocate_page);
  618. ret = object->cache->ops->allocate_page(op, page, gfp);
  619. fscache_stat_d(&fscache_n_cop_allocate_page);
  620. error:
  621. if (ret == -ERESTARTSYS)
  622. fscache_stat(&fscache_n_allocs_intr);
  623. else if (ret < 0)
  624. fscache_stat(&fscache_n_allocs_nobufs);
  625. else
  626. fscache_stat(&fscache_n_allocs_ok);
  627. fscache_put_retrieval(op);
  628. _leave(" = %d", ret);
  629. return ret;
  630. nobufs_unlock_dec:
  631. wake_cookie = __fscache_unuse_cookie(cookie);
  632. nobufs_unlock:
  633. spin_unlock(&cookie->lock);
  634. fscache_put_retrieval(op);
  635. if (wake_cookie)
  636. __fscache_wake_unused_cookie(cookie);
  637. nobufs:
  638. fscache_stat(&fscache_n_allocs_nobufs);
  639. _leave(" = -ENOBUFS");
  640. return -ENOBUFS;
  641. }
  642. EXPORT_SYMBOL(__fscache_alloc_page);
  643. /*
  644. * Unmark pages allocate in the readahead code path (via:
  645. * fscache_readpages_or_alloc) after delegating to the base filesystem
  646. */
  647. void __fscache_readpages_cancel(struct fscache_cookie *cookie,
  648. struct list_head *pages)
  649. {
  650. struct page *page;
  651. list_for_each_entry(page, pages, lru) {
  652. if (PageFsCache(page))
  653. __fscache_uncache_page(cookie, page);
  654. }
  655. }
  656. EXPORT_SYMBOL(__fscache_readpages_cancel);
  657. /*
  658. * release a write op reference
  659. */
  660. static void fscache_release_write_op(struct fscache_operation *_op)
  661. {
  662. _enter("{OP%x}", _op->debug_id);
  663. }
  664. /*
  665. * perform the background storage of a page into the cache
  666. */
  667. static void fscache_write_op(struct fscache_operation *_op)
  668. {
  669. struct fscache_storage *op =
  670. container_of(_op, struct fscache_storage, op);
  671. struct fscache_object *object = op->op.object;
  672. struct fscache_cookie *cookie;
  673. struct page *page;
  674. unsigned n;
  675. void *results[1];
  676. int ret;
  677. _enter("{OP%x,%d}", op->op.debug_id, atomic_read(&op->op.usage));
  678. again:
  679. spin_lock(&object->lock);
  680. cookie = object->cookie;
  681. if (!fscache_object_is_active(object)) {
  682. /* If we get here, then the on-disk cache object likely no
  683. * longer exists, so we should just cancel this write
  684. * operation.
  685. */
  686. spin_unlock(&object->lock);
  687. fscache_op_complete(&op->op, true);
  688. _leave(" [inactive]");
  689. return;
  690. }
  691. if (!cookie) {
  692. /* If we get here, then the cookie belonging to the object was
  693. * detached, probably by the cookie being withdrawn due to
  694. * memory pressure, which means that the pages we might write
  695. * to the cache from no longer exist - therefore, we can just
  696. * cancel this write operation.
  697. */
  698. spin_unlock(&object->lock);
  699. fscache_op_complete(&op->op, true);
  700. _leave(" [cancel] op{f=%lx s=%u} obj{s=%s f=%lx}",
  701. _op->flags, _op->state, object->state->short_name,
  702. object->flags);
  703. return;
  704. }
  705. spin_lock(&cookie->stores_lock);
  706. fscache_stat(&fscache_n_store_calls);
  707. /* find a page to store */
  708. results[0] = NULL;
  709. page = NULL;
  710. n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0, 1,
  711. FSCACHE_COOKIE_PENDING_TAG);
  712. trace_fscache_gang_lookup(cookie, &op->op, results, n, op->store_limit);
  713. if (n != 1)
  714. goto superseded;
  715. page = results[0];
  716. _debug("gang %d [%lx]", n, page->index);
  717. radix_tree_tag_set(&cookie->stores, page->index,
  718. FSCACHE_COOKIE_STORING_TAG);
  719. radix_tree_tag_clear(&cookie->stores, page->index,
  720. FSCACHE_COOKIE_PENDING_TAG);
  721. trace_fscache_page(cookie, page, fscache_page_radix_pend2store);
  722. spin_unlock(&cookie->stores_lock);
  723. spin_unlock(&object->lock);
  724. if (page->index >= op->store_limit)
  725. goto discard_page;
  726. fscache_stat(&fscache_n_store_pages);
  727. fscache_stat(&fscache_n_cop_write_page);
  728. ret = object->cache->ops->write_page(op, page);
  729. fscache_stat_d(&fscache_n_cop_write_page);
  730. trace_fscache_wrote_page(cookie, page, &op->op, ret);
  731. fscache_end_page_write(object, page);
  732. if (ret < 0) {
  733. fscache_abort_object(object);
  734. fscache_op_complete(&op->op, true);
  735. } else {
  736. fscache_enqueue_operation(&op->op);
  737. }
  738. _leave("");
  739. return;
  740. discard_page:
  741. fscache_stat(&fscache_n_store_pages_over_limit);
  742. trace_fscache_wrote_page(cookie, page, &op->op, -ENOBUFS);
  743. fscache_end_page_write(object, page);
  744. goto again;
  745. superseded:
  746. /* this writer is going away and there aren't any more things to
  747. * write */
  748. _debug("cease");
  749. spin_unlock(&cookie->stores_lock);
  750. clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
  751. spin_unlock(&object->lock);
  752. fscache_op_complete(&op->op, false);
  753. _leave("");
  754. }
  755. /*
  756. * Clear the pages pending writing for invalidation
  757. */
  758. void fscache_invalidate_writes(struct fscache_cookie *cookie)
  759. {
  760. struct page *page;
  761. void *results[16];
  762. int n, i;
  763. _enter("");
  764. for (;;) {
  765. spin_lock(&cookie->stores_lock);
  766. n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0,
  767. ARRAY_SIZE(results),
  768. FSCACHE_COOKIE_PENDING_TAG);
  769. if (n == 0) {
  770. spin_unlock(&cookie->stores_lock);
  771. break;
  772. }
  773. for (i = n - 1; i >= 0; i--) {
  774. page = results[i];
  775. radix_tree_delete(&cookie->stores, page->index);
  776. trace_fscache_page(cookie, page, fscache_page_radix_delete);
  777. trace_fscache_page(cookie, page, fscache_page_inval);
  778. }
  779. spin_unlock(&cookie->stores_lock);
  780. for (i = n - 1; i >= 0; i--)
  781. put_page(results[i]);
  782. }
  783. wake_up_bit(&cookie->flags, 0);
  784. trace_fscache_wake_cookie(cookie);
  785. _leave("");
  786. }
  787. /*
  788. * request a page be stored in the cache
  789. * - returns:
  790. * -ENOMEM - out of memory, nothing done
  791. * -ENOBUFS - no backing object available in which to cache the page
  792. * 0 - dispatched a write - it'll call end_io_func() when finished
  793. *
  794. * if the cookie still has a backing object at this point, that object can be
  795. * in one of a few states with respect to storage processing:
  796. *
  797. * (1) negative lookup, object not yet created (FSCACHE_COOKIE_CREATING is
  798. * set)
  799. *
  800. * (a) no writes yet
  801. *
  802. * (b) writes deferred till post-creation (mark page for writing and
  803. * return immediately)
  804. *
  805. * (2) negative lookup, object created, initial fill being made from netfs
  806. *
  807. * (a) fill point not yet reached this page (mark page for writing and
  808. * return)
  809. *
  810. * (b) fill point passed this page (queue op to store this page)
  811. *
  812. * (3) object extant (queue op to store this page)
  813. *
  814. * any other state is invalid
  815. */
  816. int __fscache_write_page(struct fscache_cookie *cookie,
  817. struct page *page,
  818. loff_t object_size,
  819. gfp_t gfp)
  820. {
  821. struct fscache_storage *op;
  822. struct fscache_object *object;
  823. bool wake_cookie = false;
  824. int ret;
  825. _enter("%p,%x,", cookie, (u32) page->flags);
  826. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  827. ASSERT(PageFsCache(page));
  828. fscache_stat(&fscache_n_stores);
  829. if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) {
  830. _leave(" = -ENOBUFS [invalidating]");
  831. return -ENOBUFS;
  832. }
  833. op = kzalloc(sizeof(*op), GFP_NOIO | __GFP_NOMEMALLOC | __GFP_NORETRY);
  834. if (!op)
  835. goto nomem;
  836. fscache_operation_init(cookie, &op->op, fscache_write_op, NULL,
  837. fscache_release_write_op);
  838. op->op.flags = FSCACHE_OP_ASYNC |
  839. (1 << FSCACHE_OP_WAITING) |
  840. (1 << FSCACHE_OP_UNUSE_COOKIE);
  841. ret = radix_tree_maybe_preload(gfp & ~__GFP_HIGHMEM);
  842. if (ret < 0)
  843. goto nomem_free;
  844. trace_fscache_page_op(cookie, page, &op->op, fscache_page_op_write_one);
  845. ret = -ENOBUFS;
  846. spin_lock(&cookie->lock);
  847. if (!fscache_cookie_enabled(cookie) ||
  848. hlist_empty(&cookie->backing_objects))
  849. goto nobufs;
  850. object = hlist_entry(cookie->backing_objects.first,
  851. struct fscache_object, cookie_link);
  852. if (test_bit(FSCACHE_IOERROR, &object->cache->flags))
  853. goto nobufs;
  854. trace_fscache_page(cookie, page, fscache_page_write);
  855. /* add the page to the pending-storage radix tree on the backing
  856. * object */
  857. spin_lock(&object->lock);
  858. if (object->store_limit_l != object_size)
  859. fscache_set_store_limit(object, object_size);
  860. spin_lock(&cookie->stores_lock);
  861. _debug("store limit %llx", (unsigned long long) object->store_limit);
  862. ret = radix_tree_insert(&cookie->stores, page->index, page);
  863. if (ret < 0) {
  864. if (ret == -EEXIST)
  865. goto already_queued;
  866. _debug("insert failed %d", ret);
  867. goto nobufs_unlock_obj;
  868. }
  869. trace_fscache_page(cookie, page, fscache_page_radix_insert);
  870. radix_tree_tag_set(&cookie->stores, page->index,
  871. FSCACHE_COOKIE_PENDING_TAG);
  872. trace_fscache_page(cookie, page, fscache_page_radix_set_pend);
  873. get_page(page);
  874. /* we only want one writer at a time, but we do need to queue new
  875. * writers after exclusive ops */
  876. if (test_and_set_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags))
  877. goto already_pending;
  878. spin_unlock(&cookie->stores_lock);
  879. spin_unlock(&object->lock);
  880. op->op.debug_id = atomic_inc_return(&fscache_op_debug_id);
  881. op->store_limit = object->store_limit;
  882. __fscache_use_cookie(cookie);
  883. if (fscache_submit_op(object, &op->op) < 0)
  884. goto submit_failed;
  885. spin_unlock(&cookie->lock);
  886. radix_tree_preload_end();
  887. fscache_stat(&fscache_n_store_ops);
  888. fscache_stat(&fscache_n_stores_ok);
  889. /* the work queue now carries its own ref on the object */
  890. fscache_put_operation(&op->op);
  891. _leave(" = 0");
  892. return 0;
  893. already_queued:
  894. fscache_stat(&fscache_n_stores_again);
  895. already_pending:
  896. spin_unlock(&cookie->stores_lock);
  897. spin_unlock(&object->lock);
  898. spin_unlock(&cookie->lock);
  899. radix_tree_preload_end();
  900. fscache_put_operation(&op->op);
  901. fscache_stat(&fscache_n_stores_ok);
  902. _leave(" = 0");
  903. return 0;
  904. submit_failed:
  905. spin_lock(&cookie->stores_lock);
  906. radix_tree_delete(&cookie->stores, page->index);
  907. trace_fscache_page(cookie, page, fscache_page_radix_delete);
  908. spin_unlock(&cookie->stores_lock);
  909. wake_cookie = __fscache_unuse_cookie(cookie);
  910. put_page(page);
  911. ret = -ENOBUFS;
  912. goto nobufs;
  913. nobufs_unlock_obj:
  914. spin_unlock(&cookie->stores_lock);
  915. spin_unlock(&object->lock);
  916. nobufs:
  917. spin_unlock(&cookie->lock);
  918. radix_tree_preload_end();
  919. fscache_put_operation(&op->op);
  920. if (wake_cookie)
  921. __fscache_wake_unused_cookie(cookie);
  922. fscache_stat(&fscache_n_stores_nobufs);
  923. _leave(" = -ENOBUFS");
  924. return -ENOBUFS;
  925. nomem_free:
  926. fscache_put_operation(&op->op);
  927. nomem:
  928. fscache_stat(&fscache_n_stores_oom);
  929. _leave(" = -ENOMEM");
  930. return -ENOMEM;
  931. }
  932. EXPORT_SYMBOL(__fscache_write_page);
  933. /*
  934. * remove a page from the cache
  935. */
  936. void __fscache_uncache_page(struct fscache_cookie *cookie, struct page *page)
  937. {
  938. struct fscache_object *object;
  939. _enter(",%p", page);
  940. ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX);
  941. ASSERTCMP(page, !=, NULL);
  942. fscache_stat(&fscache_n_uncaches);
  943. /* cache withdrawal may beat us to it */
  944. if (!PageFsCache(page))
  945. goto done;
  946. trace_fscache_page(cookie, page, fscache_page_uncache);
  947. /* get the object */
  948. spin_lock(&cookie->lock);
  949. if (hlist_empty(&cookie->backing_objects)) {
  950. ClearPageFsCache(page);
  951. goto done_unlock;
  952. }
  953. object = hlist_entry(cookie->backing_objects.first,
  954. struct fscache_object, cookie_link);
  955. /* there might now be stuff on disk we could read */
  956. clear_bit(FSCACHE_COOKIE_NO_DATA_YET, &cookie->flags);
  957. /* only invoke the cache backend if we managed to mark the page
  958. * uncached here; this deals with synchronisation vs withdrawal */
  959. if (TestClearPageFsCache(page) &&
  960. object->cache->ops->uncache_page) {
  961. /* the cache backend releases the cookie lock */
  962. fscache_stat(&fscache_n_cop_uncache_page);
  963. object->cache->ops->uncache_page(object, page);
  964. fscache_stat_d(&fscache_n_cop_uncache_page);
  965. goto done;
  966. }
  967. done_unlock:
  968. spin_unlock(&cookie->lock);
  969. done:
  970. _leave("");
  971. }
  972. EXPORT_SYMBOL(__fscache_uncache_page);
  973. /**
  974. * fscache_mark_page_cached - Mark a page as being cached
  975. * @op: The retrieval op pages are being marked for
  976. * @page: The page to be marked
  977. *
  978. * Mark a netfs page as being cached. After this is called, the netfs
  979. * must call fscache_uncache_page() to remove the mark.
  980. */
  981. void fscache_mark_page_cached(struct fscache_retrieval *op, struct page *page)
  982. {
  983. struct fscache_cookie *cookie = op->op.object->cookie;
  984. #ifdef CONFIG_FSCACHE_STATS
  985. atomic_inc(&fscache_n_marks);
  986. #endif
  987. trace_fscache_page(cookie, page, fscache_page_cached);
  988. _debug("- mark %p{%lx}", page, page->index);
  989. if (TestSetPageFsCache(page)) {
  990. static bool once_only;
  991. if (!once_only) {
  992. once_only = true;
  993. pr_warn("Cookie type %s marked page %lx multiple times\n",
  994. cookie->def->name, page->index);
  995. }
  996. }
  997. if (cookie->def->mark_page_cached)
  998. cookie->def->mark_page_cached(cookie->netfs_data,
  999. op->mapping, page);
  1000. }
  1001. EXPORT_SYMBOL(fscache_mark_page_cached);
  1002. /**
  1003. * fscache_mark_pages_cached - Mark pages as being cached
  1004. * @op: The retrieval op pages are being marked for
  1005. * @pagevec: The pages to be marked
  1006. *
  1007. * Mark a bunch of netfs pages as being cached. After this is called,
  1008. * the netfs must call fscache_uncache_page() to remove the mark.
  1009. */
  1010. void fscache_mark_pages_cached(struct fscache_retrieval *op,
  1011. struct pagevec *pagevec)
  1012. {
  1013. unsigned long loop;
  1014. for (loop = 0; loop < pagevec->nr; loop++)
  1015. fscache_mark_page_cached(op, pagevec->pages[loop]);
  1016. pagevec_reinit(pagevec);
  1017. }
  1018. EXPORT_SYMBOL(fscache_mark_pages_cached);
  1019. /*
  1020. * Uncache all the pages in an inode that are marked PG_fscache, assuming them
  1021. * to be associated with the given cookie.
  1022. */
  1023. void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
  1024. struct inode *inode)
  1025. {
  1026. struct address_space *mapping = inode->i_mapping;
  1027. struct pagevec pvec;
  1028. pgoff_t next;
  1029. int i;
  1030. _enter("%p,%p", cookie, inode);
  1031. if (!mapping || mapping->nrpages == 0) {
  1032. _leave(" [no pages]");
  1033. return;
  1034. }
  1035. pagevec_init(&pvec);
  1036. next = 0;
  1037. do {
  1038. if (!pagevec_lookup(&pvec, mapping, &next))
  1039. break;
  1040. for (i = 0; i < pagevec_count(&pvec); i++) {
  1041. struct page *page = pvec.pages[i];
  1042. if (PageFsCache(page)) {
  1043. __fscache_wait_on_page_write(cookie, page);
  1044. __fscache_uncache_page(cookie, page);
  1045. }
  1046. }
  1047. pagevec_release(&pvec);
  1048. cond_resched();
  1049. } while (next);
  1050. _leave("");
  1051. }
  1052. EXPORT_SYMBOL(__fscache_uncache_all_inode_pages);