diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-01-28 23:58:27 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-01-28 23:58:27 -0500 |
commit | 725d26d3f09ccb5bac4b4293096b985a312a0d67 (patch) | |
tree | 1c49a07da252832fc6842c88a2359e8cd43af636 /include | |
parent | a72d7f834e1afa08421938d7eb06bd8e56b0e58c (diff) |
ext4: Introduce ext4_lblk_t
This patch adds a new data type ext4_lblk_t to represent
the logical file blocks.
This is the preparatory patch to support large files in ext4
The follow up patch with convert the ext4_inode i_blocks to
represent the number of blocks in file system block size. This
changes makes it possible to have a block number 2**32 -1 which
will result in overflow if the block number is represented by
signed long. This patch convert all the block number to type
ext4_lblk_t which is typedef to __u32
Also remove dead code ext4_ext_walk_space
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ext4_fs.h | 29 | ||||
-rw-r--r-- | include/linux/ext4_fs_extents.h | 19 | ||||
-rw-r--r-- | include/linux/ext4_fs_i.h | 9 |
3 files changed, 27 insertions, 30 deletions
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index fb31c1aba989..5e2da0974d16 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -935,11 +935,14 @@ extern unsigned long ext4_count_free (struct buffer_head *, unsigned); | |||
935 | /* inode.c */ | 935 | /* inode.c */ |
936 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, | 936 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, |
937 | struct buffer_head *bh, ext4_fsblk_t blocknr); | 937 | struct buffer_head *bh, ext4_fsblk_t blocknr); |
938 | struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *); | 938 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, |
939 | struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *); | 939 | ext4_lblk_t, int, int *); |
940 | struct buffer_head *ext4_bread(handle_t *, struct inode *, | ||
941 | ext4_lblk_t, int, int *); | ||
940 | int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, | 942 | int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, |
941 | sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, | 943 | ext4_lblk_t iblock, unsigned long maxblocks, |
942 | int create, int extend_disksize); | 944 | struct buffer_head *bh_result, |
945 | int create, int extend_disksize); | ||
943 | 946 | ||
944 | extern void ext4_read_inode (struct inode *); | 947 | extern void ext4_read_inode (struct inode *); |
945 | extern int ext4_write_inode (struct inode *, int); | 948 | extern int ext4_write_inode (struct inode *, int); |
@@ -1068,7 +1071,7 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations; | |||
1068 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); | 1071 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); |
1069 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); | 1072 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); |
1070 | extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | 1073 | extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, |
1071 | ext4_fsblk_t iblock, | 1074 | ext4_lblk_t iblock, |
1072 | unsigned long max_blocks, struct buffer_head *bh_result, | 1075 | unsigned long max_blocks, struct buffer_head *bh_result, |
1073 | int create, int extend_disksize); | 1076 | int create, int extend_disksize); |
1074 | extern void ext4_ext_truncate(struct inode *, struct page *); | 1077 | extern void ext4_ext_truncate(struct inode *, struct page *); |
@@ -1081,11 +1084,17 @@ ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | |||
1081 | unsigned long max_blocks, struct buffer_head *bh, | 1084 | unsigned long max_blocks, struct buffer_head *bh, |
1082 | int create, int extend_disksize) | 1085 | int create, int extend_disksize) |
1083 | { | 1086 | { |
1084 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) | 1087 | int retval; |
1085 | return ext4_ext_get_blocks(handle, inode, block, max_blocks, | 1088 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { |
1086 | bh, create, extend_disksize); | 1089 | retval = ext4_ext_get_blocks(handle, inode, |
1087 | return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh, | 1090 | (ext4_lblk_t)block, max_blocks, |
1088 | create, extend_disksize); | 1091 | bh, create, extend_disksize); |
1092 | } else { | ||
1093 | retval = ext4_get_blocks_handle(handle, inode, | ||
1094 | (ext4_lblk_t)block, max_blocks, | ||
1095 | bh, create, extend_disksize); | ||
1096 | } | ||
1097 | return retval; | ||
1089 | } | 1098 | } |
1090 | 1099 | ||
1091 | 1100 | ||
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h index d2045a26195d..023683b9d883 100644 --- a/include/linux/ext4_fs_extents.h +++ b/include/linux/ext4_fs_extents.h | |||
@@ -124,20 +124,6 @@ struct ext4_ext_path { | |||
124 | #define EXT4_EXT_CACHE_GAP 1 | 124 | #define EXT4_EXT_CACHE_GAP 1 |
125 | #define EXT4_EXT_CACHE_EXTENT 2 | 125 | #define EXT4_EXT_CACHE_EXTENT 2 |
126 | 126 | ||
127 | /* | ||
128 | * to be called by ext4_ext_walk_space() | ||
129 | * negative retcode - error | ||
130 | * positive retcode - signal for ext4_ext_walk_space(), see below | ||
131 | * callback must return valid extent (passed or newly created) | ||
132 | */ | ||
133 | typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *, | ||
134 | struct ext4_ext_cache *, | ||
135 | void *); | ||
136 | |||
137 | #define EXT_CONTINUE 0 | ||
138 | #define EXT_BREAK 1 | ||
139 | #define EXT_REPEAT 2 | ||
140 | |||
141 | 127 | ||
142 | #define EXT_MAX_BLOCK 0xffffffff | 128 | #define EXT_MAX_BLOCK 0xffffffff |
143 | 129 | ||
@@ -233,8 +219,7 @@ extern int ext4_ext_try_to_merge(struct inode *inode, | |||
233 | struct ext4_extent *); | 219 | struct ext4_extent *); |
234 | extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); | 220 | extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); |
235 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); | 221 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); |
236 | extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); | 222 | extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, |
237 | extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); | 223 | struct ext4_ext_path *); |
238 | |||
239 | #endif /* _LINUX_EXT4_EXTENTS */ | 224 | #endif /* _LINUX_EXT4_EXTENTS */ |
240 | 225 | ||
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h index 86ddfe2089f3..6c610b67b047 100644 --- a/include/linux/ext4_fs_i.h +++ b/include/linux/ext4_fs_i.h | |||
@@ -27,6 +27,9 @@ typedef int ext4_grpblk_t; | |||
27 | /* data type for filesystem-wide blocks number */ | 27 | /* data type for filesystem-wide blocks number */ |
28 | typedef unsigned long long ext4_fsblk_t; | 28 | typedef unsigned long long ext4_fsblk_t; |
29 | 29 | ||
30 | /* data type for file logical block number */ | ||
31 | typedef __u32 ext4_lblk_t; | ||
32 | |||
30 | struct ext4_reserve_window { | 33 | struct ext4_reserve_window { |
31 | ext4_fsblk_t _rsv_start; /* First byte reserved */ | 34 | ext4_fsblk_t _rsv_start; /* First byte reserved */ |
32 | ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | 35 | ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ |
@@ -48,7 +51,7 @@ struct ext4_block_alloc_info { | |||
48 | * most-recently-allocated block in this file. | 51 | * most-recently-allocated block in this file. |
49 | * We use this for detecting linearly ascending allocation requests. | 52 | * We use this for detecting linearly ascending allocation requests. |
50 | */ | 53 | */ |
51 | __u32 last_alloc_logical_block; | 54 | ext4_lblk_t last_alloc_logical_block; |
52 | /* | 55 | /* |
53 | * Was i_next_alloc_goal in ext4_inode_info | 56 | * Was i_next_alloc_goal in ext4_inode_info |
54 | * is the *physical* companion to i_next_alloc_block. | 57 | * is the *physical* companion to i_next_alloc_block. |
@@ -67,7 +70,7 @@ struct ext4_block_alloc_info { | |||
67 | */ | 70 | */ |
68 | struct ext4_ext_cache { | 71 | struct ext4_ext_cache { |
69 | ext4_fsblk_t ec_start; | 72 | ext4_fsblk_t ec_start; |
70 | __u32 ec_block; | 73 | ext4_lblk_t ec_block; |
71 | __u32 ec_len; /* must be 32bit to return holes */ | 74 | __u32 ec_len; /* must be 32bit to return holes */ |
72 | __u32 ec_type; | 75 | __u32 ec_type; |
73 | }; | 76 | }; |
@@ -95,7 +98,7 @@ struct ext4_inode_info { | |||
95 | /* block reservation info */ | 98 | /* block reservation info */ |
96 | struct ext4_block_alloc_info *i_block_alloc_info; | 99 | struct ext4_block_alloc_info *i_block_alloc_info; |
97 | 100 | ||
98 | __u32 i_dir_start_lookup; | 101 | ext4_lblk_t i_dir_start_lookup; |
99 | #ifdef CONFIG_EXT4DEV_FS_XATTR | 102 | #ifdef CONFIG_EXT4DEV_FS_XATTR |
100 | /* | 103 | /* |
101 | * Extended attributes can be read independently of the main file | 104 | * Extended attributes can be read independently of the main file |