Discussion:
[PATCH 0/7] Cifs and Ceph: Uncache single no-data page in readpage()
Li Wang
2013-11-11 15:27:22 UTC
Permalink
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(-)
--
1.7.9.5
Li Wang
2013-11-11 15:27:27 UTC
Permalink
Introduce a routine for uncaching single no-data page, typically
in readpage().

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
fs/cifs/fscache.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/fs/cifs/fscache.h b/fs/cifs/fscache.h
index 24794b6..c712f42 100644
--- a/fs/cifs/fscache.h
+++ b/fs/cifs/fscache.h
@@ -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)
{
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Li Wang
2013-11-11 15:27:29 UTC
Permalink
Currently, if one page allocated into fscache in readpage(), however, with
no-data read, it is not uncached. This patch fixes this.

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
fs/cifs/file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7ddddf2..153bc58 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -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);
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Li Wang
2013-11-11 15:27:28 UTC
Permalink
Implement the routine for uncaching single no-data page, typically
in readpage().

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
fs/cifs/fscache.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 8d4b7bc..168f184 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -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",
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Li Wang
2013-11-11 15:27:26 UTC
Permalink
Currently, if one page allocated into fscache in readpage(), however, with
no-data read, it is not uncached. This patch fixes this.

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
fs/ceph/addr.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 6df8bd4..be5f4b6 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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 */
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Li Wang
2013-11-11 15:27:23 UTC
Permalink
Introduce a new API fscache_readpage_cancel() for uncaching one single
no-data page from fscache.

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
include/linux/fscache.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 115bb81..f1ed21f 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -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.
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Li Wang
2013-11-11 15:27:25 UTC
Permalink
Introduce a routine for uncaching single no-data page, typically
in readpage().

Signed-off-by: Li Wang <liwang-***@public.gmane.org>
---
fs/ceph/cache.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/fs/ceph/cache.h b/fs/ceph/cache.h
index ba94940..eb0ec76 100644
--- a/fs/ceph/cache.h
+++ b/fs/ceph/cache.h
@@ -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)
{
--
1.7.9.5
Li Wang
2013-11-11 15:27:24 UTC
Permalink
Similar to the routine for multiple pages except
that it takes page * as input rather than list head *.

Signed-off-by: Li Wang <***@ubuntukylin.com>
---
fs/fscache/page.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index 7f5c658..0c69f72 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -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
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Milosz Tanski
2013-11-11 16:19:49 UTC
Permalink
Li,

I recommend you CC David Howells who maintains FSCache directly on your emails.

Thanks,
- Milosz
Post by 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.
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(-)
--
1.7.9.5
--
Milosz Tanski
CTO
10 East 53rd Street, 37th floor
New York, NY 10022

p: 646-253-9055
e: milosz-***@public.gmane.org
Loading...