diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2009-02-14 23:01:36 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-02-14 23:01:36 -0500 |
commit | 3d0518f4758eca4339e75e5b9dbb7e06a5ce08b4 (patch) | |
tree | 30a45a1c82d830646a69591c470680573e14de07 /fs/ext4/ext4.h | |
parent | 8bad4597c2d71365adfa846ea1ca6cf99161a455 (diff) | |
download | blackbird-op-linux-3d0518f4758eca4339e75e5b9dbb7e06a5ce08b4.tar.gz blackbird-op-linux-3d0518f4758eca4339e75e5b9dbb7e06a5ce08b4.zip |
ext4: New rec_len encoding for very large blocksizes
The rec_len field in the directory entry is 16 bits, so to encode
blocksizes larger than 64k becomes problematic. This patch allows us
to supprot block sizes up to 256k, by using the low 2 bits to extend
the range of rec_len to 2**18-1 (since valid rec_len sizes must be a
multiple of 4). We use the convention that a rec_len of 0 or 65535
means the filesystem block size, for compatibility with older kernels.
It's unlikely we'll see VM pages of up to 256k, but at some point we
might find that the Linux VM has been enhanced to support filesystem
block sizes > than the VM page size, at which point it might be useful
for some applications to allow very large filesystem block sizes.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 0db01421da3e..d5193b55ca94 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -855,24 +855,6 @@ struct ext4_dir_entry_2 { ~EXT4_DIR_ROUND) #define EXT4_MAX_REC_LEN ((1<<16)-1) -static inline unsigned ext4_rec_len_from_disk(__le16 dlen) -{ - unsigned len = le16_to_cpu(dlen); - - if (len == EXT4_MAX_REC_LEN || len == 0) - return 1 << 16; - return len; -} - -static inline __le16 ext4_rec_len_to_disk(unsigned len) -{ - if (len == (1 << 16)) - return cpu_to_le16(EXT4_MAX_REC_LEN); - else if (len > (1 << 16)) - BUG(); - return cpu_to_le16(len); -} - /* * Hash Tree Directory indexing * (c) Daniel Phillips, 2001 @@ -1097,7 +1079,10 @@ extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); /* migrate.c */ extern int ext4_ext_migrate(struct inode *); + /* namei.c */ +extern unsigned int ext4_rec_len_from_disk(__le16 dlen, unsigned blocksize); +extern __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize); extern int ext4_orphan_add(handle_t *, struct inode *); extern int ext4_orphan_del(handle_t *, struct inode *); extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, |