Add BO_SYNC() and add a default which uses the secret vnode pointer

and VOP_FSYNC() for now.
This commit is contained in:
Poul-Henning Kamp 2005-01-11 10:43:08 +00:00
parent 4438d91ea2
commit 6ef8480a88
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140056
6 changed files with 16 additions and 1 deletions

View File

@ -48,6 +48,7 @@ static struct buf_ops __g_vfs_bufops = {
.bop_name = "GEOM_VFS",
.bop_write = bufwrite,
.bop_strategy = g_vfs_strategy,
.bop_sync = bufsync,
};
struct buf_ops *g_vfs_bufops = &__g_vfs_bufops;

View File

@ -79,6 +79,7 @@ struct buf_ops buf_ops_bio = {
.bop_name = "buf_ops_bio",
.bop_write = bufwrite,
.bop_strategy = bufstrategy,
.bop_sync = bufsync,
};
/*
@ -3822,6 +3823,13 @@ bwait(struct buf *bp, u_char pri, const char *wchan)
mtx_unlock(&bdonelock);
}
int
bufsync(struct bufobj *bo, int waitfor, struct thread *td)
{
return (VOP_FSYNC(bo->__bo_vnode, waitfor, td));
}
void
bufstrategy(struct bufobj *bo, struct buf *bp)
{

View File

@ -935,7 +935,7 @@ vinvalbuf(vp, flags, cred, td, slpflag, slptimeo)
}
if (bo->bo_dirty.bv_cnt > 0) {
BO_UNLOCK(bo);
if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0)
if ((error = BO_SYNC(bo, MNT_WAIT, td)) != 0)
return (error);
/*
* XXX We could save a lock/unlock if this was only

View File

@ -3171,4 +3171,5 @@ struct buf_ops buf_ops_nfs = {
.bop_name = "buf_ops_nfs",
.bop_write = nfs_bwrite,
.bop_strategy = bufstrategy,
.bop_sync = bufsync,
};

View File

@ -69,14 +69,17 @@ struct bufv {
typedef void b_strategy_t(struct bufobj *, struct buf *);
typedef int b_write_t(struct buf *);
typedef int b_sync_t(struct bufobj *, int waitfor, struct thread *td);
struct buf_ops {
char *bop_name;
b_write_t *bop_write;
b_strategy_t *bop_strategy;
b_sync_t *bop_sync;
};
#define BO_STRATEGY(bo, bp) ((bo)->bo_ops->bop_strategy((bo), (bp)))
#define BO_SYNC(bo, w, td) ((bo)->bo_ops->bop_sync((bo), (w), (td)))
#define BO_WRITE(bo, bp) ((bo)->bo_ops->bop_write((bp)))
struct bufobj {
@ -123,6 +126,7 @@ struct bufobj {
void bufobj_wdrop(struct bufobj *bo);
void bufobj_wref(struct bufobj *bo);
int bufobj_wwait(struct bufobj *bo, int slpflag, int timeo);
int bufsync(struct bufobj *bo, int waitfor, struct thread *td);
#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */
#endif /* _SYS_BUFOBJ_H_ */

View File

@ -108,6 +108,7 @@ static struct buf_ops ffs_ops = {
.bop_name = "FFS",
.bop_write = bufwrite,
.bop_strategy = ffs_geom_strategy,
.bop_sync = bufsync,
};
static const char *ffs_opts[] = { "from", "export", NULL };