linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/9] libfrog/xfs_scrub: improve iteration function documentation
Date: Tue, 22 Oct 2019 11:47:11 -0700	[thread overview]
Message-ID: <157177003101.1459098.14051619846815688600.stgit@magnolia> (raw)
In-Reply-To: <157177002473.1459098.11320398367215468164.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Between libfrog and xfs_scrub, we have several item collection iteration
functions that take a pointer to a function that will be called for
every item in that collection.  They're not well documented, so improve
the description of when they'll be called and what kinds of return
values they expect.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libfrog/ptvar.h  |    8 ++++++--
 scrub/filemap.h  |    4 ++++
 scrub/inodes.h   |    6 ++++++
 scrub/spacemap.h |    4 ++++
 scrub/vfs.h      |   10 ++++++++++
 5 files changed, 30 insertions(+), 2 deletions(-)


diff --git a/libfrog/ptvar.h b/libfrog/ptvar.h
index 42865c0b..b7d02d62 100644
--- a/libfrog/ptvar.h
+++ b/libfrog/ptvar.h
@@ -8,11 +8,15 @@
 
 struct ptvar;
 
-typedef int (*ptvar_iter_fn)(struct ptvar *ptv, void *data, void *foreach_arg);
-
 int ptvar_alloc(size_t nr, size_t size, struct ptvar **pptv);
 void ptvar_free(struct ptvar *ptv);
 void *ptvar_get(struct ptvar *ptv, int *ret);
+
+/*
+ * Visit each per-thread value.  Return 0 to continue iteration or nonzero to
+ * stop iterating and return to the caller.
+ */
+typedef int (*ptvar_iter_fn)(struct ptvar *ptv, void *data, void *foreach_arg);
 int ptvar_foreach(struct ptvar *ptv, ptvar_iter_fn fn, void *foreach_arg);
 
 #endif /* __LIBFROG_PTVAR_H__ */
diff --git a/scrub/filemap.h b/scrub/filemap.h
index cb331729..219be575 100644
--- a/scrub/filemap.h
+++ b/scrub/filemap.h
@@ -14,6 +14,10 @@ struct xfs_bmap {
 	uint32_t	bm_flags;	/* output flags */
 };
 
+/*
+ * Visit each inode fork mapping.  Return true to continue iteration or false
+ * to stop iterating and return to the caller.
+ */
 typedef bool (*xfs_bmap_iter_fn)(struct scrub_ctx *ctx, const char *descr,
 		int fd, int whichfork, struct fsxattr *fsx,
 		struct xfs_bmap *bmap, void *arg);
diff --git a/scrub/inodes.h b/scrub/inodes.h
index 3341c6d9..e58795e7 100644
--- a/scrub/inodes.h
+++ b/scrub/inodes.h
@@ -6,6 +6,12 @@
 #ifndef XFS_SCRUB_INODES_H_
 #define XFS_SCRUB_INODES_H_
 
+/*
+ * Visit each space mapping of an inode fork.  Return 0 to continue iteration
+ * or a positive error code to interrupt iteraton.  If ESTALE is returned,
+ * iteration will be restarted from the beginning of the inode allocation
+ * group.  Any other non zero value will stop iteration.
+ */
 typedef int (*xfs_inode_iter_fn)(struct scrub_ctx *ctx,
 		struct xfs_handle *handle, struct xfs_bulkstat *bs, void *arg);
 
diff --git a/scrub/spacemap.h b/scrub/spacemap.h
index 8f2f0a01..c29c43a5 100644
--- a/scrub/spacemap.h
+++ b/scrub/spacemap.h
@@ -6,6 +6,10 @@
 #ifndef XFS_SCRUB_SPACEMAP_H_
 #define XFS_SCRUB_SPACEMAP_H_
 
+/*
+ * Visit each space mapping in the filesystem.  Return true to continue
+ * iteration or false to stop iterating and return to the caller.
+ */
 typedef bool (*xfs_fsmap_iter_fn)(struct scrub_ctx *ctx, const char *descr,
 		struct fsmap *fsr, void *arg);
 
diff --git a/scrub/vfs.h b/scrub/vfs.h
index caef8969..af23674a 100644
--- a/scrub/vfs.h
+++ b/scrub/vfs.h
@@ -6,8 +6,18 @@
 #ifndef XFS_SCRUB_VFS_H_
 #define XFS_SCRUB_VFS_H_
 
+/*
+ * Visit a subdirectory prior to iterating entries in that subdirectory.
+ * Return true to continue iteration or false to stop iterating and return to
+ * the caller.
+ */
 typedef bool (*scan_fs_tree_dir_fn)(struct scrub_ctx *, const char *,
 		int, void *);
+
+/*
+ * Visit each directory entry in a directory.  Return true to continue
+ * iteration or false to stop iterating and return to the caller.
+ */
 typedef bool (*scan_fs_tree_dirent_fn)(struct scrub_ctx *, const char *,
 		int, struct dirent *, struct stat *, void *);
 


  reply	other threads:[~2019-10-22 18:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 18:47 [PATCH 0/9] xfs_scrub: fix IO error reporting Darrick J. Wong
2019-10-22 18:47 ` Darrick J. Wong [this message]
2019-11-01 19:57   ` [PATCH 1/9] libfrog/xfs_scrub: improve iteration function documentation Eric Sandeen
2019-10-22 18:47 ` [PATCH 2/9] xfs_scrub: separate media error reporting for attribute forks Darrick J. Wong
2019-11-01 20:00   ` Eric Sandeen
2019-10-22 18:47 ` [PATCH 3/9] xfs_scrub: improve reporting of file data media errors Darrick J. Wong
2019-11-01 20:04   ` Eric Sandeen
2019-10-22 18:47 ` [PATCH 4/9] xfs_scrub: better reporting of metadata " Darrick J. Wong
2019-11-01 20:08   ` Eric Sandeen
2019-10-22 18:47 ` [PATCH 5/9] xfs_scrub: improve reporting of file " Darrick J. Wong
2019-10-22 18:47 ` [PATCH 6/9] xfs_scrub: don't report media errors on unwritten extents Darrick J. Wong
2019-10-22 18:47 ` [PATCH 7/9] xfs_scrub: reduce fsmap activity for media errors Darrick J. Wong
2019-11-01 20:29   ` Eric Sandeen
2019-10-22 18:47 ` [PATCH 8/9] xfs_scrub: request fewer bmaps when we can Darrick J. Wong
2019-11-01 20:31   ` Eric Sandeen
2019-10-22 18:48 ` [PATCH 9/9] xfs_scrub: fix media verification thread pool size calculations Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157177003101.1459098.14051619846815688600.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).