diff options
author | Jan Kara <jack@suse.cz> | 2007-11-14 20:00:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:43 -0500 |
commit | 7c06a8dc64a2d1884bd19b4c6353d9267ae4e3e1 (patch) | |
tree | 67afad25e4de3139d3b993e22327096c3e015013 /include/linux/ext3_fs.h | |
parent | dbaf4c024a657175f43b5091c4fab8b9f0e17078 (diff) |
Fix 64KB blocksize in ext3 directories
With 64KB blocksize, a directory entry can have size 64KB which does not
fit into 16 bits we have for entry lenght. So we store 0xffff instead and
convert value when read from / written to disk. The patch also converts
some places to use ext3_next_entry() when we are changing them anyway.
[akpm@linux-foundation.org: coding-style cleanups]
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ext3_fs.h')
-rw-r--r-- | include/linux/ext3_fs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 64134456ed8c..241c01cb92b2 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -656,6 +656,26 @@ struct ext3_dir_entry_2 { | |||
656 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) | 656 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) |
657 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ | 657 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ |
658 | ~EXT3_DIR_ROUND) | 658 | ~EXT3_DIR_ROUND) |
659 | #define EXT3_MAX_REC_LEN ((1<<16)-1) | ||
660 | |||
661 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) | ||
662 | { | ||
663 | unsigned len = le16_to_cpu(dlen); | ||
664 | |||
665 | if (len == EXT3_MAX_REC_LEN) | ||
666 | return 1 << 16; | ||
667 | return len; | ||
668 | } | ||
669 | |||
670 | static inline __le16 ext3_rec_len_to_disk(unsigned len) | ||
671 | { | ||
672 | if (len == (1 << 16)) | ||
673 | return cpu_to_le16(EXT3_MAX_REC_LEN); | ||
674 | else if (len > (1 << 16)) | ||
675 | BUG(); | ||
676 | return cpu_to_le16(len); | ||
677 | } | ||
678 | |||
659 | /* | 679 | /* |
660 | * Hash Tree Directory indexing | 680 | * Hash Tree Directory indexing |
661 | * (c) Daniel Phillips, 2001 | 681 | * (c) Daniel Phillips, 2001 |