svn commit: r311231 - stable/11/sys/fs/ext2fs
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Jan 4 02:42:20 UTC 2017
Author: pfg
Date: Wed Jan 4 02:42:17 2017
New Revision: 311231
URL: https://svnweb.freebsd.org/changeset/base/311231
Log:
MFC r310705, r310706:
style(9) cleanups.
Just to reduce some of the issues found with indent(1).
Modified:
stable/11/sys/fs/ext2fs/ext2_alloc.c
stable/11/sys/fs/ext2fs/ext2_balloc.c
stable/11/sys/fs/ext2fs/ext2_bmap.c
stable/11/sys/fs/ext2fs/ext2_dir.h
stable/11/sys/fs/ext2fs/ext2_extents.c
stable/11/sys/fs/ext2fs/ext2_extents.h
stable/11/sys/fs/ext2fs/ext2_extern.h
stable/11/sys/fs/ext2fs/ext2_hash.c
stable/11/sys/fs/ext2fs/ext2_htree.c
stable/11/sys/fs/ext2fs/ext2_inode.c
stable/11/sys/fs/ext2fs/ext2_inode_cnv.c
stable/11/sys/fs/ext2fs/ext2_lookup.c
stable/11/sys/fs/ext2fs/ext2_mount.h
stable/11/sys/fs/ext2fs/ext2_subr.c
stable/11/sys/fs/ext2fs/ext2_vfsops.c
stable/11/sys/fs/ext2fs/ext2_vnops.c
stable/11/sys/fs/ext2fs/ext2fs.h
stable/11/sys/fs/ext2fs/fs.h
stable/11/sys/fs/ext2fs/htree.h
stable/11/sys/fs/ext2fs/inode.h
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_alloc.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_alloc.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -86,7 +86,8 @@ ext2_alloc(struct inode *ip, daddr_t lbn
struct m_ext2fs *fs;
struct ext2mount *ump;
int32_t bno;
- int cg;
+ int cg;
+
*bnp = 0;
fs = ip->i_e2fs;
ump = ip->i_ump;
@@ -99,11 +100,11 @@ ext2_alloc(struct inode *ip, daddr_t lbn
}
if (cred == NOCRED)
panic("ext2_alloc: missing credential");
-#endif /* INVARIANTS */
+#endif /* INVARIANTS */
if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0)
goto nospace;
- if (cred->cr_uid != 0 &&
- fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount)
+ if (cred->cr_uid != 0 &&
+ fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount)
goto nospace;
if (bpref >= fs->e2fs->e2fs_bcount)
bpref = 0;
@@ -112,7 +113,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn
else
cg = dtog(fs, bpref);
bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize,
- ext2_alloccg);
+ ext2_alloccg);
if (bno > 0) {
/* set next_alloc fields as done in block_getblk */
ip->i_next_alloc_block = lbn;
@@ -148,10 +149,12 @@ nospace:
static SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem");
static int doasyncfree = 1;
+
SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0,
"Use asychronous writes to update block pointers when freeing blocks");
static int doreallocblks = 1;
+
SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, "");
int
@@ -171,7 +174,7 @@ ext2_reallocblks(struct vop_reallocblks_
int i, len, start_lvl, end_lvl, pref, ssize;
if (doreallocblks == 0)
- return (ENOSPC);
+ return (ENOSPC);
vp = ap->a_vp;
ip = VTOI(vp);
@@ -236,7 +239,7 @@ ext2_reallocblks(struct vop_reallocblks_
ssize = len;
} else {
#ifdef INVARIANTS
- if (start_ap[start_lvl-1].in_lbn == idp->in_lbn)
+ if (start_ap[start_lvl - 1].in_lbn == idp->in_lbn)
panic("ext2_reallocblks: start == end");
#endif
ssize = len - (idp->in_off + 1);
@@ -253,10 +256,10 @@ ext2_reallocblks(struct vop_reallocblks_
* Search the block map looking for an allocation of the desired size.
*/
if ((newblk = (e2fs_daddr_t)ext2_hashalloc(ip, dtog(fs, pref), pref,
- len, ext2_clusteralloc)) == 0){
+ len, ext2_clusteralloc)) == 0) {
EXT2_UNLOCK(ump);
goto fail;
- }
+ }
/*
* We have found a new contiguous block.
*
@@ -267,7 +270,7 @@ ext2_reallocblks(struct vop_reallocblks_
#ifdef DEBUG
printf("realloc: ino %ju, lbns %jd-%jd\n\told:",
(uintmax_t)ip->i_number, (intmax_t)start_lbn, (intmax_t)end_lbn);
-#endif /* DEBUG */
+#endif /* DEBUG */
blkno = newblk;
for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) {
if (i == ssize) {
@@ -279,15 +282,15 @@ ext2_reallocblks(struct vop_reallocblks_
panic("ext2_reallocblks: alloc mismatch");
#endif
#ifdef DEBUG
- printf(" %d,", *bap);
-#endif /* DEBUG */
+ printf(" %d,", *bap);
+#endif /* DEBUG */
*bap++ = blkno;
}
/*
* Next we must write out the modified inode and indirect blocks.
* For strict correctness, the writes should be synchronous since
* the old block values may have been written to disk. In practise
- * they are almost never written, but if we are concerned about
+ * they are almost never written, but if we are concerned about
* strict correctness, the `doasyncfree' flag should be set to zero.
*
* The test on `doasyncfree' should be changed to test a flag
@@ -318,18 +321,18 @@ ext2_reallocblks(struct vop_reallocblks_
*/
#ifdef DEBUG
printf("\n\tnew:");
-#endif /* DEBUG */
+#endif /* DEBUG */
for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) {
ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno),
fs->e2fs_bsize);
buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
#ifdef DEBUG
printf(" %d,", blkno);
-#endif /* DEBUG */
+#endif /* DEBUG */
}
#ifdef DEBUG
printf("\n");
-#endif /* DEBUG */
+#endif /* DEBUG */
return (0);
fail:
@@ -342,7 +345,7 @@ fail:
/*
* Allocate an inode in the filesystem.
- *
+ *
*/
int
ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp)
@@ -354,7 +357,7 @@ ext2_valloc(struct vnode *pvp, int mode,
struct ext2mount *ump;
ino_t ino, ipref;
int i, error, cg;
-
+
*vpp = NULL;
pip = VTOI(pvp);
fs = pip->i_e2fs;
@@ -380,7 +383,7 @@ ext2_valloc(struct vnode *pvp, int mode,
ipref = cg * fs->e2fs->e2fs_ipg + 1;
ino = (ino_t)ext2_hashalloc(pip, cg, (long)ipref, mode, ext2_nodealloccg);
- if (ino == 0)
+ if (ino == 0)
goto noinodes;
error = VFS_VGET(pvp->v_mount, ino, LK_EXCLUSIVE, vpp);
if (error) {
@@ -411,7 +414,7 @@ ext2_valloc(struct vnode *pvp, int mode,
*/
do {
ip->i_gen = arc4random();
- } while ( ip->i_gen == 0);
+ } while (ip->i_gen == 0);
vfs_timestamp(&ts);
ip->i_birthtime = ts.tv_sec;
@@ -457,7 +460,7 @@ ext2_dirpref(struct inode *pip)
avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount;
avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount;
- avgndir = fs->e2fs_total_dir / fs->e2fs_gcount;
+ avgndir = fs->e2fs_total_dir / fs->e2fs_gcount;
/*
* Force allocation in another cg if creating a first level dir.
@@ -481,10 +484,8 @@ ext2_dirpref(struct inode *pip)
mincg = cg;
minndir = fs->e2fs_gd[cg].ext2bgd_ndirs;
}
-
return (mincg);
}
-
/*
* Count various limits which used for
* optimal allocation of a directory inode.
@@ -507,7 +508,7 @@ ext2_dirpref(struct inode *pip)
maxcontigdirs = 1;
/*
- * Limit number of dirs in one cg and reserve space for
+ * Limit number of dirs in one cg and reserve space for
* regular files, but only if we have no deficit in
* inodes or space.
*/
@@ -539,7 +540,7 @@ ext2_dirpref(struct inode *pip)
}
/*
- * Select the desired position for the next block in a file.
+ * Select the desired position for the next block in a file.
*
* we try to mimic what Remy does in inode_getblk/block_getblk
*
@@ -555,30 +556,34 @@ e4fs_daddr_t
ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap,
e2fs_daddr_t blocknr)
{
- int tmp;
+ int tmp;
+
mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED);
- /* if the next block is actually what we thought it is,
- then set the goal to what we thought it should be
- */
+ /*
+ * If the next block is actually what we thought it is, then set the
+ * goal to what we thought it should be.
+ */
if (ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0)
return ip->i_next_alloc_goal;
- /* now check whether we were provided with an array that basically
- tells us previous blocks to which we want to stay closeby
- */
+ /*
+ * Now check whether we were provided with an array that basically
+ * tells us previous blocks to which we want to stay close.
+ */
if (bap)
- for (tmp = indx - 1; tmp >= 0; tmp--)
- if (bap[tmp])
+ for (tmp = indx - 1; tmp >= 0; tmp--)
+ if (bap[tmp])
return bap[tmp];
- /* else let's fall back to the blocknr, or, if there is none,
- follow the rule that a block should be allocated near its inode
- */
+ /*
+ * Else lets fall back to the blocknr or, if there is none, follow
+ * the rule that a block should be allocated near its inode.
+ */
return blocknr ? blocknr :
- (e2fs_daddr_t)(ip->i_block_group *
- EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
- ip->i_e2fs->e2fs->e2fs_first_dblock;
+ (e2fs_daddr_t)(ip->i_block_group *
+ EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
+ ip->i_e2fs->e2fs->e2fs_first_dblock;
}
/*
@@ -591,7 +596,7 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_
*/
static u_long
ext2_hashalloc(struct inode *ip, int cg, long pref, int size,
- daddr_t (*allocator)(struct inode *, int, daddr_t, int))
+ daddr_t (*allocator) (struct inode *, int, daddr_t, int))
{
struct m_ext2fs *fs;
ino_t result;
@@ -655,8 +660,8 @@ ext2_alloccg(struct inode *ip, int cg, d
return (0);
EXT2_UNLOCK(ump);
error = bread(ip->i_devvp, fsbtodb(fs,
- fs->e2fs_gd[cg].ext2bgd_b_bitmap),
- (int)fs->e2fs_bsize, NOCRED, &bp);
+ fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ (int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
EXT2_LOCK(ump);
@@ -742,9 +747,8 @@ retry:
start = 0;
goto retry;
}
-
bno = ext2_mapsearch(fs, bbp, bpref);
- if (bno < 0){
+ if (bno < 0) {
brelse(bp);
EXT2_LOCK(ump);
return (0);
@@ -753,7 +757,7 @@ gotit:
#ifdef INVARIANTS
if (isset(bbp, bno)) {
printf("ext2fs_alloccgblk: cg=%d bno=%jd fs=%s\n",
- cg, (intmax_t)bno, fs->e2fs_fsmnt);
+ cg, (intmax_t)bno, fs->e2fs_fsmnt);
panic("ext2fs_alloccg: dup alloc");
}
#endif
@@ -813,9 +817,9 @@ ext2_clusteralloc(struct inode *ip, int
* to find no cluster.
*/
lp = &fs->e2fs_clustersum[cg].cs_sum[len - 1];
- for (i = len - 1; i > 0; i--)
- if (*lp-- > 0)
- break;
+ for (i = len - 1; i > 0; i--)
+ if (*lp-- > 0)
+ break;
fs->e2fs_maxcluster[cg] = i;
goto fail;
}
@@ -890,17 +894,18 @@ ext2_nodealloccg(struct inode *ip, int c
struct ext2mount *ump;
int error, start, len;
char *ibp, *loc;
- ipref--; /* to avoid a lot of (ipref -1) */
+
+ ipref--; /* to avoid a lot of (ipref -1) */
if (ipref == -1)
ipref = 0;
fs = ip->i_e2fs;
ump = ip->i_ump;
if (fs->e2fs_gd[cg].ext2bgd_nifree == 0)
return (0);
- EXT2_UNLOCK(ump);
+ EXT2_UNLOCK(ump);
error = bread(ip->i_devvp, fsbtodb(fs,
- fs->e2fs_gd[cg].ext2bgd_i_bitmap),
- (int)fs->e2fs_bsize, NOCRED, &bp);
+ fs->e2fs_gd[cg].ext2bgd_i_bitmap),
+ (int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
EXT2_LOCK(ump);
@@ -930,7 +935,7 @@ ext2_nodealloccg(struct inode *ip, int c
loc = memcchr(&ibp[start], 0xff, len);
if (loc == NULL) {
printf("cg = %d, ipref = %lld, fs = %s\n",
- cg, (long long)ipref, fs->e2fs_fsmnt);
+ cg, (long long)ipref, fs->e2fs_fsmnt);
panic("ext2fs_nodealloccg: map corrupted");
/* NOTREACHED */
}
@@ -948,7 +953,7 @@ gotit:
}
EXT2_UNLOCK(ump);
bdwrite(bp);
- return (cg * fs->e2fs->e2fs_ipg + ipref +1);
+ return (cg * fs->e2fs->e2fs_ipg + ipref + 1);
}
/*
@@ -974,8 +979,8 @@ ext2_blkfree(struct inode *ip, e4fs_dadd
return;
}
error = bread(ip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
- (int)fs->e2fs_bsize, NOCRED, &bp);
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ (int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
return;
@@ -984,7 +989,7 @@ ext2_blkfree(struct inode *ip, e4fs_dadd
bno = dtogd(fs, bno);
if (isclr(bbp, bno)) {
printf("block = %lld, fs = %s\n",
- (long long)bno, fs->e2fs_fsmnt);
+ (long long)bno, fs->e2fs_fsmnt);
panic("ext2_blkfree: freeing free block");
}
clrbit(bbp, bno);
@@ -1009,7 +1014,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino,
struct buf *bp;
struct ext2mount *ump;
int error, cg;
- char * ibp;
+ char *ibp;
pip = VTOI(pvp);
fs = pip->i_e2fs;
@@ -1020,8 +1025,8 @@ ext2_vfree(struct vnode *pvp, ino_t ino,
cg = ino_to_cg(fs, ino);
error = bread(pip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
- (int)fs->e2fs_bsize, NOCRED, &bp);
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
+ (int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
return (0);
@@ -1030,7 +1035,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino,
ino = (ino - 1) % fs->e2fs->e2fs_ipg;
if (isclr(ibp, ino)) {
printf("ino = %llu, fs = %s\n",
- (unsigned long long)ino, fs->e2fs_fsmnt);
+ (unsigned long long)ino, fs->e2fs_fsmnt);
if (fs->e2fs_ronly == 0)
panic("ext2_vfree: freeing free inode");
}
@@ -1076,7 +1081,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char
loc = memcchr(&bbp[start], 0xff, len);
if (loc == NULL) {
printf("start = %d, len = %d, fs = %s\n",
- start, len, fs->e2fs_fsmnt);
+ start, len, fs->e2fs_fsmnt);
panic("ext2_mapsearch: map corrupted");
/* NOTREACHED */
}
@@ -1086,7 +1091,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char
/*
* Fserr prints the name of a filesystem with an error diagnostic.
- *
+ *
* The form of the error message is:
* fs: error message
*/
Modified: stable/11/sys/fs/ext2fs/ext2_balloc.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_balloc.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_balloc.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -76,22 +76,23 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
ump = ip->i_ump;
/*
- * check if this is a sequential block allocation.
- * If so, increment next_alloc fields to allow ext2_blkpref
+ * check if this is a sequential block allocation.
+ * If so, increment next_alloc fields to allow ext2_blkpref
* to make a good guess
*/
if (lbn == ip->i_next_alloc_block + 1) {
ip->i_next_alloc_block++;
ip->i_next_alloc_goal++;
}
-
/*
* The first NDADDR blocks are direct blocks
*/
if (lbn < NDADDR) {
nb = ip->i_db[lbn];
- /* no new block is to be allocated, and no need to expand
- the file */
+ /*
+ * no new block is to be allocated, and no need to expand
+ * the file
+ */
if (nb != 0 && ip->i_size >= (lbn + 1) * fs->e2fs_bsize) {
error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp);
if (error) {
@@ -116,10 +117,13 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
}
bp->b_blkno = fsbtodb(fs, nb);
} else {
- /* Godmar thinks: this shouldn't happen w/o fragments */
- printf("nsize %d(%d) > osize %d(%d) nb %d\n",
- (int)nsize, (int)size, (int)osize,
- (int)ip->i_size, (int)nb);
+ /*
+ * Godmar thinks: this shouldn't happen w/o
+ * fragments
+ */
+ printf("nsize %d(%d) > osize %d(%d) nb %d\n",
+ (int)nsize, (int)size, (int)osize,
+ (int)ip->i_size, (int)nb);
panic(
"ext2_balloc: Something is terribly wrong");
/*
@@ -156,7 +160,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
return (error);
#ifdef INVARIANTS
if (num < 1)
- panic ("ext2_balloc: ext2_getlbns returned indirect block");
+ panic("ext2_balloc: ext2_getlbns returned indirect block");
#endif
/*
* Fetch the first indirect block allocating if necessary.
@@ -165,10 +169,10 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
nb = ip->i_ib[indirs[0].in_off];
if (nb == 0) {
EXT2_LOCK(ump);
- pref = ext2_blkpref(ip, lbn, indirs[0].in_off +
- EXT2_NDIR_BLOCKS, &ip->i_db[0], 0);
+ pref = ext2_blkpref(ip, lbn, indirs[0].in_off +
+ EXT2_NDIR_BLOCKS, &ip->i_db[0], 0);
if ((error = ext2_alloc(ip, lbn, pref, fs->e2fs_bsize, cred,
- &newb)))
+ &newb)))
return (error);
nb = newb;
bp = getblk(vp, indirs[1].in_lbn, fs->e2fs_bsize, 0, 0, 0);
@@ -207,8 +211,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
EXT2_LOCK(ump);
if (pref == 0)
pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
- bp->b_lblkno);
- error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb);
+ bp->b_lblkno);
+ error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb);
if (error) {
brelse(bp);
return (error);
@@ -245,8 +249,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
*/
if (nb == 0) {
EXT2_LOCK(ump);
- pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0],
- bp->b_lblkno);
+ pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0],
+ bp->b_lblkno);
if ((error = ext2_alloc(ip,
lbn, pref, (int)fs->e2fs_bsize, cred, &newb)) != 0) {
brelse(bp);
@@ -265,7 +269,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
if (flags & IO_SYNC) {
bwrite(bp);
} else {
- if (bp->b_bufsize == fs->e2fs_bsize)
+ if (bp->b_bufsize == fs->e2fs_bsize)
bp->b_flags |= B_CLUSTEROK;
bdwrite(bp);
}
@@ -275,6 +279,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
brelse(bp);
if (flags & BA_CLRBUF) {
int seqcount = (flags & BA_SEQMASK) >> BA_SEQSHIFT;
+
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, ip->i_size, lbn,
(int)fs->e2fs_bsize, NOCRED,
@@ -293,4 +298,3 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t
*bpp = nbp;
return (0);
}
-
Modified: stable/11/sys/fs/ext2fs/ext2_bmap.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_bmap.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_bmap.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -95,7 +95,7 @@ ext4_bmapext(struct vnode *vp, int32_t b
struct inode *ip;
struct m_ext2fs *fs;
struct ext4_extent *ep;
- struct ext4_extent_path path = { .ep_bp = NULL };
+ struct ext4_extent_path path = {.ep_bp = NULL};
daddr_t lbn;
int error;
@@ -163,7 +163,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t
struct buf *bp;
struct ext2mount *ump;
struct mount *mp;
- struct indir a[NIADDR+1], *ap;
+ struct indir a[NIADDR + 1], *ap;
daddr_t daddr;
e2fs_lbn_t metalbn;
int error, num, maxrun = 0, bsize;
@@ -180,10 +180,8 @@ ext2_bmaparray(struct vnode *vp, daddr_t
maxrun = mp->mnt_iosize_max / bsize - 1;
*runp = 0;
}
-
- if (runb) {
+ if (runb)
*runb = 0;
- }
ap = a;
@@ -199,6 +197,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t
*bnp = -1;
} else if (runp) {
daddr_t bnb = bn;
+
for (++bn; bn < NDADDR && *runp < maxrun &&
is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]);
++bn, ++*runp);
@@ -213,7 +212,6 @@ ext2_bmaparray(struct vnode *vp, daddr_t
return (0);
}
-
/* Get disk address out of indirect block array */
daddr = ip->i_ib[ap->in_off];
@@ -290,7 +288,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t
* return a request for a zeroed out buffer if attempts are made
* to read a BLK_NOCOPY or BLK_SNAP block.
*/
- if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc){
+ if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc) {
*bnp = -1;
return (0);
}
Modified: stable/11/sys/fs/ext2fs/ext2_dir.h
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_dir.h Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_dir.h Wed Jan 4 02:42:17 2017 (r311231)
@@ -34,7 +34,7 @@
*/
#define EXT2FS_MAXNAMLEN 255
-struct ext2fs_direct {
+struct ext2fs_direct {
uint32_t e2d_ino; /* inode number of entry */
uint16_t e2d_reclen; /* length of this record */
uint16_t e2d_namlen; /* length of string in e2d_name */
@@ -49,10 +49,10 @@ enum slotstatus {
struct ext2fs_searchslot {
enum slotstatus slotstatus;
- doff_t slotoffset; /* offset of area with free space */
- int slotsize; /* size of area at slotoffset */
- int slotfreespace; /* amount of space free in slot */
- int slotneeded; /* sizeof the entry we are seeking */
+ doff_t slotoffset; /* offset of area with free space */
+ int slotsize; /* size of area at slotoffset */
+ int slotfreespace; /* amount of space free in slot */
+ int slotneeded; /* sizeof the entry we are seeking */
};
/*
@@ -61,12 +61,13 @@ struct ext2fs_searchslot {
* bigger than 255 chars, it's safe to reclaim the extra byte for the
* file_type field.
*/
-struct ext2fs_direct_2 {
+struct ext2fs_direct_2 {
uint32_t e2d_ino; /* inode number of entry */
uint16_t e2d_reclen; /* length of this record */
- uint8_t e2d_namlen; /* length of string in e2d_name */
- uint8_t e2d_type; /* file type */
- char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */
+ uint8_t e2d_namlen; /* length of string in e2d_name */
+ uint8_t e2d_type; /* file type */
+ char e2d_name[EXT2FS_MAXNAMLEN]; /* name with
+ * length<=EXT2FS_MAXNAMLEN */
};
/*
@@ -97,5 +98,4 @@ struct ext2fs_direct_2 {
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
-#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */
-
+#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */
Modified: stable/11/sys/fs/ext2fs/ext2_extents.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_extents.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_extents.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -45,8 +45,7 @@
static bool
ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path,
- daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn)
-{
+ daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn){
struct ext4_extent_header *ehp = path->ep_header;
struct ext4_extent_index *first, *last, *l, *r, *m;
@@ -79,7 +78,7 @@ ext4_ext_binsearch_index(struct inode *i
static void
ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t lbn,
- daddr_t first_lbn, daddr_t last_lbn)
+ daddr_t first_lbn, daddr_t last_lbn)
{
struct ext4_extent_header *ehp = path->ep_header;
struct ext4_extent *first, *l, *r, *m;
@@ -167,7 +166,7 @@ ext4_ext_put_cache(struct inode *ip, str
*/
struct ext4_extent_path *
ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *ip,
- daddr_t lbn, struct ext4_extent_path *path)
+ daddr_t lbn, struct ext4_extent_path *path)
{
struct ext4_extent_header *ehp;
uint16_t i;
@@ -200,7 +199,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs
path->ep_bp = NULL;
}
error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED,
- &path->ep_bp);
+ &path->ep_bp);
if (error) {
brelse(path->ep_bp);
path->ep_bp = NULL;
Modified: stable/11/sys/fs/ext2fs/ext2_extents.h
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_extents.h Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_extents.h Wed Jan 4 02:42:17 2017 (r311231)
@@ -40,10 +40,10 @@
* Ext4 file system extent on disk.
*/
struct ext4_extent {
- uint32_t e_blk; /* first logical block */
- uint16_t e_len; /* number of blocks */
- uint16_t e_start_hi; /* high 16 bits of physical block */
- uint32_t e_start_lo; /* low 32 bits of physical block */
+ uint32_t e_blk; /* first logical block */
+ uint16_t e_len; /* number of blocks */
+ uint16_t e_start_hi; /* high 16 bits of physical block */
+ uint32_t e_start_lo; /* low 32 bits of physical block */
};
/*
@@ -61,19 +61,19 @@ struct ext4_extent_index {
* Extent tree header.
*/
struct ext4_extent_header {
- uint16_t eh_magic; /* magic number: 0xf30a */
- uint16_t eh_ecount; /* number of valid entries */
- uint16_t eh_max; /* capacity of store in entries */
- uint16_t eh_depth; /* the depth of extent tree */
- uint32_t eh_gen; /* generation of extent tree */
+ uint16_t eh_magic; /* magic number: 0xf30a */
+ uint16_t eh_ecount; /* number of valid entries */
+ uint16_t eh_max; /* capacity of store in entries */
+ uint16_t eh_depth; /* the depth of extent tree */
+ uint32_t eh_gen; /* generation of extent tree */
};
/*
* Save cached extent.
*/
struct ext4_extent_cache {
- daddr_t ec_start; /* extent start */
- uint32_t ec_blk; /* logical block */
+ daddr_t ec_start; /* extent start */
+ uint32_t ec_blk; /* logical block */
uint32_t ec_len;
uint32_t ec_type;
};
@@ -84,7 +84,7 @@ struct ext4_extent_cache {
struct ext4_extent_path {
uint16_t ep_depth;
struct buf *ep_bp;
- bool ep_is_sparse;
+ bool ep_is_sparse;
union {
struct ext4_extent ep_sparse_ext;
struct ext4_extent *ep_ext;
@@ -97,7 +97,8 @@ struct inode;
struct m_ext2fs;
int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *);
void ext4_ext_put_cache(struct inode *, struct ext4_extent *, int);
-struct ext4_extent_path *ext4_ext_find_extent(struct m_ext2fs *fs,
+struct ext4_extent_path *
+ext4_ext_find_extent(struct m_ext2fs *fs,
struct inode *, daddr_t, struct ext4_extent_path *);
-#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */
+#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */
Modified: stable/11/sys/fs/ext2fs/ext2_extern.h
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_extern.h Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_extern.h Wed Jan 4 02:42:17 2017 (r311231)
@@ -110,4 +110,4 @@ int ext2_search_dirblock(struct inode *,
extern struct vop_vector ext2_vnodeops;
extern struct vop_vector ext2_fifoops;
-#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */
+#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */
Modified: stable/11/sys/fs/ext2fs/ext2_hash.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_hash.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_hash.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -192,7 +192,7 @@ ext2_legacy_hash(const char *name, int l
static void
ext2_prep_hashbuf(const char *src, int slen, uint32_t *dst, int dlen,
- int unsigned_char)
+ int unsigned_char)
{
uint32_t padding = slen | (slen << 8) | (slen << 16) | (slen << 24);
uint32_t buf_val;
@@ -240,8 +240,8 @@ ext2_prep_hashbuf(const char *src, int s
int
ext2_htree_hash(const char *name, int len,
- uint32_t *hash_seed, int hash_version,
- uint32_t *hash_major, uint32_t *hash_minor)
+ uint32_t *hash_seed, int hash_version,
+ uint32_t *hash_major, uint32_t *hash_minor)
{
uint32_t hash[4];
uint32_t data[8];
Modified: stable/11/sys/fs/ext2fs/ext2_htree.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_htree.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_htree.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -98,7 +98,7 @@ ext2_htree_has_idx(struct inode *ip)
static int
ext2_htree_check_next(struct inode *ip, uint32_t hash, const char *name,
- struct ext2fs_htree_lookup_info *info)
+ struct ext2fs_htree_lookup_info *info)
{
struct vnode *vp = ITOV(ip);
struct ext2fs_htree_lookup_level *level;
@@ -195,6 +195,7 @@ ext2_htree_release(struct ext2fs_htree_l
for (i = 0; i < info->h_levels_num; i++) {
struct buf *bp = info->h_levels[i].h_bp;
+
if (bp != NULL)
brelse(bp);
}
@@ -224,8 +225,8 @@ ext2_htree_node_limit(struct inode *ip)
static int
ext2_htree_find_leaf(struct inode *ip, const char *name, int namelen,
- uint32_t *hash, uint8_t *hash_ver,
- struct ext2fs_htree_lookup_info *info)
+ uint32_t *hash, uint8_t *hash_ver,
+ struct ext2fs_htree_lookup_info *info)
{
struct vnode *vp;
struct ext2fs *fs;
@@ -317,9 +318,9 @@ error:
*/
int
ext2_htree_lookup(struct inode *ip, const char *name, int namelen,
- struct buf **bpp, int *entryoffp, doff_t *offp,
- doff_t *prevoffp, doff_t *endusefulp,
- struct ext2fs_searchslot *ss)
+ struct buf **bpp, int *entryoffp, doff_t *offp,
+ doff_t *prevoffp, doff_t *endusefulp,
+ struct ext2fs_searchslot *ss)
{
struct vnode *vp;
struct ext2fs_htree_lookup_info info;
@@ -386,7 +387,7 @@ ext2_htree_lookup(struct inode *ip, cons
static int
ext2_htree_append_block(struct vnode *vp, char *data,
- struct componentname *cnp, uint32_t blksize)
+ struct componentname *cnp, uint32_t blksize)
{
struct iovec aiov;
struct uio auio;
@@ -419,6 +420,7 @@ ext2_htree_writebuf(struct ext2fs_htree_
for (i = 0; i < info->h_levels_num; i++) {
struct buf *bp = info->h_levels[i].h_bp;
+
error = bwrite(bp);
if (error)
return (error);
@@ -429,7 +431,7 @@ ext2_htree_writebuf(struct ext2fs_htree_
static void
ext2_htree_insert_entry_to_level(struct ext2fs_htree_lookup_level *level,
- uint32_t hash, uint32_t blk)
+ uint32_t hash, uint32_t blk)
{
struct ext2fs_htree_entry *target;
int entries_num;
@@ -449,7 +451,7 @@ ext2_htree_insert_entry_to_level(struct
*/
static void
ext2_htree_insert_entry(struct ext2fs_htree_lookup_info *info,
- uint32_t hash, uint32_t blk)
+ uint32_t hash, uint32_t blk)
{
struct ext2fs_htree_lookup_level *level;
@@ -481,8 +483,8 @@ ext2_htree_cmp_sort_entry(const void *e1
*/
static void
ext2_append_entry(char *block, uint32_t blksize,
- struct ext2fs_direct_2 *last_entry,
- struct ext2fs_direct_2 *new_entry)
+ struct ext2fs_direct_2 *last_entry,
+ struct ext2fs_direct_2 *new_entry)
{
uint16_t entry_len;
@@ -498,8 +500,8 @@ ext2_append_entry(char *block, uint32_t
*/
static int
ext2_htree_split_dirblock(char *block1, char *block2, uint32_t blksize,
- uint32_t *hash_seed, uint8_t hash_version,
- uint32_t *split_hash, struct ext2fs_direct_2 *entry)
+ uint32_t *hash_seed, uint8_t hash_version,
+ uint32_t *split_hash, struct ext2fs_direct_2 *entry)
{
int entry_cnt = 0;
int size = 0;
@@ -585,7 +587,7 @@ ext2_htree_split_dirblock(char *block1,
offset += ep->e2d_reclen;
if (ep->e2d_ino) {
last = (struct ext2fs_direct_2 *)
- ((char *)last + entry_len);
+ ((char *)last + entry_len);
entry_len = EXT2_DIR_REC_LEN(ep->e2d_namlen);
memcpy((void *)last, (void *)ep, entry_len);
last->e2d_reclen = entry_len;
@@ -616,7 +618,7 @@ ext2_htree_split_dirblock(char *block1,
*/
int
ext2_htree_create_index(struct vnode *vp, struct componentname *cnp,
- struct ext2fs_direct_2 *new_entry)
+ struct ext2fs_direct_2 *new_entry)
{
struct buf *bp = NULL;
struct inode *dp;
@@ -721,7 +723,7 @@ out1:
*/
int
ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry,
- struct componentname *cnp)
+ struct componentname *cnp)
{
struct ext2fs_htree_entry *entries, *leaf_node;
struct ext2fs_htree_lookup_info info;
@@ -747,7 +749,7 @@ ext2_htree_add_entry(struct vnode *dvp,
fs = m_fs->e2fs;
blksize = m_fs->e2fs_bsize;
- if (ip->i_count != 0)
+ if (ip->i_count != 0)
return ext2_add_entry(dvp, entry);
/* Target directory block is full, split it */
@@ -807,6 +809,7 @@ ext2_htree_add_entry(struct vnode *dvp,
if (info.h_levels[1].h_entry >= entries + src_ent_num) {
struct buf *tmp = info.h_levels[1].h_bp;
+
info.h_levels[1].h_bp = dst_bp;
dst_bp = tmp;
Modified: stable/11/sys/fs/ext2fs/ext2_inode.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_inode.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_inode.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -81,11 +81,11 @@ ext2_update(struct vnode *vp, int waitfo
return (0);
ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED);
fs = ip->i_e2fs;
- if(fs->e2fs_ronly)
+ if (fs->e2fs_ronly)
return (0);
if ((error = bread(ip->i_devvp,
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
- (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) {
+ (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) {
brelse(bp);
return (error);
}
@@ -130,10 +130,10 @@ ext2_truncate(struct vnode *vp, off_t le
bo = &ovp->v_bufobj;
#endif
- ASSERT_VOP_LOCKED(vp, "ext2_truncate");
+ ASSERT_VOP_LOCKED(vp, "ext2_truncate");
if (length < 0)
- return (EINVAL);
+ return (EINVAL);
if (ovp->v_type == VLNK &&
oip->i_size < ovp->v_mount->mnt_maxsymlinklen) {
@@ -345,7 +345,7 @@ done:
bo->bo_clean.bv_cnt != 0))
panic("itrunc3");
BO_UNLOCK(bo);
-#endif /* INVARIANTS */
+#endif /* INVARIANTS */
/*
* Put back the real size.
*/
@@ -418,12 +418,11 @@ ext2_indirtrunc(struct inode *ip, daddr_
*countp = 0;
return (error);
}
-
bap = (e2fs_daddr_t *)bp->b_data;
copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize);
bzero((caddr_t)&bap[last + 1],
- (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t));
+ (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t));
if (last == -1)
bp->b_flags |= B_INVAL;
if (DOINGASYNC(vp)) {
Modified: stable/11/sys/fs/ext2fs/ext2_inode_cnv.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Wed Jan 4 02:39:00 2017 (r311230)
+++ stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Wed Jan 4 02:42:17 2017 (r311231)
@@ -49,17 +49,17 @@ ext2_print_inode(struct inode *in)
struct ext4_extent_header *ehp;
struct ext4_extent *ep;
- printf( "Inode: %5ju", (uintmax_t)in->i_number);
- printf( /* "Inode: %5d" */
- " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n",
- "n/a", in->i_mode, in->i_flags, in->i_gen);
+ printf("Inode: %5ju", (uintmax_t)in->i_number);
+ printf( /* "Inode: %5d" */
+ " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n",
+ "n/a", in->i_mode, in->i_flags, in->i_gen);
printf("User: %5u Group: %5u Size: %ju\n",
in->i_uid, in->i_gid, (uintmax_t)in->i_size);
printf("Links: %3d Blockcount: %ju\n",
in->i_nlink, (uintmax_t)in->i_blocks);
- printf( "ctime: 0x%x", in->i_ctime);
- printf( "atime: 0x%x", in->i_atime);
- printf( "mtime: 0x%x", in->i_mtime);
+ printf("ctime: 0x%x", in->i_ctime);
+ printf("atime: 0x%x", in->i_atime);
+ printf("mtime: 0x%x", in->i_mtime);
if (E2DI_HAS_XTIME(in))
printf("crtime %#x ", in->i_birthtime);
printf("BLOCKS:");
@@ -87,11 +87,12 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru
int i;
ip->i_nlink = ei->e2di_nlink;
- /* Godmar thinks - if the link count is zero, then the inode is
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable
mailing list