summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-10-28 15:15:00 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-22 21:35:00 -0800
commitbbdfef1cf007d8e17382b4b97710edfad322d21d (patch)
treeffd9d1a75c3db3e88c1d75e4a7e65cfd9d2d86a5
parent90536ee0ac5418333d3026bf225eb54215fee352 (diff)
xfs: drop the _safe behavior from the xbitmap foreach macro
It's not safe to edit bitmap intervals while we're iterating them with for_each_xbitmap_extent. None of the existing callers actually need that ability anyway, so drop the safe variable. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/scrub/bitmap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c
index e198983db610..7a7554fb2793 100644
--- a/fs/xfs/scrub/bitmap.c
+++ b/fs/xfs/scrub/bitmap.c
@@ -12,8 +12,9 @@
#include "xfs_btree.h"
#include "scrub/bitmap.h"
-#define for_each_xbitmap_extent(bex, n, bitmap) \
- list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
+/* Iterate each interval of a bitmap. Do not change the bitmap. */
+#define for_each_xbitmap_extent(bex, bitmap) \
+ list_for_each_entry((bex), &(bitmap)->list, list)
/*
* Set a range of this bitmap. Caller must ensure the range is not set.
@@ -45,10 +46,9 @@ void
xbitmap_destroy(
struct xbitmap *bitmap)
{
- struct xbitmap_range *bmr;
- struct xbitmap_range *n;
+ struct xbitmap_range *bmr, *n;
- for_each_xbitmap_extent(bmr, n, bitmap) {
+ list_for_each_entry_safe(bmr, n, &bitmap->list, list) {
list_del(&bmr->list);
kmem_free(bmr);
}
@@ -307,10 +307,9 @@ xbitmap_hweight(
struct xbitmap *bitmap)
{
struct xbitmap_range *bmr;
- struct xbitmap_range *n;
uint64_t ret = 0;
- for_each_xbitmap_extent(bmr, n, bitmap)
+ for_each_xbitmap_extent(bmr, bitmap)
ret += bmr->len;
return ret;
@@ -323,10 +322,10 @@ xbitmap_walk(
xbitmap_walk_fn fn,
void *priv)
{
- struct xbitmap_range *bex, *n;
+ struct xbitmap_range *bex;
int error;
- for_each_xbitmap_extent(bex, n, bitmap) {
+ for_each_xbitmap_extent(bex, bitmap) {
error = fn(bex->start, bex->len, priv);
if (error)
break;