diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_alloc_btree.h | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_buf_item.h | 36 | ||||
-rw-r--r-- | fs/xfs/xfs_super.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_types.h | 14 |
5 files changed, 40 insertions, 43 deletions
diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h index a6caa0022c9b..359fb86ed876 100644 --- a/fs/xfs/xfs_alloc_btree.h +++ b/fs/xfs/xfs_alloc_btree.h | |||
@@ -51,20 +51,6 @@ typedef struct xfs_alloc_rec_incore { | |||
51 | typedef __be32 xfs_alloc_ptr_t; | 51 | typedef __be32 xfs_alloc_ptr_t; |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Minimum and maximum blocksize and sectorsize. | ||
55 | * The blocksize upper limit is pretty much arbitrary. | ||
56 | * The sectorsize upper limit is due to sizeof(sb_sectsize). | ||
57 | */ | ||
58 | #define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */ | ||
59 | #define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */ | ||
60 | #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG) | ||
61 | #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG) | ||
62 | #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */ | ||
63 | #define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */ | ||
64 | #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG) | ||
65 | #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG) | ||
66 | |||
67 | /* | ||
68 | * Block numbers in the AG: | 54 | * Block numbers in the AG: |
69 | * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3. | 55 | * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3. |
70 | */ | 56 | */ |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 45df2b857d48..52cd8f89ee72 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -240,15 +240,13 @@ xfs_buf_item_format( | |||
240 | (bip->bli_flags & XFS_BLI_STALE)); | 240 | (bip->bli_flags & XFS_BLI_STALE)); |
241 | 241 | ||
242 | /* | 242 | /* |
243 | * The size of the base structure is the size of the | 243 | * Base size is the actual size of the ondisk structure - it reflects |
244 | * declared structure plus the space for the extra words | 244 | * the actual size of the dirty bitmap rather than the size of the in |
245 | * of the bitmap. We subtract one from the map size, because | 245 | * memory structure. |
246 | * the first element of the bitmap is accounted for in the | ||
247 | * size of the base structure. | ||
248 | */ | 246 | */ |
249 | base_size = | 247 | base_size = offsetof(struct xfs_buf_log_format, blf_data_map) + |
250 | (uint)(sizeof(xfs_buf_log_format_t) + | 248 | (bip->bli_format.blf_map_size * |
251 | ((bip->bli_format.blf_map_size - 1) * sizeof(uint))); | 249 | sizeof(bip->bli_format.blf_data_map[0])); |
252 | vecp->i_addr = &bip->bli_format; | 250 | vecp->i_addr = &bip->bli_format; |
253 | vecp->i_len = base_size; | 251 | vecp->i_len = base_size; |
254 | vecp->i_type = XLOG_REG_TYPE_BFORMAT; | 252 | vecp->i_type = XLOG_REG_TYPE_BFORMAT; |
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h index b6ecd2061e7c..ff2686780239 100644 --- a/fs/xfs/xfs_buf_item.h +++ b/fs/xfs/xfs_buf_item.h | |||
@@ -21,23 +21,6 @@ | |||
21 | extern kmem_zone_t *xfs_buf_item_zone; | 21 | extern kmem_zone_t *xfs_buf_item_zone; |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * This is the structure used to lay out a buf log item in the | ||
25 | * log. The data map describes which 128 byte chunks of the buffer | ||
26 | * have been logged. | ||
27 | * For 6.2 and beyond, this is XFS_LI_BUF. We use this to log everything. | ||
28 | */ | ||
29 | typedef struct xfs_buf_log_format { | ||
30 | unsigned short blf_type; /* buf log item type indicator */ | ||
31 | unsigned short blf_size; /* size of this item */ | ||
32 | ushort blf_flags; /* misc state */ | ||
33 | ushort blf_len; /* number of blocks in this buf */ | ||
34 | __int64_t blf_blkno; /* starting blkno of this buf */ | ||
35 | unsigned int blf_map_size; /* size of data bitmap in words */ | ||
36 | unsigned int blf_data_map[1];/* variable size bitmap of */ | ||
37 | /* regions of buffer in this item */ | ||
38 | } xfs_buf_log_format_t; | ||
39 | |||
40 | /* | ||
41 | * This flag indicates that the buffer contains on disk inodes | 24 | * This flag indicates that the buffer contains on disk inodes |
42 | * and requires special recovery handling. | 25 | * and requires special recovery handling. |
43 | */ | 26 | */ |
@@ -61,6 +44,23 @@ typedef struct xfs_buf_log_format { | |||
61 | #define NBWORD (NBBY * sizeof(unsigned int)) | 44 | #define NBWORD (NBBY * sizeof(unsigned int)) |
62 | 45 | ||
63 | /* | 46 | /* |
47 | * This is the structure used to lay out a buf log item in the | ||
48 | * log. The data map describes which 128 byte chunks of the buffer | ||
49 | * have been logged. | ||
50 | */ | ||
51 | #define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) | ||
52 | |||
53 | typedef struct xfs_buf_log_format { | ||
54 | unsigned short blf_type; /* buf log item type indicator */ | ||
55 | unsigned short blf_size; /* size of this item */ | ||
56 | ushort blf_flags; /* misc state */ | ||
57 | ushort blf_len; /* number of blocks in this buf */ | ||
58 | __int64_t blf_blkno; /* starting blkno of this buf */ | ||
59 | unsigned int blf_map_size; /* used size of data bitmap in words */ | ||
60 | unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */ | ||
61 | } xfs_buf_log_format_t; | ||
62 | |||
63 | /* | ||
64 | * buf log item flags | 64 | * buf log item flags |
65 | */ | 65 | */ |
66 | #define XFS_BLI_HOLD 0x01 | 66 | #define XFS_BLI_HOLD 0x01 |
@@ -102,7 +102,7 @@ typedef struct xfs_buf_log_item { | |||
102 | char *bli_orig; /* original buffer copy */ | 102 | char *bli_orig; /* original buffer copy */ |
103 | char *bli_logged; /* bytes logged (bitmap) */ | 103 | char *bli_logged; /* bytes logged (bitmap) */ |
104 | #endif | 104 | #endif |
105 | xfs_buf_log_format_t bli_format; /* in-log header */ | 105 | struct xfs_buf_log_format bli_format; /* embedded in-log header */ |
106 | } xfs_buf_log_item_t; | 106 | } xfs_buf_log_item_t; |
107 | 107 | ||
108 | void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); | 108 | void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 0d9de41a7151..425f6e9d4c0c 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -1514,9 +1514,8 @@ xfs_init_zones(void) | |||
1514 | * size possible under XFS. This wastes a little bit of memory, | 1514 | * size possible under XFS. This wastes a little bit of memory, |
1515 | * but it is much faster. | 1515 | * but it is much faster. |
1516 | */ | 1516 | */ |
1517 | xfs_buf_item_zone = kmem_zone_init((sizeof(xfs_buf_log_item_t) + | 1517 | xfs_buf_item_zone = kmem_zone_init(sizeof(struct xfs_buf_log_item), |
1518 | (((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / | 1518 | "xfs_buf_item"); |
1519 | NBWORD) * sizeof(int))), "xfs_buf_item"); | ||
1520 | if (!xfs_buf_item_zone) | 1519 | if (!xfs_buf_item_zone) |
1521 | goto out_destroy_log_item_desc_zone; | 1520 | goto out_destroy_log_item_desc_zone; |
1522 | 1521 | ||
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h index 398cf681d025..7a41874f4c20 100644 --- a/fs/xfs/xfs_types.h +++ b/fs/xfs/xfs_types.h | |||
@@ -133,6 +133,20 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ | |||
133 | #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ | 133 | #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ |
134 | 134 | ||
135 | /* | 135 | /* |
136 | * Minimum and maximum blocksize and sectorsize. | ||
137 | * The blocksize upper limit is pretty much arbitrary. | ||
138 | * The sectorsize upper limit is due to sizeof(sb_sectsize). | ||
139 | */ | ||
140 | #define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */ | ||
141 | #define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */ | ||
142 | #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG) | ||
143 | #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG) | ||
144 | #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */ | ||
145 | #define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */ | ||
146 | #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG) | ||
147 | #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG) | ||
148 | |||
149 | /* | ||
136 | * Min numbers of data/attr fork btree root pointers. | 150 | * Min numbers of data/attr fork btree root pointers. |
137 | */ | 151 | */ |
138 | #define MINDBTPTRS 3 | 152 | #define MINDBTPTRS 3 |