summaryrefslogtreecommitdiff
path: root/disk-io.h
diff options
context:
space:
mode:
Diffstat (limited to 'disk-io.h')
-rw-r--r--disk-io.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/disk-io.h b/disk-io.h
index c4afea3f..08ee5cee 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -98,11 +98,17 @@ enum btrfs_read_sb_flags {
SBREAD_PARTIAL = (1 << 1),
};
+/*
+ * Use macro to define mirror super block position,
+ * so we can use it in static array initialization
+ */
+#define BTRFS_SB_MIRROR_OFFSET(mirror) ((u64)(SZ_16K) << \
+ (BTRFS_SUPER_MIRROR_SHIFT * (mirror)))
+
static inline u64 btrfs_sb_offset(int mirror)
{
- u64 start = SZ_16K;
if (mirror)
- return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror);
+ return BTRFS_SB_MIRROR_OFFSET(mirror);
return BTRFS_SUPER_INFO_OFFSET;
}