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:
parent
36a00a3f38
commit
c535690b33
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248282
@ -329,7 +329,7 @@ cd9660_read(ap)
|
|||||||
if (lblktosize(imp, rablock) < ip->i_size)
|
if (lblktosize(imp, rablock) < ip->i_size)
|
||||||
error = cluster_read(vp, (off_t)ip->i_size,
|
error = cluster_read(vp, (off_t)ip->i_size,
|
||||||
lbn, size, NOCRED, uio->uio_resid,
|
lbn, size, NOCRED, uio->uio_resid,
|
||||||
(ap->a_ioflag >> 16), &bp);
|
(ap->a_ioflag >> 16), 0, &bp);
|
||||||
else
|
else
|
||||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -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) {
|
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||||
error = cluster_read(vp, ip->i_size, lbn,
|
error = cluster_read(vp, ip->i_size, lbn,
|
||||||
(int)fs->e2fs_bsize, NOCRED,
|
(int)fs->e2fs_bsize, NOCRED,
|
||||||
MAXBSIZE, seqcount, &nbp);
|
MAXBSIZE, seqcount, 0, &nbp);
|
||||||
} else {
|
} else {
|
||||||
error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
|
error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED, &nbp);
|
||||||
}
|
}
|
||||||
|
@ -1618,10 +1618,11 @@ ext2_read(struct vop_read_args *ap)
|
|||||||
|
|
||||||
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
||||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
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,
|
error = cluster_read(vp, ip->i_size, lbn, size,
|
||||||
NOCRED, blkoffset + uio->uio_resid, seqcount, &bp);
|
NOCRED, blkoffset + uio->uio_resid, seqcount,
|
||||||
else if (seqcount > 1) {
|
0, &bp);
|
||||||
|
} else if (seqcount > 1) {
|
||||||
int nextsize = blksize(fs, ip, nextlbn);
|
int nextsize = blksize(fs, ip, nextlbn);
|
||||||
error = breadn(vp, lbn,
|
error = breadn(vp, lbn,
|
||||||
size, &nextlbn, &nextsize, 1, NOCRED, &bp);
|
size, &nextlbn, &nextsize, 1, NOCRED, &bp);
|
||||||
@ -1831,7 +1832,7 @@ ext2_write(struct vop_write_args *ap)
|
|||||||
} else if (xfersize + blkoffset == fs->e2fs_fsize) {
|
} else if (xfersize + blkoffset == fs->e2fs_fsize) {
|
||||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
||||||
bp->b_flags |= B_CLUSTEROK;
|
bp->b_flags |= B_CLUSTEROK;
|
||||||
cluster_write(vp, bp, ip->i_size, seqcount);
|
cluster_write(vp, bp, ip->i_size, seqcount, 0);
|
||||||
} else {
|
} else {
|
||||||
bawrite(bp);
|
bawrite(bp);
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ msdosfs_read(ap)
|
|||||||
error = bread(vp, lbn, blsize, NOCRED, &bp);
|
error = bread(vp, lbn, blsize, 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, dep->de_FileSize, lbn, blsize,
|
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) {
|
} else if (seqcount > 1) {
|
||||||
rasize = blsize;
|
rasize = blsize;
|
||||||
error = breadn(vp, lbn,
|
error = breadn(vp, lbn,
|
||||||
@ -820,7 +820,7 @@ msdosfs_write(ap)
|
|||||||
else if (n + croffset == pmp->pm_bpcluster) {
|
else if (n + croffset == pmp->pm_bpcluster) {
|
||||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0)
|
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0)
|
||||||
cluster_write(vp, bp, dep->de_FileSize,
|
cluster_write(vp, bp, dep->de_FileSize,
|
||||||
seqcount);
|
seqcount, 0);
|
||||||
else
|
else
|
||||||
bawrite(bp);
|
bawrite(bp);
|
||||||
} else
|
} else
|
||||||
|
@ -478,8 +478,9 @@ udf_read(struct vop_read_args *ap)
|
|||||||
rablock = lbn + 1;
|
rablock = lbn + 1;
|
||||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||||
if (lblktosize(udfmp, rablock) < fsize) {
|
if (lblktosize(udfmp, rablock) < fsize) {
|
||||||
error = cluster_read(vp, fsize, lbn, size, NOCRED,
|
error = cluster_read(vp, fsize, lbn, size,
|
||||||
uio->uio_resid, (ap->a_ioflag >> 16), &bp);
|
NOCRED, uio->uio_resid,
|
||||||
|
(ap->a_ioflag >> 16), 0, &bp);
|
||||||
} else {
|
} else {
|
||||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||||
}
|
}
|
||||||
|
@ -1794,8 +1794,9 @@ vfs_bio_awrite(struct buf *bp)
|
|||||||
*/
|
*/
|
||||||
if (ncl != 1) {
|
if (ncl != 1) {
|
||||||
BUF_UNLOCK(bp);
|
BUF_UNLOCK(bp);
|
||||||
nwritten = cluster_wbuild(vp, size, lblkno - j, ncl);
|
nwritten = cluster_wbuild(vp, size, lblkno - j, ncl,
|
||||||
return nwritten;
|
0);
|
||||||
|
return (nwritten);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bremfree(bp);
|
bremfree(bp);
|
||||||
|
@ -84,15 +84,9 @@ extern vm_page_t bogus_page;
|
|||||||
* cluster_read replaces bread.
|
* cluster_read replaces bread.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
|
cluster_read(struct vnode *vp, u_quad_t filesize, daddr_t lblkno, long size,
|
||||||
struct vnode *vp;
|
struct ucred *cred, long totread, int seqcount, int gbflags,
|
||||||
u_quad_t filesize;
|
struct buf **bpp)
|
||||||
daddr_t lblkno;
|
|
||||||
long size;
|
|
||||||
struct ucred *cred;
|
|
||||||
long totread;
|
|
||||||
int seqcount;
|
|
||||||
struct buf **bpp;
|
|
||||||
{
|
{
|
||||||
struct buf *bp, *rbp, *reqbp;
|
struct buf *bp, *rbp, *reqbp;
|
||||||
struct bufobj *bo;
|
struct bufobj *bo;
|
||||||
@ -576,7 +570,7 @@ cluster_wbuild_wb(struct vnode *vp, long size, daddr_t start_lbn, int len)
|
|||||||
start_lbn -= len;
|
start_lbn -= len;
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 1:
|
case 1:
|
||||||
r = cluster_wbuild(vp, size, start_lbn, len);
|
r = cluster_wbuild(vp, size, start_lbn, len, 0);
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
/* FALLTHROUGH */
|
/* 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
|
* 4. end of a cluster - asynchronously write cluster
|
||||||
*/
|
*/
|
||||||
void
|
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;
|
daddr_t lbn;
|
||||||
int maxclen, cursize;
|
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).
|
* the current block (if last_bp == NULL).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cluster_wbuild(vp, size, start_lbn, len)
|
cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
|
||||||
struct vnode *vp;
|
int gbflags)
|
||||||
long size;
|
|
||||||
daddr_t start_lbn;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
struct buf *bp, *tbp;
|
struct buf *bp, *tbp;
|
||||||
struct bufobj *bo;
|
struct bufobj *bo;
|
||||||
|
@ -508,9 +508,9 @@ void bufdone_finish(struct buf *);
|
|||||||
void bd_speedup(void);
|
void bd_speedup(void);
|
||||||
|
|
||||||
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
|
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
|
||||||
struct ucred *, long, int, struct buf **);
|
struct ucred *, long, int, int, struct buf **);
|
||||||
int cluster_wbuild(struct vnode *, long, daddr_t, int);
|
int cluster_wbuild(struct vnode *, long, daddr_t, int, int);
|
||||||
void cluster_write(struct vnode *, struct buf *, u_quad_t, 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_set_valid(struct buf *, int base, int size);
|
||||||
void vfs_bio_clrbuf(struct buf *);
|
void vfs_bio_clrbuf(struct buf *);
|
||||||
void vfs_busy_pages(struct buf *, int clear_modify);
|
void vfs_busy_pages(struct buf *, int clear_modify);
|
||||||
|
@ -418,7 +418,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
|||||||
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||||
error = cluster_read(vp, ip->i_size, lbn,
|
error = cluster_read(vp, ip->i_size, lbn,
|
||||||
(int)fs->fs_bsize, NOCRED,
|
(int)fs->fs_bsize, NOCRED,
|
||||||
MAXBSIZE, seqcount, &nbp);
|
MAXBSIZE, seqcount, 0, &nbp);
|
||||||
} else {
|
} else {
|
||||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||||
}
|
}
|
||||||
@ -966,7 +966,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
|||||||
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
|
||||||
error = cluster_read(vp, ip->i_size, lbn,
|
error = cluster_read(vp, ip->i_size, lbn,
|
||||||
(int)fs->fs_bsize, NOCRED,
|
(int)fs->fs_bsize, NOCRED,
|
||||||
MAXBSIZE, seqcount, &nbp);
|
MAXBSIZE, seqcount, 0, &nbp);
|
||||||
} else {
|
} else {
|
||||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,8 @@ ffs_read(ap)
|
|||||||
* doing sequential access.
|
* doing sequential access.
|
||||||
*/
|
*/
|
||||||
error = cluster_read(vp, ip->i_size, lbn,
|
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) {
|
} else if (seqcount > 1) {
|
||||||
/*
|
/*
|
||||||
* If we are NOT allowed to cluster, then
|
* If we are NOT allowed to cluster, then
|
||||||
@ -784,7 +785,8 @@ ffs_write(ap)
|
|||||||
} else if (xfersize + blkoffset == fs->fs_bsize) {
|
} else if (xfersize + blkoffset == fs->fs_bsize) {
|
||||||
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) {
|
||||||
bp->b_flags |= B_CLUSTEROK;
|
bp->b_flags |= B_CLUSTEROK;
|
||||||
cluster_write(vp, bp, ip->i_size, seqcount);
|
cluster_write(vp, bp, ip->i_size, seqcount,
|
||||||
|
0);
|
||||||
} else {
|
} else {
|
||||||
bawrite(bp);
|
bawrite(bp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user