aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fscache.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fscache.h')
-rw-r--r--include/linux/fscache.h52
1 files changed, 47 insertions, 5 deletions
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 245b48646efa..6d8ee466e0a0 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -184,6 +184,24 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
184 void *); 184 void *);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern void __fscache_update_cookie(struct fscache_cookie *); 186extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *);
188extern int __fscache_read_or_alloc_page(struct fscache_cookie *,
189 struct page *,
190 fscache_rw_complete_t,
191 void *,
192 gfp_t);
193extern int __fscache_read_or_alloc_pages(struct fscache_cookie *,
194 struct address_space *,
195 struct list_head *,
196 unsigned *,
197 fscache_rw_complete_t,
198 void *,
199 gfp_t);
200extern int __fscache_alloc_page(struct fscache_cookie *, struct page *, gfp_t);
201extern int __fscache_write_page(struct fscache_cookie *, struct page *, gfp_t);
202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *);
203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
187 205
188/** 206/**
189 * fscache_register_netfs - Register a filesystem as desiring caching services 207 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -361,7 +379,10 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
361static inline 379static inline
362int fscache_attr_changed(struct fscache_cookie *cookie) 380int fscache_attr_changed(struct fscache_cookie *cookie)
363{ 381{
364 return -ENOBUFS; 382 if (fscache_cookie_valid(cookie))
383 return __fscache_attr_changed(cookie);
384 else
385 return -ENOBUFS;
365} 386}
366 387
367/** 388/**
@@ -418,7 +439,11 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
418 void *context, 439 void *context,
419 gfp_t gfp) 440 gfp_t gfp)
420{ 441{
421 return -ENOBUFS; 442 if (fscache_cookie_valid(cookie))
443 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
444 context, gfp);
445 else
446 return -ENOBUFS;
422} 447}
423 448
424/** 449/**
@@ -464,7 +489,12 @@ int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
464 void *context, 489 void *context,
465 gfp_t gfp) 490 gfp_t gfp)
466{ 491{
467 return -ENOBUFS; 492 if (fscache_cookie_valid(cookie))
493 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
494 nr_pages, end_io_func,
495 context, gfp);
496 else
497 return -ENOBUFS;
468} 498}
469 499
470/** 500/**
@@ -490,7 +520,10 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
490 struct page *page, 520 struct page *page,
491 gfp_t gfp) 521 gfp_t gfp)
492{ 522{
493 return -ENOBUFS; 523 if (fscache_cookie_valid(cookie))
524 return __fscache_alloc_page(cookie, page, gfp);
525 else
526 return -ENOBUFS;
494} 527}
495 528
496/** 529/**
@@ -516,7 +549,10 @@ int fscache_write_page(struct fscache_cookie *cookie,
516 struct page *page, 549 struct page *page,
517 gfp_t gfp) 550 gfp_t gfp)
518{ 551{
519 return -ENOBUFS; 552 if (fscache_cookie_valid(cookie))
553 return __fscache_write_page(cookie, page, gfp);
554 else
555 return -ENOBUFS;
520} 556}
521 557
522/** 558/**
@@ -537,6 +573,8 @@ static inline
537void fscache_uncache_page(struct fscache_cookie *cookie, 573void fscache_uncache_page(struct fscache_cookie *cookie,
538 struct page *page) 574 struct page *page)
539{ 575{
576 if (fscache_cookie_valid(cookie))
577 __fscache_uncache_page(cookie, page);
540} 578}
541 579
542/** 580/**
@@ -553,6 +591,8 @@ static inline
553bool fscache_check_page_write(struct fscache_cookie *cookie, 591bool fscache_check_page_write(struct fscache_cookie *cookie,
554 struct page *page) 592 struct page *page)
555{ 593{
594 if (fscache_cookie_valid(cookie))
595 return __fscache_check_page_write(cookie, page);
556 return false; 596 return false;
557} 597}
558 598
@@ -571,6 +611,8 @@ static inline
571void fscache_wait_on_page_write(struct fscache_cookie *cookie, 611void fscache_wait_on_page_write(struct fscache_cookie *cookie,
572 struct page *page) 612 struct page *page)
573{ 613{
614 if (fscache_cookie_valid(cookie))
615 __fscache_wait_on_page_write(cookie, page);
574} 616}
575 617
576#endif /* _LINUX_FSCACHE_H */ 618#endif /* _LINUX_FSCACHE_H */