From b1f0067aba5cc51540922e4187d5e8c8f77b1431 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Wed, 24 Jun 2020 18:02:54 +0200 Subject: fs: btrfs: Crossport volumes.[ch] from btrfs-progs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch crossports volumes.[ch] from btrfs-progs, including: - btrfs_map_block() The core mechanism to map btrfs logical address to physical address. This version includes multi-device support, along with RAID56 support. - btrfs_scan_one_device() This is the function to register one btrfs device to the list. This is the main part of the multi-device btrfs assembling process. Although we're not going to support multiple devices until U-Boot allows us to scan one device without actually opening it. Signed-off-by: Qu Wenruo Reviewed-by: Marek BehĂșn [trini: Use %zu in a debug print to avoid warning] Signed-off-by: Tom Rini --- fs/btrfs/compat.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/btrfs/compat.h') diff --git a/fs/btrfs/compat.h b/fs/btrfs/compat.h index 12fb9f8..be4f4e7 100644 --- a/fs/btrfs/compat.h +++ b/fs/btrfs/compat.h @@ -68,4 +68,9 @@ static inline void uuid_unparse(const u8 *uuid, char *out) return uuid_bin_to_str((unsigned char *)uuid, out, 0); } +static inline int is_power_of_2(unsigned long n) +{ + return (n != 0 && ((n & (n - 1)) == 0)); +} + #endif -- cgit v1.1