Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Copyright (C) 2018 Oracle.  All Rights Reserved.
0004  * Author: Darrick J. Wong <darrick.wong@oracle.com>
0005  */
0006 #ifndef __XFS_SCRUB_BITMAP_H__
0007 #define __XFS_SCRUB_BITMAP_H__
0008 
0009 struct xbitmap_range {
0010     struct list_head    list;
0011     uint64_t        start;
0012     uint64_t        len;
0013 };
0014 
0015 struct xbitmap {
0016     struct list_head    list;
0017 };
0018 
0019 void xbitmap_init(struct xbitmap *bitmap);
0020 void xbitmap_destroy(struct xbitmap *bitmap);
0021 
0022 #define for_each_xbitmap_extent(bex, n, bitmap) \
0023     list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
0024 
0025 #define for_each_xbitmap_block(b, bex, n, bitmap) \
0026     list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) \
0027         for ((b) = (bex)->start; (b) < (bex)->start + (bex)->len; (b)++)
0028 
0029 int xbitmap_set(struct xbitmap *bitmap, uint64_t start, uint64_t len);
0030 int xbitmap_disunion(struct xbitmap *bitmap, struct xbitmap *sub);
0031 int xbitmap_set_btcur_path(struct xbitmap *bitmap,
0032         struct xfs_btree_cur *cur);
0033 int xbitmap_set_btblocks(struct xbitmap *bitmap,
0034         struct xfs_btree_cur *cur);
0035 uint64_t xbitmap_hweight(struct xbitmap *bitmap);
0036 
0037 #endif  /* __XFS_SCRUB_BITMAP_H__ */