aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs/ext2_balloc.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-12-28 15:43:17 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-12-28 15:43:17 +0000
commitbf9a211dff099e7d2169fe7f1b146ebe2e8113e7 (patch)
tree0738509af0f10dce9c2826a28653a940c33b3a3d /sys/fs/ext2fs/ext2_balloc.c
parent406b8d7d9b79dcefb55d773130d50676ad03b412 (diff)
downloadsrc-bf9a211dff099e7d2169fe7f1b146ebe2e8113e7.tar.gz
src-bf9a211dff099e7d2169fe7f1b146ebe2e8113e7.zip
style(9) cleanups.
Just to reduce some of the issues found with indent(1). MFC after: 1 week
Notes
Notes: svn path=/head/; revision=310705
Diffstat (limited to 'sys/fs/ext2fs/ext2_balloc.c')
-rw-r--r--sys/fs/ext2fs/ext2_balloc.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c
index 090298d2e31f..fcfccc2f6d53 100644
--- a/sys/fs/ext2fs/ext2_balloc.c
+++ b/sys/fs/ext2fs/ext2_balloc.c
@@ -76,22 +76,23 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
}
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 lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
*/
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 lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
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 lbn, int size, struct ucred *cred,
*bpp = nbp;
return (0);
}
-