Commit 7296a6d6 authored by Darrick J. Wong's avatar Darrick J. Wong

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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 178b48d5
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "scrub/bitmap.h" #include "scrub/bitmap.h"
#define for_each_xbitmap_extent(bex, n, bitmap) \ /* Iterate each interval of a bitmap. Do not change the bitmap. */
list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) #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. * Set a range of this bitmap. Caller must ensure the range is not set.
...@@ -46,10 +47,9 @@ void ...@@ -46,10 +47,9 @@ void
xbitmap_destroy( xbitmap_destroy(
struct xbitmap *bitmap) struct xbitmap *bitmap)
{ {
struct xbitmap_range *bmr; struct xbitmap_range *bmr, *n;
struct xbitmap_range *n;
for_each_xbitmap_extent(bmr, n, bitmap) { list_for_each_entry_safe(bmr, n, &bitmap->list, list) {
list_del(&bmr->list); list_del(&bmr->list);
kfree(bmr); kfree(bmr);
} }
...@@ -308,10 +308,9 @@ xbitmap_hweight( ...@@ -308,10 +308,9 @@ xbitmap_hweight(
struct xbitmap *bitmap) struct xbitmap *bitmap)
{ {
struct xbitmap_range *bmr; struct xbitmap_range *bmr;
struct xbitmap_range *n;
uint64_t ret = 0; uint64_t ret = 0;
for_each_xbitmap_extent(bmr, n, bitmap) for_each_xbitmap_extent(bmr, bitmap)
ret += bmr->len; ret += bmr->len;
return ret; return ret;
...@@ -324,10 +323,10 @@ xbitmap_walk( ...@@ -324,10 +323,10 @@ xbitmap_walk(
xbitmap_walk_fn fn, xbitmap_walk_fn fn,
void *priv) void *priv)
{ {
struct xbitmap_range *bex, *n; struct xbitmap_range *bex;
int error = 0; int error = 0;
for_each_xbitmap_extent(bex, n, bitmap) { for_each_xbitmap_extent(bex, bitmap) {
error = fn(bex->start, bex->len, priv); error = fn(bex->start, bex->len, priv);
if (error) if (error)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment