Cifs and Ceph: Uncache single no-data page in readpage()
Subsystems (5)
cover Cifs and Ceph: Uncache single no-data page in readpage()
Currently, the page allocated into fscache in readpage() for Cifs and Ceph does not be uncached if no data read due to io error. This patch fixes this. fscache_readpages_cancel() is for this kind of job but taking list read * as input, so a new routine take page * as input is introduced.
Li Wang (7):
Fscache: Introduce new API fscache_readpage_cancel()
Fscache: Implement uncaching single no-data page
Ceph: Introduce routine for uncaching single no-data page
Ceph: Uncaching no-data page in readpage()
Cifs: Introduce routine for uncaching single no-data page
Cifs: Implement uncaching single no-data page
Cifs: Uncaching no-data page in readpage()
fs/ceph/addr.c | 1 + fs/ceph/cache.h | 13 +++++++++++++ fs/cifs/file.c | 4 +++- fs/cifs/fscache.c | 7 +++++++ fs/cifs/fscache.h | 13 +++++++++++++ fs/fscache/page.c | 8 ++++++++ include/linux/fscache.h | 11 +++++++++++ 7 files changed, 56 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
PATCH 1/7 Fscache: Introduce new API fscache_readpage_cancel()
Introduce a new API fscache_readpage_cancel() for uncaching one single no-data page from fscache.
--- include/linux/fscache.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/fscache.h +11 -0
@@ -245,6 +245,8 @@ extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *, gfp_t);extern void __fscache_uncache_all_inode_pages (struct fscache_cookie *,struct inode *); +extern void __fscache_readpage_cancel (struct fscache_cookie *cookie, +struct page *page);extern void __fscache_readpages_cancel (struct fscache_cookie *cookie,struct list_head *pages);extern void __fscache_disable_cookie (struct fscache_cookie *,bool );
@@ -633,6 +635,15 @@ int fscache_alloc_page(struct fscache_cookie *cookie,return -ENOBUFS ; } +static inline +void fscache_readpage_cancel (struct fscache_cookie *cookie, +struct page *page) +{ +if (fscache_cookie_valid (cookie)) +__fscache_readpage_cancel (cookie, page); +} + +/** * fscache_readpages_cancel - Cancel read/alloc on pages * @cookie: The cookie representing the inode's cache object.
Signature · 1 line
1.7.9.5
PATCH 2/7 Fscache: Implement uncaching single no-data page
In reply to Li WangSimilar to the routine for multiple pages except that it takes page * as input rather than list head *.
--- fs/fscache/page.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/fscache/page.c +8 -0
@@ -721,6 +721,14 @@ nobufs: }EXPORT_SYMBOL (__fscache_alloc_page); +void __fscache_readpage_cancel (struct fscache_cookie *cookie, +struct page *page) +{ +if (PageFsCache (page)) +__fscache_uncache_page (cookie, page); +} +EXPORT_SYMBOL (__fscache_readpage_cancel); +/* * Unmark pages allocate in the readahead code path (via: * fscache_readpages_or_alloc) after delegating to the base filesystem
Signature · 1 line
1.7.9.5
PATCH 3/7 Ceph: Introduce routine for uncaching single no-data page
In reply to Li WangIntroduce a routine for uncaching single no-data page, typically in readpage().
--- fs/ceph/cache.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/ceph/cache.h +13 -0
@@ -67,6 +67,14 @@ static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp)return fscache_maybe_release_page (ci->fscache, page, gfp); } + +static inline void cpeh_fscache_readpage_cancel (struct inode *inode, +struct page *page) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +return fscache_readpage_cancel (ci->fscache, page); +} +static inline void ceph_fscache_readpages_cancel (struct inode *inode,struct list_head *pages) {
@@ -145,6 +153,11 @@ static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp)return 1 ; } +static inline void ceph_fscache_readpage_cancel (struct inode *inode, +struct page *page) +{ +} +static inline void ceph_fscache_readpages_cancel (struct inode *inode,struct list_head *pages) {
Signature · 1 line
1.7.9.5
PATCH 4/7 Ceph: Uncaching no-data page in readpage()
In reply to Li WangCurrently, if one page allocated into fscache in readpage(), however, with no-data read, it is not uncached. This patch fixes this.
--- fs/ceph/addr.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/addr.c +1 -0
@@ -209,6 +209,7 @@ static int readpage_nounlock(struct file *filp, struct page *page) err =0 ;if (err <0 ) {SetPageError (page); +ceph_fscache_readpage_cancel (inode, page); goto out; }else if (err <PAGE_CACHE_SIZE ) {/* zero fill remainder of page */
Signature · 1 line
1.7.9.5
PATCH 5/7 Cifs: Introduce routine for uncaching single no-data page
In reply to Li WangIntroduce a routine for uncaching single no-data page, typically in readpage().
--- fs/cifs/fscache.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/cifs/fscache.h +13 -0
@@ -54,6 +54,7 @@ extern int __cifs_readpages_from_fscache(struct inode *, struct address_space *, struct list_head *, unsigned *); +extern void __cifs_fscache_readpage_cancel (struct inode *,struct page *);extern void __cifs_fscache_readpages_cancel (struct inode *,struct list_head *);extern void __cifs_readpage_to_fscache (struct inode *,struct page *);
@@ -92,6 +93,13 @@ static inline void cifs_readpage_to_fscache(struct inode *inode,__cifs_readpage_to_fscache (inode, page); } +static inline void cifs_fscache_readpage_cancel (struct inode *inode, +struct page *page) +{ +if (CIFS_I (inode)->fscache) +return __cifs_fscache_readpage_cancel (inode, page); +} +static inline void cifs_fscache_readpages_cancel (struct inode *inode,struct list_head *pages) {
@@ -139,6 +147,11 @@ static inline int cifs_readpages_from_fscache(struct inode *inode,static inline void cifs_readpage_to_fscache (struct inode *inode,struct page *page) {} +static inline void cifs_fscache_readpage_cancel (struct inode *inode, +struct page *page) +{ +} +static inline void cifs_fscache_readpages_cancel (struct inode *inode,struct list_head *pages) {
Signature · 1 line
1.7.9.5
PATCH 6/7 Cifs: Implement uncaching single no-data page
In reply to Li WangImplement the routine for uncaching single no-data page, typically in readpage().
--- fs/cifs/fscache.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/cifs/fscache.c +7 -0
@@ -223,6 +223,13 @@ void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)fscache_uncache_page (CIFS_I (inode)->fscache, page); } +void __cifs_fscache_readpage_cancel (struct inode *inode,struct page *page) +{ +cifs_dbg (FYI ,"%s: (fsc: %p, i: %p)\n" , + __func__,CIFS_I (inode)->fscache, inode); +fscache_readpage_cancel (CIFS_I (inode)->fscache, page); +} +void __cifs_fscache_readpages_cancel (struct inode *inode,struct list_head *pages) { cifs_dbg(FYI, "%s: (fsc: %p, i: %p)\n",
Signature · 1 line
1.7.9.5
PATCH 7/7 Cifs: Uncaching no-data page in readpage()
In reply to Li WangCurrently, if one page allocated into fscache in readpage(), however, with no-data read, it is not uncached. This patch fixes this.
--- fs/cifs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/file.c +3 -1
@@ -3406,8 +3406,10 @@ static int cifs_readpage_worker(struct file *file, struct page *page, rc =cifs_read (file, read_data,PAGE_CACHE_SIZE , poffset); -if (rc <0 ) +if (rc <0 ) { +cifs_fscache_readpage_cancel (file_inode (file), page); goto io_error; + }else cifs_dbg (FYI ,"Bytes read %d\n" , rc);
Signature · 1 line
1.7.9.5
Li,
I recommend you CC David Howells who maintains FSCache directly on your emails.
Thanks,
- Milosz
Quoted 27 lines · Li Wang
Currently, the page allocated into fscache in
readpage()for Cifs and Ceph does not be uncached if no data read due to io error. This patch fixes this.fscache_readpages_cancel()is for this kind of job but taking list read * as input, so a new routine take page * as input is introduced.Li Wang (7):
Fscache: Introduce new APIfscache_readpage_cancel()
Fscache: Implement uncaching single no-data page
Ceph: Introduce routine for uncaching single no-data page
Ceph: Uncaching no-data page inreadpage()
Cifs: Introduce routine for uncaching single no-data page
Cifs: Implement uncaching single no-data page
Cifs: Uncaching no-data page inreadpage()fs/ceph/addr.c | 1 + fs/ceph/cache.h | 13 +++++++++++++ fs/cifs/file.c | 4 +++- fs/cifs/fscache.c | 7 +++++++ fs/cifs/fscache.h | 13 +++++++++++++ fs/fscache/page.c | 8 ++++++++ include/linux/fscache.h | 11 +++++++++++ 7 files changed, 56 insertions(+), 1 deletion(-)--
1.7.9.5
Signature · 7 lines
Milosz Tanski CTO 10 East 53rd Street, 37th floor New York, NY 10022 p: 646-253-9055 e: [email protected]