All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Various NFS fscache cleanups
@ 2021-10-07 22:30 Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 1/7] NFS: Use nfs_i_fscache() consistently within NFS fscache code Dave Wysochanski
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

This patchset is on top of David Howells patchset he just posted as
v3 of "fscache: Replace and remove old I/O API" and is based on his
fscache-remove-old-io branch at
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=fscache-remove-old-io
NOTE: fscache-remove-old-io was previously "fscache-iter-3" but it's been
renamed to better reflect the purpose.

The series is also at:
https://github.com/DaveWysochanskiRH/kernel.git
https://github.com/DaveWysochanskiRH/kernel/tree/fscache-remove-old-io-nfs-fixes

Testing is looking ok so far and is still ongoing at BakeAThon and in
my local testbed with tracepoints enabled via:
trace-cmd start -e fscache:* -e nfs:* -e nfs4:* -e cachefiles:*

Changes in v2 of this series
- Dropped first patch of v1 series (dhowells updated his patch)
- Don't rename or change the value of NFSDBG_FSCACHE (Trond)
- Rename nfs_readpage_from_fscache and nfs_readpage_to_fscache
- Rename enable/disable tracepoints to start with "nfs_fscache"
- Rename fscache IO tracepoints to better reflect the new function names
- Place the fscache IO tracepoints at begin and end of the functions

Dave Wysochanski (7):
  NFS: Use nfs_i_fscache() consistently within NFS fscache code
  NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size
    properly
  NFS: Convert NFS fscache enable/disable dfprintks to tracepoints
  NFS: Rename fscache read and write pages functions
  NFS: Replace dfprintks with tracepoints in read and write page
    functions
  NFS: Remove remaining dfprintks related to fscache cookies
  NFS: Remove remaining usages of NFSDBG_FSCACHE

 fs/nfs/fscache-index.c      |  2 -
 fs/nfs/fscache.c            | 76 +++++++++++++----------------------
 fs/nfs/fscache.h            | 25 ++++++------
 fs/nfs/nfstrace.h           | 98 +++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/read.c               |  4 +-
 include/uapi/linux/nfs_fs.h |  2 +-
 6 files changed, 140 insertions(+), 67 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2  1/7] NFS: Use nfs_i_fscache() consistently within NFS fscache code
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 2/7] NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size properly Dave Wysochanski
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

The nfs_i_fscache() is the API defined to check whether fscache
is enabled on an NFS inode or not, so use it consistently through
the code.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 679055720dae..f4deea2908e9 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -105,7 +105,7 @@ extern void __nfs_read_completion_to_fscache(struct nfs_pgio_header *hdr,
 static inline int nfs_readpage_from_fscache(struct inode *inode,
 					    struct page *page)
 {
-	if (NFS_I(inode)->fscache)
+	if (nfs_i_fscache(inode))
 		return __nfs_readpage_from_fscache(inode, page);
 	return -ENOBUFS;
 }
@@ -117,7 +117,7 @@ static inline int nfs_readpage_from_fscache(struct inode *inode,
 static inline void nfs_readpage_to_fscache(struct inode *inode,
 					   struct page *page)
 {
-	if (NFS_I(inode)->fscache)
+	if (nfs_i_fscache(inode))
 		__nfs_readpage_to_fscache(inode, page);
 }
 
@@ -126,7 +126,7 @@ static inline void nfs_readpage_to_fscache(struct inode *inode,
  */
 static inline void nfs_fscache_invalidate(struct inode *inode)
 {
-	fscache_invalidate(NFS_I(inode)->fscache);
+	fscache_invalidate(nfs_i_fscache(inode));
 }
 
 /*
@@ -134,7 +134,7 @@ static inline void nfs_fscache_invalidate(struct inode *inode)
  */
 static inline void nfs_fscache_wait_on_invalidate(struct inode *inode)
 {
-	fscache_wait_on_invalidate(NFS_I(inode)->fscache);
+	fscache_wait_on_invalidate(nfs_i_fscache(inode));
 }
 
 /*
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  2/7] NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size properly
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 1/7] NFS: Use nfs_i_fscache() consistently within NFS fscache code Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 3/7] NFS: Convert NFS fscache enable/disable dfprintks to tracepoints Dave Wysochanski
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

A number of places in the fscache interface used nfs_inode when inode could
be used, simplifying the code.  Also, handle the read of i_size properly by
utilizing the i_size_read() interface.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 68e266a37675..6764938eca2d 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -226,16 +226,16 @@ void nfs_fscache_release_super_cookie(struct super_block *sb)
 }
 
 static void nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata,
-				  struct nfs_inode *nfsi)
+				  struct inode *inode)
 {
 	memset(auxdata, 0, sizeof(*auxdata));
-	auxdata->mtime_sec  = nfsi->vfs_inode.i_mtime.tv_sec;
-	auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec;
-	auxdata->ctime_sec  = nfsi->vfs_inode.i_ctime.tv_sec;
-	auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;
+	auxdata->mtime_sec  = inode->i_mtime.tv_sec;
+	auxdata->mtime_nsec = inode->i_mtime.tv_nsec;
+	auxdata->ctime_sec  = inode->i_ctime.tv_sec;
+	auxdata->ctime_nsec = inode->i_ctime.tv_nsec;
 
-	if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4)
-		auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode);
+	if (NFS_SERVER(inode)->nfs_client->rpc_ops->version == 4)
+		auxdata->change_attr = inode_peek_iversion_raw(inode);
 }
 
 /*
@@ -251,13 +251,13 @@ void nfs_fscache_init_inode(struct inode *inode)
 	if (!(nfss->fscache && S_ISREG(inode->i_mode)))
 		return;
 
-	nfs_fscache_update_auxdata(&auxdata, nfsi);
+	nfs_fscache_update_auxdata(&auxdata, inode);
 
 	nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode->i_sb)->fscache,
 					       &nfs_fscache_inode_object_def,
 					       nfsi->fh.data, nfsi->fh.size,
 					       &auxdata, sizeof(auxdata),
-					       nfsi, nfsi->vfs_inode.i_size, false);
+					       nfsi, i_size_read(inode), false);
 }
 
 /*
@@ -271,7 +271,7 @@ void nfs_fscache_clear_inode(struct inode *inode)
 
 	dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie);
 
-	nfs_fscache_update_auxdata(&auxdata, nfsi);
+	nfs_fscache_update_auxdata(&auxdata, inode);
 	fscache_relinquish_cookie(cookie, &auxdata, false);
 	nfsi->fscache = NULL;
 }
@@ -311,7 +311,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
 	if (!fscache_cookie_valid(cookie))
 		return;
 
-	nfs_fscache_update_auxdata(&auxdata, nfsi);
+	nfs_fscache_update_auxdata(&auxdata, inode);
 
 	if (inode_is_open_for_write(inode)) {
 		dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);
@@ -319,7 +319,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
 		fscache_disable_cookie(cookie, &auxdata, true);
 	} else {
 		dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache\n", nfsi);
-		fscache_enable_cookie(cookie, &auxdata, nfsi->vfs_inode.i_size,
+		fscache_enable_cookie(cookie, &auxdata, i_size_read(inode),
 				      nfs_fscache_can_enable, inode);
 		if (fscache_cookie_enabled(cookie))
 			set_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  3/7] NFS: Convert NFS fscache enable/disable dfprintks to tracepoints
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 1/7] NFS: Use nfs_i_fscache() consistently within NFS fscache code Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 2/7] NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size properly Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 4/7] NFS: Rename fscache read and write pages functions Dave Wysochanski
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

Convert the enable / disable NFS fscache dfprintks to tracepoints.
Utilize the existing NFS inode trace event class, which allows us
to keep the same output format to other NFS inode tracepoints.
Start the names of the tracepoints with "nfs_fscache" for easy
identification.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.c  | 5 +++--
 fs/nfs/nfstrace.h | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 6764938eca2d..5f9be4a1b5f8 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -19,6 +19,7 @@
 #include "internal.h"
 #include "iostat.h"
 #include "fscache.h"
+#include "nfstrace.h"
 
 #define NFSDBG_FACILITY		NFSDBG_FSCACHE
 
@@ -314,11 +315,11 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
 	nfs_fscache_update_auxdata(&auxdata, inode);
 
 	if (inode_is_open_for_write(inode)) {
-		dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);
+		trace_nfs_fscache_disable_inode(inode);
 		clear_bit(NFS_INO_FSCACHE, &nfsi->flags);
 		fscache_disable_cookie(cookie, &auxdata, true);
 	} else {
-		dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache\n", nfsi);
+		trace_nfs_fscache_enable_inode(inode);
 		fscache_enable_cookie(cookie, &auxdata, i_size_read(inode),
 				      nfs_fscache_can_enable, inode);
 		if (fscache_cookie_enabled(cookie))
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 8a224871be74..b79f5fe2e39d 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -209,6 +209,8 @@
 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
 DEFINE_NFS_INODE_EVENT(nfs_access_enter);
+DEFINE_NFS_INODE_EVENT(nfs_fscache_enable_inode);
+DEFINE_NFS_INODE_EVENT(nfs_fscache_disable_inode);
 
 TRACE_EVENT(nfs_access_exit,
 		TP_PROTO(
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  4/7] NFS: Rename fscache read and write pages functions
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
                   ` (2 preceding siblings ...)
  2021-10-07 22:30 ` [PATCH v2 3/7] NFS: Convert NFS fscache enable/disable dfprintks to tracepoints Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 5/7] NFS: Replace dfprintks with tracepoints in read and write page functions Dave Wysochanski
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

Rename NFS fscache functions to read from and write to the cache
to better reflect the new fscache fallback API naming.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.c |  4 ++--
 fs/nfs/fscache.h | 17 ++++++++---------
 fs/nfs/read.c    |  4 ++--
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 5f9be4a1b5f8..50d68cb946c8 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -331,7 +331,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
 /*
  * Retrieve a page from fscache
  */
-int __nfs_readpage_from_fscache(struct inode *inode, struct page *page)
+int __nfs_fscache_read_page(struct inode *inode, struct page *page)
 {
 	int ret;
 
@@ -364,7 +364,7 @@ int __nfs_readpage_from_fscache(struct inode *inode, struct page *page)
 /*
  * Store a newly fetched page in fscache
  */
-void __nfs_readpage_to_fscache(struct inode *inode, struct page *page)
+void __nfs_fscache_write_page(struct inode *inode, struct page *page)
 {
 	int ret;
 
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index f4deea2908e9..a2c669ce8217 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -94,19 +94,18 @@ struct nfs_fscache_inode_auxdata {
 extern void nfs_fscache_clear_inode(struct inode *);
 extern void nfs_fscache_open_file(struct inode *, struct file *);
 
-extern int __nfs_readpage_from_fscache(struct inode *, struct page *);
+extern int __nfs_fscache_read_page(struct inode *, struct page *);
 extern void __nfs_read_completion_to_fscache(struct nfs_pgio_header *hdr,
 					     unsigned long bytes);
-extern void __nfs_readpage_to_fscache(struct inode *, struct page *);
+extern void __nfs_fscache_write_page(struct inode *, struct page *);
 
 /*
  * Retrieve a page from an inode data storage object.
  */
-static inline int nfs_readpage_from_fscache(struct inode *inode,
-					    struct page *page)
+static inline int nfs_fscache_read_page(struct inode *inode, struct page *page)
 {
 	if (nfs_i_fscache(inode))
-		return __nfs_readpage_from_fscache(inode, page);
+		return __nfs_fscache_read_page(inode, page);
 	return -ENOBUFS;
 }
 
@@ -114,11 +113,11 @@ static inline int nfs_readpage_from_fscache(struct inode *inode,
  * Store a page newly fetched from the server in an inode data storage object
  * in the cache.
  */
-static inline void nfs_readpage_to_fscache(struct inode *inode,
+static inline void nfs_fscache_write_page(struct inode *inode,
 					   struct page *page)
 {
 	if (nfs_i_fscache(inode))
-		__nfs_readpage_to_fscache(inode, page);
+		__nfs_fscache_write_page(inode, page);
 }
 
 /*
@@ -161,12 +160,12 @@ static inline void nfs_fscache_clear_inode(struct inode *inode) {}
 static inline void nfs_fscache_open_file(struct inode *inode,
 					 struct file *filp) {}
 
-static inline int nfs_readpage_from_fscache(struct inode *inode,
+static inline int nfs_fscache_read_page(struct inode *inode,
 					    struct page *page)
 {
 	return -ENOBUFS;
 }
-static inline void nfs_readpage_to_fscache(struct inode *inode,
+static inline void nfs_fscache_write_page(struct inode *inode,
 					   struct page *page) {}
 
 
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 06ed827a67e8..c65663f217a4 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -123,7 +123,7 @@ static void nfs_readpage_release(struct nfs_page *req, int error)
 		struct address_space *mapping = page_file_mapping(page);
 
 		if (PageUptodate(page))
-			nfs_readpage_to_fscache(inode, page);
+			nfs_fscache_write_page(inode, page);
 		else if (!PageError(page) && !PagePrivate(page))
 			generic_error_remove_page(mapping, page);
 		unlock_page(page);
@@ -306,7 +306,7 @@ static void nfs_readpage_result(struct rpc_task *task,
 	aligned_len = min_t(unsigned int, ALIGN(len, rsize), PAGE_SIZE);
 
 	if (!IS_SYNC(page->mapping->host)) {
-		error = nfs_readpage_from_fscache(page->mapping->host, page);
+		error = nfs_fscache_read_page(page->mapping->host, page);
 		if (error == 0)
 			goto out_unlock;
 	}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  5/7] NFS: Replace dfprintks with tracepoints in read and write page functions
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
                   ` (3 preceding siblings ...)
  2021-10-07 22:30 ` [PATCH v2 4/7] NFS: Rename fscache read and write pages functions Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 6/7] NFS: Remove remaining dfprintks related to fscache cookies Dave Wysochanski
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

Most of fscache and other NFS IO paths are now using tracepoints.
Remove the dfprintks in the NFS fscache read/write page functions
and replace with tracepoints at the begin and end of the functions.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.c  | 29 ++++++-----------
 fs/nfs/nfstrace.h | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+), 19 deletions(-)

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 50d68cb946c8..7dbe3a404f34 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -335,30 +335,27 @@ int __nfs_fscache_read_page(struct inode *inode, struct page *page)
 {
 	int ret;
 
-	dfprintk(FSCACHE,
-		 "NFS: readpage_from_fscache(fsc:%p/p:%p(i:%lx f:%lx)/0x%p)\n",
-		 nfs_i_fscache(inode), page, page->index, page->flags, inode);
-
+	trace_nfs_fscache_read_page(inode, page);
 	if (PageChecked(page)) {
-		dfprintk(FSCACHE, "NFS:    readpage_from_fscache: PageChecked\n");
 		ClearPageChecked(page);
-		return 1;
+		ret = 1;
+		goto out;
 	}
 
 	ret = fscache_fallback_read_page(nfs_i_fscache(inode), page);
 	if (ret < 0) {
 		nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL);
-		dfprintk(FSCACHE,
-			 "NFS:    readpage_from_fscache failed %d\n", ret);
 		SetPageChecked(page);
-		return ret;
+		goto out;
 	}
 
 	/* Read completed synchronously */
-	dfprintk(FSCACHE, "NFS:    readpage_from_fscache: read successful\n");
 	nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK);
 	SetPageUptodate(page);
-	return 0;
+	ret = 0;
+out:
+	trace_nfs_fscache_read_page_done(inode, page, ret);
+	return ret;
 }
 
 /*
@@ -368,20 +365,14 @@ void __nfs_fscache_write_page(struct inode *inode, struct page *page)
 {
 	int ret;
 
-	dfprintk(FSCACHE,
-		 "NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx))\n",
-		 nfs_i_fscache(inode), page, page->index, page->flags);
-
+	trace_nfs_fscache_write_page(inode, page);
 	ret = fscache_fallback_write_page(nfs_i_fscache(inode), page);
 
-	dfprintk(FSCACHE,
-		 "NFS:     readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d\n",
-		 page, page->index, page->flags, ret);
-
 	if (ret != 0) {
 		nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL);
 		nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED);
 	} else {
 		nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_OK);
 	}
+	trace_nfs_fscache_write_page_done(inode, page, ret);
 }
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index b79f5fe2e39d..f751d841868c 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1012,6 +1012,102 @@
 		)
 );
 
+DECLARE_EVENT_CLASS(nfs_fscache_page_event,
+		TP_PROTO(
+			const struct inode *inode,
+			const struct page *page
+		),
+
+		TP_ARGS(inode, page),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(loff_t, offset)
+			__field(u32, count)
+		),
+
+		TP_fast_assign(
+			const struct nfs_inode *nfsi = NFS_I(inode);
+			const struct nfs_fh *fh = &nfsi->fh;
+
+			__entry->offset = page->index << PAGE_SHIFT;
+			__entry->count = 4096;
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = nfsi->fileid;
+			__entry->fhandle = nfs_fhandle_hash(fh);
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu fhandle=0x%08x "
+			"offset=%lld count=%u",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle,
+			(long long)__entry->offset, __entry->count
+		)
+);
+DECLARE_EVENT_CLASS(nfs_fscache_page_event_done,
+		TP_PROTO(
+			const struct inode *inode,
+			const struct page *page,
+			int error
+		),
+
+		TP_ARGS(inode, page, error),
+
+		TP_STRUCT__entry(
+			__field(int, error)
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(loff_t, offset)
+			__field(u32, count)
+		),
+
+		TP_fast_assign(
+			const struct nfs_inode *nfsi = NFS_I(inode);
+			const struct nfs_fh *fh = &nfsi->fh;
+
+			__entry->offset = page->index << PAGE_SHIFT;
+			__entry->count = 4096;
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = nfsi->fileid;
+			__entry->fhandle = nfs_fhandle_hash(fh);
+			__entry->error = error;
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu fhandle=0x%08x "
+			"offset=%lld count=%u error=%d",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle,
+			(long long)__entry->offset, __entry->count,
+			__entry->error
+		)
+);
+#define DEFINE_NFS_FSCACHE_PAGE_EVENT(name) \
+	DEFINE_EVENT(nfs_fscache_page_event, name, \
+			TP_PROTO( \
+				const struct inode *inode, \
+				const struct page *page \
+			), \
+			TP_ARGS(inode, page))
+#define DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(name) \
+	DEFINE_EVENT(nfs_fscache_page_event_done, name, \
+			TP_PROTO( \
+				const struct inode *inode, \
+				const struct page *page, \
+				int error \
+			), \
+			TP_ARGS(inode, page, error))
+DEFINE_NFS_FSCACHE_PAGE_EVENT(nfs_fscache_read_page);
+DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(nfs_fscache_read_page_done);
+DEFINE_NFS_FSCACHE_PAGE_EVENT(nfs_fscache_write_page);
+DEFINE_NFS_FSCACHE_PAGE_EVENT_DONE(nfs_fscache_write_page_done);
+
 TRACE_EVENT(nfs_pgio_error,
 	TP_PROTO(
 		const struct nfs_pgio_header *hdr,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  6/7] NFS: Remove remaining dfprintks related to fscache cookies
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
                   ` (4 preceding siblings ...)
  2021-10-07 22:30 ` [PATCH v2 5/7] NFS: Replace dfprintks with tracepoints in read and write page functions Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-07 22:30 ` [PATCH v2 7/7] NFS: Remove remaining usages of NFSDBG_FSCACHE Dave Wysochanski
  2021-10-13 15:41 ` [PATCH v2 0/7] Various NFS fscache cleanups David Wysochanski
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

The fscache cookie APIs including fscache_acquire_cookie() and
fscache_relinquish_cookie() now have very good tracing.  Thus,
there is no real need for dfprintks in the NFS fscache interface.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 7dbe3a404f34..06c4d8ee7281 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -21,7 +21,7 @@
 #include "fscache.h"
 #include "nfstrace.h"
 
-#define NFSDBG_FACILITY		NFSDBG_FSCACHE
+#define NFSDBG_FACILITY                NFSDBG_FSCACHE
 
 static struct rb_root nfs_fscache_keys = RB_ROOT;
 static DEFINE_SPINLOCK(nfs_fscache_keys_lock);
@@ -86,8 +86,6 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)
 					      &key, len,
 					      NULL, 0,
 					      clp, 0, true);
-	dfprintk(FSCACHE, "NFS: get client cookie (0x%p/0x%p)\n",
-		 clp, clp->fscache);
 }
 
 /*
@@ -95,9 +93,6 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)
  */
 void nfs_fscache_release_client_cookie(struct nfs_client *clp)
 {
-	dfprintk(FSCACHE, "NFS: releasing client cookie (0x%p/0x%p)\n",
-		 clp, clp->fscache);
-
 	fscache_relinquish_cookie(clp->fscache, NULL, false);
 	clp->fscache = NULL;
 }
@@ -191,8 +186,6 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int
 					       sizeof(key->key) + ulen,
 					       NULL, 0,
 					       nfss, 0, true);
-	dfprintk(FSCACHE, "NFS: get superblock cookie (0x%p/0x%p)\n",
-		 nfss, nfss->fscache);
 	return;
 
 non_unique:
@@ -211,9 +204,6 @@ void nfs_fscache_release_super_cookie(struct super_block *sb)
 {
 	struct nfs_server *nfss = NFS_SB(sb);
 
-	dfprintk(FSCACHE, "NFS: releasing superblock cookie (0x%p/0x%p)\n",
-		 nfss, nfss->fscache);
-
 	fscache_relinquish_cookie(nfss->fscache, NULL, false);
 	nfss->fscache = NULL;
 
@@ -270,8 +260,6 @@ void nfs_fscache_clear_inode(struct inode *inode)
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct fscache_cookie *cookie = nfs_i_fscache(inode);
 
-	dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie);
-
 	nfs_fscache_update_auxdata(&auxdata, inode);
 	fscache_relinquish_cookie(cookie, &auxdata, false);
 	nfsi->fscache = NULL;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2  7/7] NFS: Remove remaining usages of NFSDBG_FSCACHE
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
                   ` (5 preceding siblings ...)
  2021-10-07 22:30 ` [PATCH v2 6/7] NFS: Remove remaining dfprintks related to fscache cookies Dave Wysochanski
@ 2021-10-07 22:30 ` Dave Wysochanski
  2021-10-13 15:41 ` [PATCH v2 0/7] Various NFS fscache cleanups David Wysochanski
  7 siblings, 0 replies; 9+ messages in thread
From: Dave Wysochanski @ 2021-10-07 22:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

The NFS fscache interface has removed all dfprintks so remove the
NFSDBG_FSCACHE defines.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/fscache-index.c      | 2 --
 fs/nfs/fscache.c            | 2 --
 include/uapi/linux/nfs_fs.h | 2 +-
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/nfs/fscache-index.c b/fs/nfs/fscache-index.c
index 4bd5ce736193..71bb4270641f 100644
--- a/fs/nfs/fscache-index.c
+++ b/fs/nfs/fscache-index.c
@@ -17,8 +17,6 @@
 #include "internal.h"
 #include "fscache.h"
 
-#define NFSDBG_FACILITY		NFSDBG_FSCACHE
-
 /*
  * Define the NFS filesystem for FS-Cache.  Upon registration FS-Cache sticks
  * the cookie for the top-level index object for NFS into here.  The top-level
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 06c4d8ee7281..57cc242ae916 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -21,8 +21,6 @@
 #include "fscache.h"
 #include "nfstrace.h"
 
-#define NFSDBG_FACILITY                NFSDBG_FSCACHE
-
 static struct rb_root nfs_fscache_keys = RB_ROOT;
 static DEFINE_SPINLOCK(nfs_fscache_keys_lock);
 
diff --git a/include/uapi/linux/nfs_fs.h b/include/uapi/linux/nfs_fs.h
index 3afe3767c55d..ae0de165c014 100644
--- a/include/uapi/linux/nfs_fs.h
+++ b/include/uapi/linux/nfs_fs.h
@@ -52,7 +52,7 @@
 #define NFSDBG_CALLBACK		0x0100
 #define NFSDBG_CLIENT		0x0200
 #define NFSDBG_MOUNT		0x0400
-#define NFSDBG_FSCACHE		0x0800
+#define NFSDBG_FSCACHE		0x0800 /* unused */
 #define NFSDBG_PNFS		0x1000
 #define NFSDBG_PNFS_LD		0x2000
 #define NFSDBG_STATE		0x4000
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/7] Various NFS fscache cleanups
  2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
                   ` (6 preceding siblings ...)
  2021-10-07 22:30 ` [PATCH v2 7/7] NFS: Remove remaining usages of NFSDBG_FSCACHE Dave Wysochanski
@ 2021-10-13 15:41 ` David Wysochanski
  7 siblings, 0 replies; 9+ messages in thread
From: David Wysochanski @ 2021-10-13 15:41 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, David Howells; +Cc: linux-cachefs, linux-nfs

On Thu, Oct 7, 2021 at 6:31 PM Dave Wysochanski <dwysocha@redhat.com> wrote:
>
> This patchset is on top of David Howells patchset he just posted as
> v3 of "fscache: Replace and remove old I/O API" and is based on his
> fscache-remove-old-io branch at
> https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=fscache-remove-old-io
> NOTE: fscache-remove-old-io was previously "fscache-iter-3" but it's been
> renamed to better reflect the purpose.
>
> The series is also at:
> https://github.com/DaveWysochanskiRH/kernel.git
> https://github.com/DaveWysochanskiRH/kernel/tree/fscache-remove-old-io-nfs-fixes
>
> Testing is looking ok so far and is still ongoing at BakeAThon and in
> my local testbed with tracepoints enabled via:
> trace-cmd start -e fscache:* -e nfs:* -e nfs4:* -e cachefiles:*
>
> Changes in v2 of this series
> - Dropped first patch of v1 series (dhowells updated his patch)
> - Don't rename or change the value of NFSDBG_FSCACHE (Trond)
> - Rename nfs_readpage_from_fscache and nfs_readpage_to_fscache
> - Rename enable/disable tracepoints to start with "nfs_fscache"
> - Rename fscache IO tracepoints to better reflect the new function names
> - Place the fscache IO tracepoints at begin and end of the functions
>
> Dave Wysochanski (7):
>   NFS: Use nfs_i_fscache() consistently within NFS fscache code
>   NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size
>     properly
>   NFS: Convert NFS fscache enable/disable dfprintks to tracepoints
>   NFS: Rename fscache read and write pages functions
>   NFS: Replace dfprintks with tracepoints in read and write page
>     functions
>   NFS: Remove remaining dfprintks related to fscache cookies
>   NFS: Remove remaining usages of NFSDBG_FSCACHE
>
>  fs/nfs/fscache-index.c      |  2 -
>  fs/nfs/fscache.c            | 76 +++++++++++++----------------------
>  fs/nfs/fscache.h            | 25 ++++++------
>  fs/nfs/nfstrace.h           | 98 +++++++++++++++++++++++++++++++++++++++++++++
>  fs/nfs/read.c               |  4 +-
>  include/uapi/linux/nfs_fs.h |  2 +-
>  6 files changed, 140 insertions(+), 67 deletions(-)
>
> --
> 1.8.3.1
>

Just a report on the testing of this patchset, which also tested
dhowells fscache-remove-old-io branch.  Overall this looks very
stable.

I ran some custom unit tests as well as many xfstest runs.  I saw
no oops or other significant problems during any of the runs.
I saw no differences in Failures on xfstest runs between 5.15.0-rc4
and this set.
I ran the following configurations of servers and NFS options for the
runs (5.15.0-rc4, then 5.15.0-rc4 + this patchset).
1. hammerspace (pnfs flexfiles): vers=4.1,fsc; vers=4.1,nofsc;
vers=4.2,fsc; vers=4.2,nofsc
2. ontap9.x (pnfs filelayout): vers=4.1,fsc; vers=4.1,nofsc
3. rhel7u8 (3.10.0-1127.8.2.el7): vers=3,nofsc; vers=4.0,nofsc;
vers=4.0,fsc; vers=4.2,fsc; vers=4.2,nofsc
4. rhel8 (4.18.0-193.28.1.el8): vers=4.2,fsc


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-13 15:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 22:30 [PATCH v2 0/7] Various NFS fscache cleanups Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 1/7] NFS: Use nfs_i_fscache() consistently within NFS fscache code Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 2/7] NFS: Cleanup usage of nfs_inode in fscache interface and handle i_size properly Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 3/7] NFS: Convert NFS fscache enable/disable dfprintks to tracepoints Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 4/7] NFS: Rename fscache read and write pages functions Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 5/7] NFS: Replace dfprintks with tracepoints in read and write page functions Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 6/7] NFS: Remove remaining dfprintks related to fscache cookies Dave Wysochanski
2021-10-07 22:30 ` [PATCH v2 7/7] NFS: Remove remaining usages of NFSDBG_FSCACHE Dave Wysochanski
2021-10-13 15:41 ` [PATCH v2 0/7] Various NFS fscache cleanups David Wysochanski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.