diff options
author | pfg <pfg@FreeBSD.org> | 2013-06-23 02:44:42 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2013-06-23 02:44:42 +0000 |
commit | 456a58318f772df57faf95799c77f849e8e59e16 (patch) | |
tree | 8e1f600a10432cd8eb791ceb35beb5ba9a6f7ae4 /sys/fs | |
parent | e08b36714da1c89099fd71e59285ea45d7700416 (diff) | |
download | FreeBSD-src-456a58318f772df57faf95799c77f849e8e59e16.zip FreeBSD-src-456a58318f772df57faf95799c77f849e8e59e16.tar.gz |
Define and use e2fs_lbn_t in ext2fs.
In line to what is done in UFS, define an internal type
e2fs_lbn_t for the logical block numbers.
This change is basically a no-op as the new type is unchanged
(int32_t) but it may be useful as bumping this may be required
for ext4fs.
Also, as pointed out by Bruce Evans:
-Use daddr_t for daddr in ext2_bmaparray(). This seems to
improve reliability with the reallocblks option.
- Add a cast to the fsbtodb() macro as in UFS.
Reviewed by: bde
MFC after: 3 days
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/ext2fs/ext2_alloc.c | 5 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_balloc.c | 2 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_bmap.c | 7 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_extern.h | 4 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_subr.c | 2 | ||||
-rw-r--r-- | sys/fs/ext2fs/fs.h | 4 | ||||
-rw-r--r-- | sys/fs/ext2fs/inode.h | 7 |
7 files changed, 19 insertions, 12 deletions
diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 71e3612..9bc4714 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -165,7 +165,8 @@ ext2_reallocblks(struct vop_reallocblks_args *ap) struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; - int32_t start_lbn, end_lbn, soff, newblk, blkno; + e2fs_lbn_t start_lbn, end_lbn; + int32_t soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) @@ -550,7 +551,7 @@ ext2_dirpref(struct inode *pip) * that will hold the pointer */ int32_t -ext2_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap, +ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap, int32_t blocknr) { int tmp; diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c index c71de89..d1efc68 100644 --- a/sys/fs/ext2fs/ext2_balloc.c +++ b/sys/fs/ext2fs/ext2_balloc.c @@ -57,7 +57,7 @@ * the inode and the logical block number in a file. */ int -ext2_balloc(struct inode *ip, int32_t lbn, int size, struct ucred *cred, +ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, struct buf **bpp, int flags) { struct m_ext2fs *fs; diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c index 4d71e16..86a1973 100644 --- a/sys/fs/ext2fs/ext2_bmap.c +++ b/sys/fs/ext2fs/ext2_bmap.c @@ -99,8 +99,8 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int32_t *bnp, int *runp, int *runb) struct mount *mp; struct vnode *devvp; struct indir a[NIADDR+1], *ap; - int32_t daddr; - long metalbn; + daddr_t daddr; + e2fs_lbn_t metalbn; int error, num, maxrun = 0, bsize; int *nump; @@ -241,7 +241,8 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int32_t *bnp, int *runp, int *runb) int ext2_getlbns(struct vnode *vp, int32_t bn, struct indir *ap, int *nump) { - long blockcnt, metalbn, realbn; + long blockcnt; + e2fs_lbn_t metalbn, realbn; struct ext2mount *ump; int i, numlevels, off; int64_t qblockcnt; diff --git a/sys/fs/ext2fs/ext2_extern.h b/sys/fs/ext2fs/ext2_extern.h index d3ab058..95ba9e4 100644 --- a/sys/fs/ext2fs/ext2_extern.h +++ b/sys/fs/ext2fs/ext2_extern.h @@ -49,10 +49,10 @@ struct vnode; int ext2_alloc(struct inode *, int32_t, int32_t, int, struct ucred *, int32_t *); int ext2_balloc(struct inode *, - int32_t, int, struct ucred *, struct buf **, int); + e2fs_lbn_t, int, struct ucred *, struct buf **, int); int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **); void ext2_blkfree(struct inode *, int32_t, long); -int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t); +int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c index b5fc62b..df6e430 100644 --- a/sys/fs/ext2fs/ext2_subr.c +++ b/sys/fs/ext2fs/ext2_subr.c @@ -68,7 +68,7 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) struct inode *ip; struct m_ext2fs *fs; struct buf *bp; - int32_t lbn; + e2fs_lbn_t lbn; int bsize, error; ip = VTOI(vp); diff --git a/sys/fs/ext2fs/fs.h b/sys/fs/ext2fs/fs.h index 583e9ed9..b51dbf7 100644 --- a/sys/fs/ext2fs/fs.h +++ b/sys/fs/ext2fs/fs.h @@ -98,8 +98,8 @@ * Turn file system block numbers into disk block addresses. * This maps file system blocks to device size blocks. */ -#define fsbtodb(fs, b) ((b) << ((fs)->e2fs_fsbtodb)) -#define dbtofsb(fs, b) ((b) >> ((fs)->e2fs_fsbtodb)) +#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->e2fs_fsbtodb) +#define dbtofsb(fs, b) ((b) >> (fs)->e2fs_fsbtodb) /* get group containing inode */ #define ino_to_cg(fs, x) (((x) - 1) / (fs->e2fs_ipg)) diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 82525e9..d939987 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -50,6 +50,11 @@ #define NIADDR 3 /* Indirect addresses in inode. */ /* + * The size of physical and logical block numbers and time fields in UFS. + */ +typedef int32_t e2fs_lbn_t; + +/* * The inode is used to describe each active (or recently active) file in the * EXT2FS filesystem. It is composed of two types of information. The first * part is the information that is needed only while the file is active (such @@ -148,7 +153,7 @@ struct inode { * ext2_getlbns and used by truncate and bmap code. */ struct indir { - int32_t in_lbn; /* Logical block number. */ + e2fs_lbn_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ }; |