aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-08-06 13:21:20 -0400
committerChris Mason <chris.mason@oracle.com>2012-03-26 16:50:37 -0400
commit727011e07cbdf87772fcc1999cccd15cc915eb62 (patch)
tree05405dc1e9c86d67dbb02ddf063bd0c137ce6707 /fs/btrfs/ctree.h
parent81c9ad237c604adec79fd4d4034264c6669e0ab3 (diff)
Btrfs: allow metadata blocks larger than the page size
A few years ago the btrfs code to support blocks lager than the page size was disabled to fix a few corner cases in the page cache handling. This fixes the code to properly support large metadata blocks again. Since current kernels will crash early and often with larger metadata blocks, this adds an incompat bit so that older kernels can't mount it. This also does away with different blocksizes for nodes and leaves. You get a single block size for all tree blocks. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index edccc948e877..85ab1c5844a2 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -138,6 +138,12 @@ struct btrfs_ordered_sum;
138#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 138#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2
139 139
140/* 140/*
141 * the max metadata block size. This limit is somewhat artificial,
142 * but the memmove costs go through the roof for larger blocks.
143 */
144#define BTRFS_MAX_METADATA_BLOCKSIZE 65536
145
146/*
141 * we can actually store much bigger names, but lets not confuse the rest 147 * we can actually store much bigger names, but lets not confuse the rest
142 * of linux 148 * of linux
143 */ 149 */
@@ -461,6 +467,19 @@ struct btrfs_super_block {
461#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) 467#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
462#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) 468#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
463#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3) 469#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
470/*
471 * some patches floated around with a second compression method
472 * lets save that incompat here for when they do get in
473 * Note we don't actually support it, we're just reserving the
474 * number
475 */
476#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 (1ULL << 4)
477
478/*
479 * older kernels tried to do bigger metadata blocks, but the
480 * code was pretty buggy. Lets not let them try anymore.
481 */
482#define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
464 483
465#define BTRFS_FEATURE_COMPAT_SUPP 0ULL 484#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
466#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL 485#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL
@@ -468,6 +487,7 @@ struct btrfs_super_block {
468 (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \ 487 (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \
469 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \ 488 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \
470 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \ 489 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \
490 BTRFS_FEATURE_INCOMPAT_BIG_METADATA | \
471 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO) 491 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO)
472 492
473/* 493/*
@@ -1555,14 +1575,14 @@ void btrfs_set_##name(struct extent_buffer *eb, type *s, u##bits val);
1555#define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ 1575#define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \
1556static inline u##bits btrfs_##name(struct extent_buffer *eb) \ 1576static inline u##bits btrfs_##name(struct extent_buffer *eb) \
1557{ \ 1577{ \
1558 type *p = page_address(eb->first_page); \ 1578 type *p = page_address(eb->pages[0]); \
1559 u##bits res = le##bits##_to_cpu(p->member); \ 1579 u##bits res = le##bits##_to_cpu(p->member); \
1560 return res; \ 1580 return res; \
1561} \ 1581} \
1562static inline void btrfs_set_##name(struct extent_buffer *eb, \ 1582static inline void btrfs_set_##name(struct extent_buffer *eb, \
1563 u##bits val) \ 1583 u##bits val) \
1564{ \ 1584{ \
1565 type *p = page_address(eb->first_page); \ 1585 type *p = page_address(eb->pages[0]); \
1566 p->member = cpu_to_le##bits(val); \ 1586 p->member = cpu_to_le##bits(val); \
1567} 1587}
1568 1588