bitmap.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2018 Oracle. All Rights Reserved.
  4. * Author: Darrick J. Wong <darrick.wong@oracle.com>
  5. */
  6. #ifndef __XFS_SCRUB_BITMAP_H__
  7. #define __XFS_SCRUB_BITMAP_H__
  8. struct xfs_bitmap_range {
  9. struct list_head list;
  10. uint64_t start;
  11. uint64_t len;
  12. };
  13. struct xfs_bitmap {
  14. struct list_head list;
  15. };
  16. void xfs_bitmap_init(struct xfs_bitmap *bitmap);
  17. void xfs_bitmap_destroy(struct xfs_bitmap *bitmap);
  18. #define for_each_xfs_bitmap_extent(bex, n, bitmap) \
  19. list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
  20. #define for_each_xfs_bitmap_block(b, bex, n, bitmap) \
  21. list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) \
  22. for ((b) = bex->start; (b) < bex->start + bex->len; (b)++)
  23. int xfs_bitmap_set(struct xfs_bitmap *bitmap, uint64_t start, uint64_t len);
  24. int xfs_bitmap_disunion(struct xfs_bitmap *bitmap, struct xfs_bitmap *sub);
  25. int xfs_bitmap_set_btcur_path(struct xfs_bitmap *bitmap,
  26. struct xfs_btree_cur *cur);
  27. int xfs_bitmap_set_btblocks(struct xfs_bitmap *bitmap,
  28. struct xfs_btree_cur *cur);
  29. #endif /* __XFS_SCRUB_BITMAP_H__ */