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-10-28 21:00:38 -0700
commitcd03d29afdbfc7d8edd8fb354baa3d1b7614f1b5 (patch)
tree7a8fdd8c24b1e822f78ea3a656b0e4084a9d846d
parent89cf94ff444dbda5632b88d2a2f35759da0d3816 (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.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c
index e198983db610..2a6f7f05c668 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.
@@ -46,9 +47,8 @@ xbitmap_destroy(
struct xbitmap *bitmap)
{
struct xbitmap_range *bmr;
- struct xbitmap_range *n;
- for_each_xbitmap_extent(bmr, n, bitmap) {
+ for_each_xbitmap_extent(bmr, bitmap) {
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;