diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:18:56 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:56 -0400 |
commit | 0f82731fc56448c2733f58e1f5db6c2cbfc90652 (patch) | |
tree | 8c4d12a1c240db310becdff74e27d9aab36f1569 /fs/btrfs/ctree.h | |
parent | 810191ff3087e8143b41a944fcf4fd8c693f00e3 (diff) |
Breakout BTRFS_SETGET_FUNCS into a separate C file, the inlines were too big.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 74 |
1 files changed, 4 insertions, 70 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index a942a2427228..d1c6f023a302 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -426,77 +426,11 @@ struct btrfs_root { | |||
426 | offsetof(type, member), \ | 426 | offsetof(type, member), \ |
427 | sizeof(((type *)0)->member))) | 427 | sizeof(((type *)0)->member))) |
428 | 428 | ||
429 | #ifndef BTRFS_SETGET_FUNCS | ||
429 | #define BTRFS_SETGET_FUNCS(name, type, member, bits) \ | 430 | #define BTRFS_SETGET_FUNCS(name, type, member, bits) \ |
430 | static inline u##bits btrfs_##name(struct extent_buffer *eb, \ | 431 | u##bits btrfs_##name(struct extent_buffer *eb, type *s); \ |
431 | type *s) \ | 432 | void btrfs_set_##name(struct extent_buffer *eb, type *s, u##bits val); |
432 | { \ | 433 | #endif |
433 | int err; \ | ||
434 | char *map_token; \ | ||
435 | char *kaddr; \ | ||
436 | int unmap_on_exit = (eb->map_token == NULL); \ | ||
437 | unsigned long map_start; \ | ||
438 | unsigned long map_len; \ | ||
439 | unsigned long offset = (unsigned long)s + \ | ||
440 | offsetof(type, member); \ | ||
441 | if (eb->map_token && offset >= eb->map_start && \ | ||
442 | offset + sizeof(((type *)0)->member) <= eb->map_start + \ | ||
443 | eb->map_len) { \ | ||
444 | kaddr = eb->kaddr; \ | ||
445 | map_start = eb->map_start; \ | ||
446 | err = 0; \ | ||
447 | } else { \ | ||
448 | err = map_extent_buffer(eb, offset, \ | ||
449 | sizeof(((type *)0)->member), \ | ||
450 | &map_token, &kaddr, \ | ||
451 | &map_start, &map_len, KM_USER1); \ | ||
452 | } \ | ||
453 | if (!err) { \ | ||
454 | __le##bits *tmp = (__le##bits *)(kaddr + offset - \ | ||
455 | map_start); \ | ||
456 | u##bits res = le##bits##_to_cpu(*tmp); \ | ||
457 | if (unmap_on_exit) \ | ||
458 | unmap_extent_buffer(eb, map_token, KM_USER1); \ | ||
459 | return res; \ | ||
460 | } else { \ | ||
461 | __le##bits res; \ | ||
462 | read_eb_member(eb, s, type, member, &res); \ | ||
463 | return le##bits##_to_cpu(res); \ | ||
464 | } \ | ||
465 | } \ | ||
466 | static inline void btrfs_set_##name(struct extent_buffer *eb, \ | ||
467 | type *s, u##bits val) \ | ||
468 | { \ | ||
469 | int err; \ | ||
470 | char *map_token; \ | ||
471 | char *kaddr; \ | ||
472 | unsigned long map_start; \ | ||
473 | unsigned long map_len; \ | ||
474 | int unmap_on_exit = (eb->map_token == NULL); \ | ||
475 | unsigned long offset = (unsigned long)s + \ | ||
476 | offsetof(type, member); \ | ||
477 | if (eb->map_token && offset >= eb->map_start && \ | ||
478 | offset + sizeof(((type *)0)->member) <= eb->map_start + \ | ||
479 | eb->map_len) { \ | ||
480 | kaddr = eb->kaddr; \ | ||
481 | map_start = eb->map_start; \ | ||
482 | err = 0; \ | ||
483 | } else { \ | ||
484 | err = map_extent_buffer(eb, offset, \ | ||
485 | sizeof(((type *)0)->member), \ | ||
486 | &map_token, &kaddr, \ | ||
487 | &map_start, &map_len, KM_USER1); \ | ||
488 | } \ | ||
489 | if (!err) { \ | ||
490 | __le##bits *tmp = (__le##bits *)(kaddr + offset - \ | ||
491 | map_start); \ | ||
492 | *tmp = cpu_to_le##bits(val); \ | ||
493 | if (unmap_on_exit) \ | ||
494 | unmap_extent_buffer(eb, map_token, KM_USER1); \ | ||
495 | } else { \ | ||
496 | val = cpu_to_le##bits(val); \ | ||
497 | write_eb_member(eb, s, type, member, &val); \ | ||
498 | } \ | ||
499 | } | ||
500 | 434 | ||
501 | #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ | 435 | #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ |
502 | static inline u##bits btrfs_##name(struct extent_buffer *eb) \ | 436 | static inline u##bits btrfs_##name(struct extent_buffer *eb) \ |