aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs/ext2_balloc.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-04-28 14:27:17 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-04-28 14:27:17 +0000
commit9e880b876dea266a295d6f114724ba88bde68cbb (patch)
tree5c411cd76f416c4ad8905361c5890b5ff3a6729c /sys/fs/ext2fs/ext2_balloc.c
parentcd0f42fa9f97d519dd541611e6f7fed7fb2dcfbe (diff)
downloadsrc-9e880b876dea266a295d6f114724ba88bde68cbb.tar.gz
src-9e880b876dea266a295d6f114724ba88bde68cbb.zip
Sync with several changes in UFS/FFS:
- 77115: Implement support for O_DIRECT. - 98425: Fix a performance issue introduced in 70131 that was causing reads before writes even when writing full blocks. - 98658: Rename the BALLOC flags from B_* to BA_* to avoid confusion with the struct buf B_ flags. - 100344: Merge the BA_ and IO_ flags so so that they may both be used in the same flags word. This merger is possible by assigning the IO_ flags to the low sixteen bits and the BA_ flags the high sixteen bits. - 105422: Fix a file-rewrite performance case. - 129545: Implement IO_INVAL in VOP_WRITE() by marking the buffer as "no cache". - Readd the DOINGASYNC() macro and use it to control asynchronous writes. Change i-node updates to honor DOINGASYNC() instead of always being synchronous. - Use a PRIV_VFS_RETAINSUGID check instead of checking cr_uid against 0 directly when deciding whether or not to clear suid and sgid bits. Submitted by: Pedro F. Giffuni giffunip at yahoo
Notes
Notes: svn path=/head/; revision=221166
Diffstat (limited to 'sys/fs/ext2fs/ext2_balloc.c')
-rw-r--r--sys/fs/ext2fs/ext2_balloc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c
index 124ac32ddf1c..3fb19763d530 100644
--- a/sys/fs/ext2fs/ext2_balloc.c
+++ b/sys/fs/ext2fs/ext2_balloc.c
@@ -41,7 +41,7 @@
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/lock.h>
-#include <sys/ucred.h>
+#include <sys/mount.h>
#include <sys/vnode.h>
#include <fs/ext2fs/inode.h>
@@ -143,7 +143,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, flags)
return (error);
bp = getblk(vp, lbn, nsize, 0, 0, 0);
bp->b_blkno = fsbtodb(fs, newb);
- if (flags & B_CLRBUF)
+ if (flags & BA_CLRBUF)
vfs_bio_clrbuf(bp);
}
ip->i_db[lbn] = dbtofsb(fs, bp->b_blkno);
@@ -235,7 +235,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, flags)
* If required, write synchronously, otherwise use
* delayed write.
*/
- if (flags & B_SYNC) {
+ if (flags & IO_SYNC) {
bwrite(bp);
} else {
if (bp->b_bufsize == fs->e2fs_bsize)
@@ -258,14 +258,14 @@ ext2_balloc(ip, lbn, size, cred, bpp, flags)
nb = newb;
nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0, 0);
nbp->b_blkno = fsbtodb(fs, nb);
- if (flags & B_CLRBUF)
+ if (flags & BA_CLRBUF)
vfs_bio_clrbuf(nbp);
bap[indirs[i].in_off] = nb;
/*
* If required, write synchronously, otherwise use
* delayed write.
*/
- if (flags & B_SYNC) {
+ if (flags & IO_SYNC) {
bwrite(bp);
} else {
if (bp->b_bufsize == fs->e2fs_bsize)
@@ -276,8 +276,15 @@ ext2_balloc(ip, lbn, size, cred, bpp, flags)
return (0);
}
brelse(bp);
- if (flags & B_CLRBUF) {
- error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
+ 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,
+ MAXBSIZE, seqcount, &nbp);
+ } else {
+ error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
+ }
if (error) {
brelse(nbp);
return (error);