diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-10-31 18:46:42 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-11 00:56:33 -0500 |
commit | 81ab4190ac17df41686a37c97f701623276b652a (patch) | |
tree | be7f48b5ad6d36fadbac4658d37953d324d760d0 /drivers/md/bcache/bset.h | |
parent | 2599b53b7b0ea6103d1661dca74d35480cb8fa1f (diff) |
bcache: Pull on disk data structures out into a separate header
Now, the on disk data structures are in a header that can be exported to
userspace - and having them all centralized is nice too.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/bset.h')
-rw-r--r-- | drivers/md/bcache/bset.h | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h index 8a9305685b7e..5cd90565dfe2 100644 --- a/drivers/md/bcache/bset.h +++ b/drivers/md/bcache/bset.h | |||
@@ -193,37 +193,6 @@ static __always_inline int64_t bkey_cmp(const struct bkey *l, | |||
193 | : (int64_t) KEY_OFFSET(l) - (int64_t) KEY_OFFSET(r); | 193 | : (int64_t) KEY_OFFSET(l) - (int64_t) KEY_OFFSET(r); |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline size_t bkey_u64s(const struct bkey *k) | ||
197 | { | ||
198 | BUG_ON(KEY_CSUM(k) > 1); | ||
199 | return 2 + KEY_PTRS(k) + (KEY_CSUM(k) ? 1 : 0); | ||
200 | } | ||
201 | |||
202 | static inline size_t bkey_bytes(const struct bkey *k) | ||
203 | { | ||
204 | return bkey_u64s(k) * sizeof(uint64_t); | ||
205 | } | ||
206 | |||
207 | static inline void bkey_copy(struct bkey *dest, const struct bkey *src) | ||
208 | { | ||
209 | memcpy(dest, src, bkey_bytes(src)); | ||
210 | } | ||
211 | |||
212 | static inline void bkey_copy_key(struct bkey *dest, const struct bkey *src) | ||
213 | { | ||
214 | if (!src) | ||
215 | src = &KEY(0, 0, 0); | ||
216 | |||
217 | SET_KEY_INODE(dest, KEY_INODE(src)); | ||
218 | SET_KEY_OFFSET(dest, KEY_OFFSET(src)); | ||
219 | } | ||
220 | |||
221 | static inline struct bkey *bkey_next(const struct bkey *k) | ||
222 | { | ||
223 | uint64_t *d = (void *) k; | ||
224 | return (struct bkey *) (d + bkey_u64s(k)); | ||
225 | } | ||
226 | |||
227 | /* Keylists */ | 196 | /* Keylists */ |
228 | 197 | ||
229 | struct keylist { | 198 | struct keylist { |