diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ext4_fs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index dfe4487fc739..fb31c1aba989 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -767,6 +767,26 @@ struct ext4_dir_entry_2 { | |||
767 | #define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) | 767 | #define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) |
768 | #define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ | 768 | #define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ |
769 | ~EXT4_DIR_ROUND) | 769 | ~EXT4_DIR_ROUND) |
770 | #define EXT4_MAX_REC_LEN ((1<<16)-1) | ||
771 | |||
772 | static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | ||
773 | { | ||
774 | unsigned len = le16_to_cpu(dlen); | ||
775 | |||
776 | if (len == EXT4_MAX_REC_LEN) | ||
777 | return 1 << 16; | ||
778 | return len; | ||
779 | } | ||
780 | |||
781 | static inline __le16 ext4_rec_len_to_disk(unsigned len) | ||
782 | { | ||
783 | if (len == (1 << 16)) | ||
784 | return cpu_to_le16(EXT4_MAX_REC_LEN); | ||
785 | else if (len > (1 << 16)) | ||
786 | BUG(); | ||
787 | return cpu_to_le16(len); | ||
788 | } | ||
789 | |||
770 | /* | 790 | /* |
771 | * Hash Tree Directory indexing | 791 | * Hash Tree Directory indexing |
772 | * (c) Daniel Phillips, 2001 | 792 | * (c) Daniel Phillips, 2001 |