fuse(4): remove more debugging printfs
I missed these in r344664. They're basically useless because they can only be controlled at compile-time. Also, de-inline fuse_internal_cache_attrs. It's big enough to be a regular function, and this way it gets a dtrace FBT probe. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
1b3d8ebb21
commit
b1397d8fd5
@ -159,65 +159,8 @@ do { \
|
||||
(cred) = (td)->td_ucred; \
|
||||
} while (0)
|
||||
|
||||
/* Debug related stuff */
|
||||
|
||||
#ifndef FUSE_DEBUG_DEVICE
|
||||
#define FUSE_DEBUG_DEVICE 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_FILE
|
||||
#define FUSE_DEBUG_FILE 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_INTERNAL
|
||||
#define FUSE_DEBUG_INTERNAL 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_IO
|
||||
#define FUSE_DEBUG_IO 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_IPC
|
||||
#define FUSE_DEBUG_IPC 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_LOCK
|
||||
#define FUSE_DEBUG_LOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_VFSOPS
|
||||
#define FUSE_DEBUG_VFSOPS 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_DEBUG_VNOPS
|
||||
#define FUSE_DEBUG_VNOPS 0
|
||||
#endif
|
||||
|
||||
#ifndef FUSE_TRACE
|
||||
#define FUSE_TRACE 0
|
||||
#endif
|
||||
|
||||
#define DEBUGX(cond, fmt, ...) do { \
|
||||
if (((cond))) { \
|
||||
printf("%s: " fmt, __func__, ## __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define fuse_lck_mtx_lock(mtx) do { \
|
||||
DEBUGX(FUSE_DEBUG_LOCK, "0: lock(%s): %s@%d by %d\n", \
|
||||
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
|
||||
mtx_lock(&(mtx)); \
|
||||
DEBUGX(FUSE_DEBUG_LOCK, "1: lock(%s): %s@%d by %d\n", \
|
||||
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
|
||||
} while (0)
|
||||
|
||||
#define fuse_lck_mtx_unlock(mtx) do { \
|
||||
DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", \
|
||||
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
|
||||
mtx_unlock(&(mtx)); \
|
||||
DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", \
|
||||
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
|
||||
} while (0)
|
||||
#define fuse_lck_mtx_lock(mtx) mtx_lock(&(mtx))
|
||||
#define fuse_lck_mtx_unlock(mtx) mtx_unlock(&(mtx))
|
||||
|
||||
void fuse_ipc_init(void);
|
||||
void fuse_ipc_destroy(void);
|
||||
|
@ -207,6 +207,66 @@ fuse_internal_access(struct vnode *vp,
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cache FUSE attributes from feo, in attr cache associated with vnode 'vp'.
|
||||
* Optionally, if argument 'vap' is not NULL, store a copy of the converted
|
||||
* attributes there as well.
|
||||
*
|
||||
* If the nominal attribute cache TTL is zero, do not cache on the 'vp' (but do
|
||||
* return the result to the caller).
|
||||
*/
|
||||
void
|
||||
fuse_internal_cache_attrs(struct vnode *vp, struct fuse_attr *attr,
|
||||
uint64_t attr_valid, uint32_t attr_valid_nsec, struct vattr *vap)
|
||||
{
|
||||
struct mount *mp;
|
||||
struct fuse_vnode_data *fvdat;
|
||||
struct vattr *vp_cache_at;
|
||||
|
||||
mp = vnode_mount(vp);
|
||||
fvdat = VTOFUD(vp);
|
||||
|
||||
/* Honor explicit do-not-cache requests from user filesystems. */
|
||||
if (attr_valid == 0 && attr_valid_nsec == 0)
|
||||
fvdat->valid_attr_cache = false;
|
||||
else
|
||||
fvdat->valid_attr_cache = true;
|
||||
|
||||
vp_cache_at = VTOVA(vp);
|
||||
|
||||
if (vap == NULL && vp_cache_at == NULL)
|
||||
return;
|
||||
|
||||
if (vap == NULL)
|
||||
vap = vp_cache_at;
|
||||
|
||||
vattr_null(vap);
|
||||
|
||||
vap->va_fsid = mp->mnt_stat.f_fsid.val[0];
|
||||
vap->va_fileid = attr->ino;
|
||||
vap->va_mode = attr->mode & ~S_IFMT;
|
||||
vap->va_nlink = attr->nlink;
|
||||
vap->va_uid = attr->uid;
|
||||
vap->va_gid = attr->gid;
|
||||
vap->va_rdev = attr->rdev;
|
||||
vap->va_size = attr->size;
|
||||
/* XXX on i386, seconds are truncated to 32 bits */
|
||||
vap->va_atime.tv_sec = attr->atime;
|
||||
vap->va_atime.tv_nsec = attr->atimensec;
|
||||
vap->va_mtime.tv_sec = attr->mtime;
|
||||
vap->va_mtime.tv_nsec = attr->mtimensec;
|
||||
vap->va_ctime.tv_sec = attr->ctime;
|
||||
vap->va_ctime.tv_nsec = attr->ctimensec;
|
||||
vap->va_blocksize = PAGE_SIZE;
|
||||
vap->va_type = IFTOVT(attr->mode);
|
||||
vap->va_bytes = attr->blocks * S_BLKSIZE;
|
||||
vap->va_flags = 0;
|
||||
|
||||
if (vap != vp_cache_at && vp_cache_at != NULL)
|
||||
memcpy(vp_cache_at, vap, sizeof(*vap));
|
||||
}
|
||||
|
||||
|
||||
/* fsync */
|
||||
|
||||
int
|
||||
@ -472,7 +532,8 @@ fuse_internal_newentry_core(struct vnode *dvp,
|
||||
feo->nodeid, 1);
|
||||
return err;
|
||||
}
|
||||
cache_attrs(*vpp, feo, NULL);
|
||||
fuse_internal_cache_attrs(*vpp, &feo->attr, feo->attr_valid,
|
||||
feo->attr_valid_nsec, NULL);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -193,74 +193,8 @@ int fuse_internal_access(struct vnode *vp, mode_t mode,
|
||||
struct fuse_access_param *facp, struct thread *td, struct ucred *cred);
|
||||
|
||||
/* attributes */
|
||||
|
||||
/*
|
||||
* Cache FUSE attributes 'fat', with nominal expiration
|
||||
* 'attr_valid'.'attr_valid_nsec', in attr cache associated with vnode 'vp'.
|
||||
* Optionally, if argument 'vap' is not NULL, store a copy of the converted
|
||||
* attributes there as well.
|
||||
*
|
||||
* If the nominal attribute cache TTL is zero, do not cache on the 'vp' (but do
|
||||
* return the result to the caller).
|
||||
*/
|
||||
static inline void
|
||||
fuse_internal_attr_fat2vat(struct vnode *vp, struct fuse_attr *fat,
|
||||
uint64_t attr_valid, uint32_t attr_valid_nsec, struct vattr *vap)
|
||||
{
|
||||
struct mount *mp;
|
||||
struct fuse_vnode_data *fvdat;
|
||||
struct vattr *vp_cache_at;
|
||||
|
||||
mp = vnode_mount(vp);
|
||||
fvdat = VTOFUD(vp);
|
||||
|
||||
DEBUGX(FUSE_DEBUG_INTERNAL, "node #%ju, mode 0%o\n",
|
||||
(uintmax_t)fat->ino, fat->mode);
|
||||
|
||||
/* Honor explicit do-not-cache requests from user filesystems. */
|
||||
if (attr_valid == 0 && attr_valid_nsec == 0)
|
||||
fvdat->valid_attr_cache = false;
|
||||
else
|
||||
fvdat->valid_attr_cache = true;
|
||||
|
||||
vp_cache_at = VTOVA(vp);
|
||||
|
||||
if (vap == NULL && vp_cache_at == NULL)
|
||||
return;
|
||||
|
||||
if (vap == NULL)
|
||||
vap = vp_cache_at;
|
||||
|
||||
vattr_null(vap);
|
||||
|
||||
vap->va_fsid = mp->mnt_stat.f_fsid.val[0];
|
||||
vap->va_fileid = fat->ino;
|
||||
vap->va_mode = fat->mode & ~S_IFMT;
|
||||
vap->va_nlink = fat->nlink;
|
||||
vap->va_uid = fat->uid;
|
||||
vap->va_gid = fat->gid;
|
||||
vap->va_rdev = fat->rdev;
|
||||
vap->va_size = fat->size;
|
||||
/* XXX on i386, seconds are truncated to 32 bits */
|
||||
vap->va_atime.tv_sec = fat->atime;
|
||||
vap->va_atime.tv_nsec = fat->atimensec;
|
||||
vap->va_mtime.tv_sec = fat->mtime;
|
||||
vap->va_mtime.tv_nsec = fat->mtimensec;
|
||||
vap->va_ctime.tv_sec = fat->ctime;
|
||||
vap->va_ctime.tv_nsec = fat->ctimensec;
|
||||
vap->va_blocksize = PAGE_SIZE;
|
||||
vap->va_type = IFTOVT(fat->mode);
|
||||
vap->va_bytes = fat->blocks * S_BLKSIZE;
|
||||
vap->va_flags = 0;
|
||||
|
||||
if (vap != vp_cache_at && vp_cache_at != NULL)
|
||||
memcpy(vp_cache_at, vap, sizeof(*vap));
|
||||
}
|
||||
|
||||
|
||||
#define cache_attrs(vp, fuse_out, vap_out) \
|
||||
fuse_internal_attr_fat2vat((vp), &(fuse_out)->attr, \
|
||||
(fuse_out)->attr_valid, (fuse_out)->attr_valid_nsec, (vap_out))
|
||||
void fuse_internal_cache_attrs(struct vnode *vp, struct fuse_attr *attr,
|
||||
uint64_t attr_valid, uint32_t attr_valid_nsec, struct vattr *vap);
|
||||
|
||||
/* fsync */
|
||||
|
||||
@ -300,24 +234,15 @@ void fuse_internal_vnode_disappear(struct vnode *vp);
|
||||
static inline int
|
||||
fuse_internal_checkentry(struct fuse_entry_out *feo, enum vtype vtyp)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_INTERNAL,
|
||||
"feo=%p, vtype=%d\n", feo, vtyp);
|
||||
|
||||
if (vtyp != IFTOVT(feo->attr.mode)) {
|
||||
DEBUGX(FUSE_DEBUG_INTERNAL,
|
||||
"EINVAL -- %x != %x\n", vtyp, IFTOVT(feo->attr.mode));
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
if (feo->nodeid == FUSE_NULL_ID) {
|
||||
DEBUGX(FUSE_DEBUG_INTERNAL,
|
||||
"EINVAL -- feo->nodeid is NULL\n");
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
if (feo->nodeid == FUSE_ROOT_ID) {
|
||||
DEBUGX(FUSE_DEBUG_INTERNAL,
|
||||
"EINVAL -- feo->nodeid is FUSE_ROOT_ID\n");
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,6 @@ fticket_resp(struct fuse_ticket *ftick)
|
||||
static inline bool
|
||||
fticket_answered(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
|
||||
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
|
||||
return (ftick->tk_flag & FT_ANSW);
|
||||
}
|
||||
@ -144,7 +143,6 @@ fticket_answered(struct fuse_ticket *ftick)
|
||||
static inline void
|
||||
fticket_set_answered(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
|
||||
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
|
||||
ftick->tk_flag |= FT_ANSW;
|
||||
}
|
||||
@ -152,7 +150,6 @@ fticket_set_answered(struct fuse_ticket *ftick)
|
||||
static inline enum fuse_opcode
|
||||
fticket_opcode(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
|
||||
return (((struct fuse_in_header *)(ftick->tk_ms_fiov.base))->opcode);
|
||||
}
|
||||
|
||||
@ -273,8 +270,6 @@ fsess_opt_brokenio(struct mount *mp)
|
||||
static inline void
|
||||
fuse_ms_push(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
|
||||
ftick->tk_refcount + 1);
|
||||
mtx_assert(&ftick->tk_data->ms_mtx, MA_OWNED);
|
||||
refcount_acquire(&ftick->tk_refcount);
|
||||
STAILQ_INSERT_TAIL(&ftick->tk_data->ms_head, ftick, tk_ms_link);
|
||||
@ -293,8 +288,6 @@ fuse_ms_pop(struct fuse_data *data)
|
||||
ftick->tk_ms_link.stqe_next = NULL;
|
||||
#endif
|
||||
}
|
||||
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
|
||||
ftick ? ftick->tk_refcount : -1);
|
||||
|
||||
return (ftick);
|
||||
}
|
||||
@ -302,8 +295,6 @@ fuse_ms_pop(struct fuse_data *data)
|
||||
static inline void
|
||||
fuse_aw_push(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
|
||||
ftick->tk_refcount + 1);
|
||||
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
|
||||
refcount_acquire(&ftick->tk_refcount);
|
||||
TAILQ_INSERT_TAIL(&ftick->tk_data->aw_head, ftick, tk_aw_link);
|
||||
@ -312,8 +303,6 @@ fuse_aw_push(struct fuse_ticket *ftick)
|
||||
static inline void
|
||||
fuse_aw_remove(struct fuse_ticket *ftick)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
|
||||
ftick, ftick->tk_refcount);
|
||||
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
|
||||
TAILQ_REMOVE(&ftick->tk_data->aw_head, ftick, tk_aw_link);
|
||||
#ifdef INVARIANTS
|
||||
@ -331,8 +320,6 @@ fuse_aw_pop(struct fuse_data *data)
|
||||
|
||||
if ((ftick = TAILQ_FIRST(&data->aw_head)) != NULL)
|
||||
fuse_aw_remove(ftick);
|
||||
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
|
||||
ftick ? ftick->tk_refcount : -1);
|
||||
|
||||
return (ftick);
|
||||
}
|
||||
@ -374,7 +361,6 @@ struct fuse_dispatcher {
|
||||
static inline void
|
||||
fdisp_init(struct fuse_dispatcher *fdisp, size_t iosize)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, iosize=%zx\n", fdisp, iosize);
|
||||
fdisp->iosize = iosize;
|
||||
fdisp->tick = NULL;
|
||||
}
|
||||
@ -382,7 +368,6 @@ fdisp_init(struct fuse_dispatcher *fdisp, size_t iosize)
|
||||
static inline void
|
||||
fdisp_destroy(struct fuse_dispatcher *fdisp)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, ftick=%p\n", fdisp, fdisp->tick);
|
||||
fuse_ticket_drop(fdisp->tick);
|
||||
#ifdef INVARIANTS
|
||||
fdisp->tick = NULL;
|
||||
@ -404,7 +389,6 @@ static inline int
|
||||
fdisp_simple_putget_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op,
|
||||
struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
{
|
||||
DEBUGX(FUSE_DEBUG_IPC, "-> fdip=%p, opcode=%d, vp=%p\n", fdip, op, vp);
|
||||
fdisp_make_vp(fdip, op, vp, td, cred);
|
||||
return (fdisp_wait_answ(fdip));
|
||||
}
|
||||
|
@ -478,6 +478,7 @@ fuse_vnop_getattr(struct vop_getattr_args *ap)
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = curthread;
|
||||
struct fuse_vnode_data *fvdat = VTOFUD(vp);
|
||||
struct fuse_attr_out *fao;
|
||||
|
||||
int err = 0;
|
||||
int dataflags;
|
||||
@ -509,7 +510,9 @@ fuse_vnop_getattr(struct vop_getattr_args *ap)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, vap);
|
||||
fao = (struct fuse_attr_out *)fdi.answ;
|
||||
fuse_internal_cache_attrs(vp, &fao->attr, fao->attr_valid,
|
||||
fao->attr_valid_nsec, vap);
|
||||
if (vap->va_type != vnode_vtype(vp)) {
|
||||
fuse_internal_vnode_disappear(vp);
|
||||
err = ENOENT;
|
||||
@ -975,11 +978,17 @@ calldaemon:
|
||||
}
|
||||
|
||||
if (op == FUSE_GETATTR) {
|
||||
cache_attrs(*vpp, (struct fuse_attr_out *)fdi.answ,
|
||||
NULL);
|
||||
struct fuse_attr_out *fao =
|
||||
(struct fuse_attr_out*)fdi.answ;
|
||||
fuse_internal_cache_attrs(*vpp,
|
||||
&fao->attr, fao->attr_valid,
|
||||
fao->attr_valid_nsec, NULL);
|
||||
} else {
|
||||
cache_attrs(*vpp, (struct fuse_entry_out *)fdi.answ,
|
||||
NULL);
|
||||
struct fuse_entry_out *feo =
|
||||
(struct fuse_entry_out*)fdi.answ;
|
||||
fuse_internal_cache_attrs(*vpp,
|
||||
&feo->attr, feo->attr_valid,
|
||||
feo->attr_valid_nsec, NULL);
|
||||
}
|
||||
|
||||
/* Insert name into cache if appropriate. */
|
||||
@ -1636,8 +1645,11 @@ fuse_vnop_setattr(struct vop_setattr_args *ap)
|
||||
err = EAGAIN;
|
||||
}
|
||||
}
|
||||
if (err == 0)
|
||||
cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, NULL);
|
||||
if (err == 0) {
|
||||
struct fuse_attr_out *fao = (struct fuse_attr_out*)fdi.answ;
|
||||
fuse_internal_cache_attrs(vp, &fao->attr, fao->attr_valid,
|
||||
fao->attr_valid_nsec, NULL);
|
||||
}
|
||||
|
||||
out:
|
||||
fdisp_destroy(&fdi);
|
||||
|
Loading…
x
Reference in New Issue
Block a user