diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-02-01 04:23:44 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:31 -0400 |
commit | 9a0045088d888c9c539c8c626a366cb52c0fbdab (patch) | |
tree | eac1d44330603c08dddf397fc46484f97a69a11e /fs/gfs2/inode.c | |
parent | cf45b752c9f23939e40d823b0600bf876e97b0e0 (diff) |
[GFS2] Shrink & rename di_depth
This patch forms a pair with the previous patch which shrunk
di_height. Like that patch di_depth is renamed i_depth and moved
into struct gfs2_inode directly. Also the field goes from 16 bits
to 8 bits since it is also limited to a max value which is rather
small (17 in this case). In addition we also now validate the field
against this maximum value when its read in.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index db5961a9aa59..65fdfee9ca9b 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -248,7 +248,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
248 | { | 248 | { |
249 | struct gfs2_dinode_host *di = &ip->i_di; | 249 | struct gfs2_dinode_host *di = &ip->i_di; |
250 | const struct gfs2_dinode *str = buf; | 250 | const struct gfs2_dinode *str = buf; |
251 | u16 height; | 251 | u16 height, depth; |
252 | 252 | ||
253 | if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr))) | 253 | if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr))) |
254 | goto corrupt; | 254 | goto corrupt; |
@@ -293,7 +293,10 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
293 | goto corrupt; | 293 | goto corrupt; |
294 | ip->i_height = (u8)height; | 294 | ip->i_height = (u8)height; |
295 | 295 | ||
296 | di->di_depth = be16_to_cpu(str->di_depth); | 296 | depth = be16_to_cpu(str->di_depth); |
297 | if (unlikely(depth > GFS2_DIR_MAX_DEPTH)) | ||
298 | goto corrupt; | ||
299 | ip->i_depth = (u8)depth; | ||
297 | di->di_entries = be32_to_cpu(str->di_entries); | 300 | di->di_entries = be32_to_cpu(str->di_entries); |
298 | 301 | ||
299 | di->di_eattr = be64_to_cpu(str->di_eattr); | 302 | di->di_eattr = be64_to_cpu(str->di_eattr); |
@@ -1410,7 +1413,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
1410 | str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) && | 1413 | str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) && |
1411 | !(ip->i_di.di_flags & GFS2_DIF_EXHASH) ? | 1414 | !(ip->i_di.di_flags & GFS2_DIF_EXHASH) ? |
1412 | GFS2_FORMAT_DE : 0); | 1415 | GFS2_FORMAT_DE : 0); |
1413 | str->di_depth = cpu_to_be16(di->di_depth); | 1416 | str->di_depth = cpu_to_be16(ip->i_depth); |
1414 | str->di_entries = cpu_to_be32(di->di_entries); | 1417 | str->di_entries = cpu_to_be32(di->di_entries); |
1415 | 1418 | ||
1416 | str->di_eattr = cpu_to_be64(di->di_eattr); | 1419 | str->di_eattr = cpu_to_be64(di->di_eattr); |
@@ -1436,7 +1439,7 @@ void gfs2_dinode_print(const struct gfs2_inode *ip) | |||
1436 | (unsigned long long)di->di_goal_data); | 1439 | (unsigned long long)di->di_goal_data); |
1437 | printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); | 1440 | printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); |
1438 | printk(KERN_INFO " i_height = %u\n", ip->i_height); | 1441 | printk(KERN_INFO " i_height = %u\n", ip->i_height); |
1439 | printk(KERN_INFO " di_depth = %u\n", di->di_depth); | 1442 | printk(KERN_INFO " i_depth = %u\n", ip->i_depth); |
1440 | printk(KERN_INFO " di_entries = %u\n", di->di_entries); | 1443 | printk(KERN_INFO " di_entries = %u\n", di->di_entries); |
1441 | printk(KERN_INFO " di_eattr = %llu\n", | 1444 | printk(KERN_INFO " di_eattr = %llu\n", |
1442 | (unsigned long long)di->di_eattr); | 1445 | (unsigned long long)di->di_eattr); |