aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs/ext2_balloc.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2013-08-13 15:40:43 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2013-08-13 15:40:43 +0000
commit70097aac13055268eaa414259374016b7cbcfd69 (patch)
treeb9f3dee80edb10d7fdf255006fdc5f23c5e588ba /sys/fs/ext2fs/ext2_balloc.c
parent90c35c1939db21edd0301d25ca81f28d9d9ecd9d (diff)
downloadsrc-70097aac13055268eaa414259374016b7cbcfd69.tar.gz
src-70097aac13055268eaa414259374016b7cbcfd69.zip
Define ext2fs local types and use them.
Add definitions for e2fs_daddr_t, e4fs_daddr_t in addition to the already existing e2fs_lbn_t and adjust them for ext4. Other than making the code more readable these changes should fix problems related to big filesystems. Setting the proper types can be tricky so the process was helped by looking at UFS. In our implementation, logical block numbers can be negative and the code depends on it. In ext2, block numbers are unsigned so it is convenient to keep e2fs_daddr_t unsigned and use the complete 32 bits. In the case of e4fs_daddr_t, while the value should be unsigned, for ext4 we only need to support 48 bits so preserving an extra bit from the sign is not an issue. While here also drop the ext2_setblock() prototype that was never used. Discussed with: mckusick, bde MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=254283
Diffstat (limited to 'sys/fs/ext2fs/ext2_balloc.c')
-rw-r--r--sys/fs/ext2fs/ext2_balloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c
index d1efc685e3ff..9e48f5663e79 100644
--- a/sys/fs/ext2fs/ext2_balloc.c
+++ b/sys/fs/ext2fs/ext2_balloc.c
@@ -65,8 +65,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
struct buf *bp, *nbp;
struct vnode *vp = ITOV(ip);
struct indir indirs[NIADDR + 2];
- uint32_t nb, newb;
- int32_t *bap, pref;
+ e4fs_daddr_t nb, newb;
+ e2fs_daddr_t *bap, pref;
int osize, nsize, num, i, error;
*bpp = NULL;
@@ -195,7 +195,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
brelse(bp);
return (error);
}
- bap = (int32_t *)bp->b_data;
+ bap = (e2fs_daddr_t *)bp->b_data;
nb = bap[indirs[i].in_off];
if (i == num)
break;