Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/fuse/fuse_vfsops.c
Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | fuse_vfsop_mount(struct mount *mp) | ||||
mp->mnt_flag &= ~MNT_LOCAL; | mp->mnt_flag &= ~MNT_LOCAL; | ||||
mp->mnt_kern_flag |= MNTK_USES_BCACHE; | mp->mnt_kern_flag |= MNTK_USES_BCACHE; | ||||
/* | /* | ||||
* Disable nullfs cacheing because it can consume too many resources in | * Disable nullfs cacheing because it can consume too many resources in | ||||
* the FUSE server. | * the FUSE server. | ||||
*/ | */ | ||||
mp->mnt_kern_flag |= MNTK_NULL_NOCACHE; | mp->mnt_kern_flag |= MNTK_NULL_NOCACHE; | ||||
MNT_IUNLOCK(mp); | MNT_IUNLOCK(mp); | ||||
/* We need this here as this slot is used by getnewvnode() */ | /* | ||||
* mnt_stat.f_iosize is used by the buffer cache. We choose a sensible | |||||
* value ourselves, rather than trusting what the FUSE server reports. | |||||
* But this is distinct from the f_iosize that we will report via | |||||
* statfs(2). | |||||
*/ | |||||
mp->mnt_stat.f_iosize = maxbcachebuf; | mp->mnt_stat.f_iosize = maxbcachebuf; | ||||
if (subtype) { | if (subtype) { | ||||
strlcat(mp->mnt_stat.f_fstypename, ".", MFSNAMELEN); | strlcat(mp->mnt_stat.f_fstypename, ".", MFSNAMELEN); | ||||
strlcat(mp->mnt_stat.f_fstypename, subtype, MFSNAMELEN); | strlcat(mp->mnt_stat.f_fstypename, subtype, MFSNAMELEN); | ||||
} | } | ||||
memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN); | memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN); | ||||
strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN); | strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN); | ||||
mp->mnt_iosize_max = maxphys; | mp->mnt_iosize_max = maxphys; | ||||
▲ Show 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | fuse_vfsop_statfs(struct mount *mp, struct statfs *sbp) | ||||
sbp->f_blocks = fsfo->st.blocks; | sbp->f_blocks = fsfo->st.blocks; | ||||
sbp->f_bfree = fsfo->st.bfree; | sbp->f_bfree = fsfo->st.bfree; | ||||
sbp->f_bavail = fsfo->st.bavail; | sbp->f_bavail = fsfo->st.bavail; | ||||
sbp->f_files = fsfo->st.files; | sbp->f_files = fsfo->st.files; | ||||
sbp->f_ffree = fsfo->st.ffree; /* cast from uint64_t to int64_t */ | sbp->f_ffree = fsfo->st.ffree; /* cast from uint64_t to int64_t */ | ||||
sbp->f_namemax = fsfo->st.namelen; | sbp->f_namemax = fsfo->st.namelen; | ||||
sbp->f_bsize = fsfo->st.frsize; /* cast from uint32_t to uint64_t */ | sbp->f_bsize = fsfo->st.frsize; /* cast from uint32_t to uint64_t */ | ||||
if (fsess_opt_datacache(mp)) | |||||
sbp->f_iosize = MAX(fsfo->st.bsize, mp->mnt_stat.f_iosize); | |||||
cem: Does this make sense? I.e., should it just be `f_iosize` either way? Or should it be MIN()? | |||||
else | |||||
sbp->f_iosize = fsfo->st.bsize; | |||||
fdisp_destroy(&fdi); | fdisp_destroy(&fdi); | ||||
return 0; | return 0; | ||||
fake: | fake: | ||||
sbp->f_blocks = 0; | sbp->f_blocks = 0; | ||||
sbp->f_bfree = 0; | sbp->f_bfree = 0; | ||||
sbp->f_bavail = 0; | sbp->f_bavail = 0; | ||||
sbp->f_files = 0; | sbp->f_files = 0; | ||||
sbp->f_ffree = 0; | sbp->f_ffree = 0; | ||||
sbp->f_namemax = 0; | sbp->f_namemax = 0; | ||||
sbp->f_bsize = S_BLKSIZE; | sbp->f_bsize = S_BLKSIZE; | ||||
return 0; | return 0; | ||||
} | } |
Does this make sense? I.e., should it just be f_iosize either way? Or should it be MIN()? I don't understand how iosize is used well enough, yet.
if iosize (aka maxbcachebuf) > fuse bsize: use larger maxbcachebuf for xfer efficiency
if iosize < fuse bsize: use smaller bcachebuf because it's the maximal bcache block size? Or does that not matter?
My guess is that these rarely conflict, but I don't know what the right thing to do at the edges is.
One thing we should verify is that f_iosize must be <= maxphys (see, e.g., kern/vfs_bio.c math for maxcl).