Add currently unused flag argument to the cluster_read(),

cluster_write() and cluster_wbuild() functions.  The flags to be
allowed are a subset of the GB_* flags for getblk().

Sponsored by:	The FreeBSD Foundation
Tested by:	pho
This commit is contained in:
Konstantin Belousov 2013-03-14 20:28:26 +00:00
parent 36a00a3f38
commit c535690b33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248282
10 changed files with 32 additions and 35 deletions

View File

@ -329,7 +329,7 @@ cd9660_read(ap)
if (lblktosize(imp, rablock) < ip->i_size)
error = cluster_read(vp, (off_t)ip->i_size,
lbn, size, NOCRED, uio->uio_resid,
(ap->a_ioflag >> 16), &bp);
(ap->a_ioflag >> 16), 0, &bp);
else
error = bread(vp, lbn, size, NOCRED, &bp);
} else {

View File

@ -276,7 +276,7 @@ ext2_balloc(struct inode *ip, int32_t lbn, int size, struct ucred *cred,
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);
MAXBSIZE, seqcount, 0, &nbp);
} else {
error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
}

View File

@ -1618,10 +1618,11 @@ ext2_read(struct vop_read_args *ap)
if (lblktosize(fs, nextlbn) >= ip->i_size)
error = bread(vp, lbn, size, NOCRED, &bp);
else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0)
else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, ip->i_size, lbn, size,
NOCRED, blkoffset + uio->uio_resid, seqcount, &bp);
else if (seqcount > 1) {
NOCRED, blkoffset + uio->uio_resid, seqcount,
0, &bp);
} else if (seqcount > 1) {
int nextsize = blksize(fs, ip, nextlbn);
error = breadn(vp, lbn,
size, &nextlbn, &nextsize, 1, NOCRED, &bp);
@ -1831,7 +1832,7 @@ ext2_write(struct vop_write_args *ap)
} else if (xfersize + blkoffset == fs->e2fs_fsize) {
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
bp->b_flags |= B_CLUSTEROK;
cluster_write(vp, bp, ip->i_size, seqcount);
cluster_write(vp, bp, ip->i_size, seqcount, 0);
} else {
bawrite(bp);
}

View File

@ -600,7 +600,7 @@ msdosfs_read(ap)
error = bread(vp, lbn, blsize, NOCRED, &bp);
} else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, dep->de_FileSize, lbn, blsize,
NOCRED, on + uio->uio_resid, seqcount, &bp);
NOCRED, on + uio->uio_resid, seqcount, 0, &bp);
} else if (seqcount > 1) {
rasize = blsize;
error = breadn(vp, lbn,
@ -820,7 +820,7 @@ msdosfs_write(ap)
else if (n + croffset == pmp->pm_bpcluster) {
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0)
cluster_write(vp, bp, dep->de_FileSize,
seqcount);
seqcount, 0);
else
bawrite(bp);
} else

View File

@ -478,8 +478,9 @@ udf_read(struct vop_read_args *ap)
rablock = lbn + 1;
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
if (lblktosize(udfmp, rablock) < fsize) {
error = cluster_read(vp, fsize, lbn, size, NOCRED,
uio->uio_resid, (ap->a_ioflag >> 16), &bp);
error = cluster_read(vp, fsize, lbn, size,
NOCRED, uio->uio_resid,
(ap->a_ioflag >> 16), 0, &bp);
} else {
error = bread(vp, lbn, size, NOCRED, &bp);
}

View File

@ -1794,8 +1794,9 @@ vfs_bio_awrite(struct buf *bp)
*/
if (ncl != 1) {
BUF_UNLOCK(bp);
nwritten = cluster_wbuild(vp, size, lblkno - j, ncl);
return nwritten;
nwritten = cluster_wbuild(vp, size, lblkno - j, ncl,
0);
return (nwritten);
}
}
bremfree(bp);

View File

@ -84,15 +84,9 @@ extern vm_page_t bogus_page;
* cluster_read replaces bread.
*/
int
cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
struct vnode *vp;
u_quad_t filesize;
daddr_t lblkno;
long size;
struct ucred *cred;
long totread;
int seqcount;
struct buf **bpp;
cluster_read(struct vnode *vp, u_quad_t filesize, daddr_t lblkno, long size,
struct ucred *cred, long totread, int seqcount, int gbflags,
struct buf **bpp)
{
struct buf *bp, *rbp, *reqbp;
struct bufobj *bo;
@ -576,7 +570,7 @@ cluster_wbuild_wb(struct vnode *vp, long size, daddr_t start_lbn, int len)
start_lbn -= len;
/* FALLTHROUGH */
case 1:
r = cluster_wbuild(vp, size, start_lbn, len);
r = cluster_wbuild(vp, size, start_lbn, len, 0);
/* FALLTHROUGH */
default:
/* FALLTHROUGH */
@ -596,7 +590,8 @@ cluster_wbuild_wb(struct vnode *vp, long size, daddr_t start_lbn, int len)
* 4. end of a cluster - asynchronously write cluster
*/
void
cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount)
cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount,
int gbflags)
{
daddr_t lbn;
int maxclen, cursize;
@ -742,11 +737,8 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount)
* the current block (if last_bp == NULL).
*/
int
cluster_wbuild(vp, size, start_lbn, len)
struct vnode *vp;
long size;
daddr_t start_lbn;
int len;
cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
int gbflags)
{
struct buf *bp, *tbp;
struct bufobj *bo;

View File

@ -508,9 +508,9 @@ void bufdone_finish(struct buf *);
void bd_speedup(void);
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
struct ucred *, long, int, struct buf **);
int cluster_wbuild(struct vnode *, long, daddr_t, int);
void cluster_write(struct vnode *, struct buf *, u_quad_t, int);
struct ucred *, long, int, int, struct buf **);
int cluster_wbuild(struct vnode *, long, daddr_t, int, int);
void cluster_write(struct vnode *, struct buf *, u_quad_t, int, int);
void vfs_bio_set_valid(struct buf *, int base, int size);
void vfs_bio_clrbuf(struct buf *);
void vfs_busy_pages(struct buf *, int clear_modify);

View File

@ -418,7 +418,7 @@ retry:
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, ip->i_size, lbn,
(int)fs->fs_bsize, NOCRED,
MAXBSIZE, seqcount, &nbp);
MAXBSIZE, seqcount, 0, &nbp);
} else {
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
}
@ -966,7 +966,7 @@ retry:
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, ip->i_size, lbn,
(int)fs->fs_bsize, NOCRED,
MAXBSIZE, seqcount, &nbp);
MAXBSIZE, seqcount, 0, &nbp);
} else {
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
}

View File

@ -519,7 +519,8 @@ ffs_read(ap)
* doing sequential access.
*/
error = cluster_read(vp, ip->i_size, lbn,
size, NOCRED, blkoffset + uio->uio_resid, seqcount, &bp);
size, NOCRED, blkoffset + uio->uio_resid,
seqcount, 0, &bp);
} else if (seqcount > 1) {
/*
* If we are NOT allowed to cluster, then
@ -784,7 +785,8 @@ ffs_write(ap)
} else if (xfersize + blkoffset == fs->fs_bsize) {
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
bp->b_flags |= B_CLUSTEROK;
cluster_write(vp, bp, ip->i_size, seqcount);
cluster_write(vp, bp, ip->i_size, seqcount,
0);
} else {
bawrite(bp);
}