diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-12 06:49:29 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 17:13:10 -0400 |
commit | c7298202e5df6fad66c7c8146bf2ed55ba07aff0 (patch) | |
tree | b2aa33f8869ac927af3aa4185cd4fee4f6ac788d /fs/xfs | |
parent | 2a3c0acc351baf1e5e584d8d0692f41d5067582c (diff) |
xfs: introduce xfs_rtalloc_defs.h
There are quite a few realtime device definitions shared with
userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h
so we don't need to share xfs_rtalloc.h with userspace anymore.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_format.h | 41 | ||||
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_rtalloc.h | 53 | ||||
-rw-r--r-- | fs/xfs/xfs_types.h | 10 |
4 files changed, 54 insertions, 52 deletions
diff --git a/fs/xfs/xfs_format.h b/fs/xfs/xfs_format.h index 2b4f16668123..62053744a0a6 100644 --- a/fs/xfs/xfs_format.h +++ b/fs/xfs/xfs_format.h | |||
@@ -28,6 +28,47 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * RealTime Device format definitions | ||
32 | */ | ||
33 | |||
34 | /* Min and max rt extent sizes, specified in bytes */ | ||
35 | #define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */ | ||
36 | #define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64kB */ | ||
37 | #define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4kB */ | ||
38 | |||
39 | #define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) | ||
40 | #define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) | ||
41 | #define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize) | ||
42 | #define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask) | ||
43 | |||
44 | /* | ||
45 | * RT Summary and bit manipulation macros. | ||
46 | */ | ||
47 | #define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) | ||
48 | #define XFS_SUMOFFSTOBLOCK(mp,s) \ | ||
49 | (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) | ||
50 | #define XFS_SUMPTR(mp,bp,so) \ | ||
51 | ((xfs_suminfo_t *)((bp)->b_addr + \ | ||
52 | (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) | ||
53 | |||
54 | #define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log) | ||
55 | #define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log) | ||
56 | #define XFS_BITTOWORD(mp,bi) \ | ||
57 | ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) | ||
58 | |||
59 | #define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b)) | ||
60 | #define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b)) | ||
61 | |||
62 | #define XFS_RTLOBIT(w) xfs_lowbit32(w) | ||
63 | #define XFS_RTHIBIT(w) xfs_highbit32(w) | ||
64 | |||
65 | #if XFS_BIG_BLKNOS | ||
66 | #define XFS_RTBLOCKLOG(b) xfs_highbit64(b) | ||
67 | #else | ||
68 | #define XFS_RTBLOCKLOG(b) xfs_highbit32(b) | ||
69 | #endif | ||
70 | |||
71 | /* | ||
31 | * Dquot and dquot block format definitions | 72 | * Dquot and dquot block format definitions |
32 | */ | 73 | */ |
33 | #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */ | 74 | #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */ |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 98dc670d3ee0..5d900ec0ce7b 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include "xfs.h" | 18 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 20 | #include "xfs_format.h" |
21 | #include "xfs_bit.h" | 21 | #include "xfs_bit.h" |
22 | #include "xfs_log.h" | 22 | #include "xfs_log.h" |
23 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h index f7f3a359c1c5..b2a1a24c0e2f 100644 --- a/fs/xfs/xfs_rtalloc.h +++ b/fs/xfs/xfs_rtalloc.h | |||
@@ -18,58 +18,11 @@ | |||
18 | #ifndef __XFS_RTALLOC_H__ | 18 | #ifndef __XFS_RTALLOC_H__ |
19 | #define __XFS_RTALLOC_H__ | 19 | #define __XFS_RTALLOC_H__ |
20 | 20 | ||
21 | /* kernel only definitions and functions */ | ||
22 | |||
21 | struct xfs_mount; | 23 | struct xfs_mount; |
22 | struct xfs_trans; | 24 | struct xfs_trans; |
23 | 25 | ||
24 | /* Min and max rt extent sizes, specified in bytes */ | ||
25 | #define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */ | ||
26 | #define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64kB */ | ||
27 | #define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4kB */ | ||
28 | |||
29 | /* | ||
30 | * Constants for bit manipulations. | ||
31 | */ | ||
32 | #define XFS_NBBYLOG 3 /* log2(NBBY) */ | ||
33 | #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */ | ||
34 | #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) | ||
35 | #define XFS_NBWORD (1 << XFS_NBWORDLOG) | ||
36 | #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) | ||
37 | |||
38 | #define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) | ||
39 | #define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) | ||
40 | #define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize) | ||
41 | #define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask) | ||
42 | |||
43 | /* | ||
44 | * Summary and bit manipulation macros. | ||
45 | */ | ||
46 | #define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) | ||
47 | #define XFS_SUMOFFSTOBLOCK(mp,s) \ | ||
48 | (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) | ||
49 | #define XFS_SUMPTR(mp,bp,so) \ | ||
50 | ((xfs_suminfo_t *)((bp)->b_addr + \ | ||
51 | (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) | ||
52 | |||
53 | #define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log) | ||
54 | #define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log) | ||
55 | #define XFS_BITTOWORD(mp,bi) \ | ||
56 | ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) | ||
57 | |||
58 | #define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b)) | ||
59 | #define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b)) | ||
60 | |||
61 | #define XFS_RTLOBIT(w) xfs_lowbit32(w) | ||
62 | #define XFS_RTHIBIT(w) xfs_highbit32(w) | ||
63 | |||
64 | #if XFS_BIG_BLKNOS | ||
65 | #define XFS_RTBLOCKLOG(b) xfs_highbit64(b) | ||
66 | #else | ||
67 | #define XFS_RTBLOCKLOG(b) xfs_highbit32(b) | ||
68 | #endif | ||
69 | |||
70 | |||
71 | #ifdef __KERNEL__ | ||
72 | |||
73 | #ifdef CONFIG_XFS_RT | 26 | #ifdef CONFIG_XFS_RT |
74 | /* | 27 | /* |
75 | * Function prototypes for exported functions. | 28 | * Function prototypes for exported functions. |
@@ -161,6 +114,4 @@ xfs_rtmount_init( | |||
161 | # define xfs_rtunmount_inodes(m) | 114 | # define xfs_rtunmount_inodes(m) |
162 | #endif /* CONFIG_XFS_RT */ | 115 | #endif /* CONFIG_XFS_RT */ |
163 | 116 | ||
164 | #endif /* __KERNEL__ */ | ||
165 | |||
166 | #endif /* __XFS_RTALLOC_H__ */ | 117 | #endif /* __XFS_RTALLOC_H__ */ |
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h index 69074ac20ac3..781772c6f192 100644 --- a/fs/xfs/xfs_types.h +++ b/fs/xfs/xfs_types.h | |||
@@ -183,4 +183,14 @@ struct xfs_name { | |||
183 | */ | 183 | */ |
184 | typedef __uint32_t xfs_dqid_t; | 184 | typedef __uint32_t xfs_dqid_t; |
185 | 185 | ||
186 | /* | ||
187 | * Constants for bit manipulations. | ||
188 | */ | ||
189 | #define XFS_NBBYLOG 3 /* log2(NBBY) */ | ||
190 | #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */ | ||
191 | #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) | ||
192 | #define XFS_NBWORD (1 << XFS_NBWORDLOG) | ||
193 | #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) | ||
194 | |||
195 | |||
186 | #endif /* __XFS_TYPES_H__ */ | 196 | #endif /* __XFS_TYPES_H__ */ |