PERFORCE change 168120 for review
Aditya Sarawgi
truncs at FreeBSD.org
Thu Sep 3 17:34:38 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=168120
Change 168120 by truncs at aditya on 2009/09/03 17:33:57
Build fixes.
Affected files ...
.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_balloc.c#5 edit
.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#7 edit
Differences ...
==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_balloc.c#5 (text+ko) ====
@@ -57,7 +57,7 @@
int
ext2_balloc(ip, lbn, size, cred, bpp, flags)
struct inode *ip;
- int32_t bn;
+ int32_t lbn;
int size;
struct ucred *cred;
struct buf **bpp;
@@ -68,7 +68,7 @@
struct buf *bp, *nbp;
struct vnode *vp = ITOV(ip);
struct indir indirs[NIADDR + 2];
- int32_t newb, lbn, *bap, pref;
+ int32_t newb, *bap, pref;
int osize, nsize, num, i, error;
*bpp = NULL;
@@ -129,12 +129,12 @@
*/
}
} else {
- if (ip->i_size < (bn + 1) * fs->e2fs_bsize)
+ if (ip->i_size < (lbn + 1) * fs->e2fs_bsize)
nsize = fragroundup(fs, size);
else
nsize = fs->e2fs_bsize;
error = ext2_alloc(ip, lbn,
- ext2_blkpref(ip, bn, (int)lbn, &ip->i_db[0], 0),
+ ext2_blkpref(ip, lbn, (int)lbn, &ip->i_db[0], 0),
nsize, cred, &newb);
if (error)
return (error);
@@ -181,8 +181,8 @@
pref = ext2_blkpref(ip, lbn, indirs[0].in_off +
EXT2_NDIR_BLOCKS, &ip->i_db[0], 0);
#endif
- if (error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize,
- cred, &newb)
+ if ((error = ext2_alloc(ip, lbn, pref,
+ (int)fs->e2fs_bsize, cred, &newb)))
return (error);
nb = newb;
bp = getblk(vp, indirs[1].in_lbn, fs->e2fs_bsize, 0, 0, 0);
==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_inode.c#7 (text+ko) ====
@@ -155,20 +155,24 @@
if (osize < length) {
if (length > oip->i_e2fs->e2fs_maxfilesize)
return (EFBIG);
+ vnode_pager_setsize(ovp, length);
offset = blkoff(fs, length - 1);
lbn = lblkno(fs, length - 1);
aflags = B_CLRBUF;
if (flags & IO_SYNC)
aflags |= B_SYNC;
- vnode_pager_setsize(ovp, length);
error = ext2_balloc(oip, lbn, offset + 1, cred, &bp, aflags);
if (error) {
vnode_pager_setsize(vp, osize);
return (error);
}
oip->i_size = length;
+ if (bp->b_bufsize == fs->e2fs_bsize)
+ bp->b_flags |= B_CLUSTEROK;
if (aflags & B_SYNC)
bwrite(bp);
+ else if (ovp->v_mount->mnt_flag & MNT_ASYNC)
+ bdwrite(bp);
else
bawrite(bp);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
@@ -191,15 +195,18 @@
if (flags & IO_SYNC)
aflags |= B_SYNC;
error = ext2_balloc(oip, lbn, offset, cred, &bp, aflags);
- if (error) {
+ if (error)
return (error);
- }
oip->i_size = length;
size = blksize(fs, oip, lbn);
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
allocbuf(bp, size);
+ if (bp->b_bufsize == fs->e2fs_bsize)
+ bp->b_flags |= B_CLUSTEROK;
if (aflags & B_SYNC)
bwrite(bp);
+ else if (ovp->v_mount->mnt_flag & MNT_ASYNC)
+ bdwrite(bp);
else
bawrite(bp);
}
@@ -243,7 +250,8 @@
error = vtruncbuf(ovp, cred, td, length, (int)fs->e2fs_bsize);
if (error && (allerror == 0))
allerror = error;
-
+ vnode_pager_setsize(ovp, length);
+
/*
* Indirect blocks first.
*/
More information about the p4-projects
mailing list