Commit f03a0682 authored by Nathan Scott's avatar Nathan Scott Committed by Christoph Hellwig

[XFS] Minor formatting and code consistency cleanups.

SGI Modid: 2.5.x-xfs:slinx:133828a
parent a1aed524
......@@ -35,7 +35,6 @@
uint64_t vn_generation; /* vnode generation number */
spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
/*
......@@ -59,9 +58,6 @@ u_short vttoif_tab[] = {
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, 0, S_IFSOCK
};
#define VN_LOCK(vp) spin_lock(&(vp)->v_lock)
#define VN_UNLOCK(vp) spin_unlock(&(vp)->v_lock)
void
vn_init(void)
......@@ -73,7 +69,6 @@ vn_init(void)
init_sv(svp, SV_DEFAULT, "vsy", i);
}
/*
* Clean a vnode of filesystem-specific data and prepare it for reuse.
*/
......@@ -98,7 +93,6 @@ vn_reclaim(struct vnode *vp)
ASSERT(vp->v_fbhv == NULL);
VN_LOCK(vp);
vp->v_flag &= (VRECLM|VWAIT);
VN_UNLOCK(vp);
......@@ -189,7 +183,7 @@ vn_get(struct vnode *vp, vmap_t *vmap)
}
/*
* "revalidate" the linux inode.
* Revalidate the Linux inode from the vnode.
*/
int
vn_revalidate(struct vnode *vp)
......@@ -199,17 +193,12 @@ vn_revalidate(struct vnode *vp)
vattr_t va;
vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
ASSERT(vp->v_fbhv != NULL);
va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT;
ASSERT(vp->v_bh.bh_first != NULL);
VOP_GETATTR(vp, &va, 0, NULL, error);
if (! error) {
if (!error) {
inode = LINVFS_GET_IP(vp);
ASSERT(inode);
inode->i_mode = VTTOIF(va.va_type) | va.va_mode;
inode->i_nlink = va.va_nlink;
inode->i_uid = va.va_uid;
......@@ -224,11 +213,9 @@ vn_revalidate(struct vnode *vp)
inode->i_atime.tv_nsec = va.va_atime.tv_nsec;
VUNMODIFY(vp);
}
return -error;
}
/*
* purge a vnode from the cache
* At this point the vnode is guaranteed to have no references (vn_count == 0)
......@@ -317,12 +304,10 @@ void
vn_rele(struct vnode *vp)
{
int vcnt;
/* REFERENCED */
int cache;
XFS_STATS_INC(xfsstats.vn_rele);
VN_LOCK(vp);
vn_trace_entry(vp, "vn_rele", (inst_t *)__return_address);
......@@ -365,7 +350,6 @@ vn_rele(struct vnode *vp)
vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
}
/*
* Finish the removal of a vnode.
*/
......
......@@ -32,6 +32,12 @@
#ifndef __XFS_VNODE_H__
#define __XFS_VNODE_H__
struct uio;
struct file;
struct vattr;
struct page_buf_bmap_s;
struct attrlist_cursor_kern;
/*
* Vnode types (unrelated to on-disk inodes). VNON means no type.
*/
......@@ -47,12 +53,9 @@ typedef enum vtype {
VSOCK = 8
} vtype_t;
typedef __u64 vnumber_t;
/*
* Define the type of behavior head used by vnodes.
*/
#define vn_bhv_head_t bhv_head_t
typedef xfs_ino_t vnumber_t;
typedef struct dentry vname_t;
typedef bhv_head_t vn_bhv_head_t;
/*
* MP locking protocols:
......@@ -62,17 +65,49 @@ typedef __u64 vnumber_t;
typedef struct vnode {
__u32 v_flag; /* vnode flags (see below) */
enum vtype v_type; /* vnode type */
struct vfs *v_vfsp; /* ptr to containing VFS*/
struct vfs *v_vfsp; /* ptr to containing VFS */
vnumber_t v_number; /* in-core vnode number */
vn_bhv_head_t v_bh; /* behavior head */
spinlock_t v_lock; /* don't use VLOCK on Linux */
struct inode v_inode; /* linux inode */
spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
struct inode v_inode; /* Linux inode */
#ifdef CONFIG_XFS_VNODE_TRACING
struct ktrace *v_trace; /* trace header structure */
#endif
} vnode_t;
#define v_fbhv v_bh.bh_first /* first behavior */
#define v_fops v_bh.bh_first->bd_ops /* first behavior ops */
#define VNODE_POSITION_BASE BHV_POSITION_BASE /* chain bottom */
#define VNODE_POSITION_TOP BHV_POSITION_TOP /* chain top */
#define VNODE_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */
typedef enum {
VN_BHV_UNKNOWN, /* not specified */
VN_BHV_XFS, /* xfs */
VN_BHV_END /* housekeeping end-of-range */
} vn_bhv_t;
#define VNODE_POSITION_XFS (VNODE_POSITION_BASE)
/*
* Macros for dealing with the behavior descriptor inside of the vnode.
*/
#define BHV_TO_VNODE(bdp) ((vnode_t *)BHV_VOBJ(bdp))
#define BHV_TO_VNODE_NULL(bdp) ((vnode_t *)BHV_VOBJNULL(bdp))
#define VNODE_TO_FIRST_BHV(vp) (BHV_HEAD_FIRST(&(vp)->v_bh))
#define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh)))
#define VN_BHV_READ_LOCK(bhp) BHV_READ_LOCK(bhp)
#define VN_BHV_READ_UNLOCK(bhp) BHV_READ_UNLOCK(bhp)
#define VN_BHV_WRITE_LOCK(bhp) BHV_WRITE_LOCK(bhp)
#define VN_BHV_NOT_READ_LOCKED(bhp) BHV_NOT_READ_LOCKED(bhp)
#define VN_BHV_NOT_WRITE_LOCKED(bhp) BHV_NOT_WRITE_LOCKED(bhp)
#define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name)
#define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp)
#define vn_bhv_lookup(bhp,ops) bhv_lookup(bhp,ops)
#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
/*
* Vnode to Linux inode mapping.
*/
......@@ -91,23 +126,12 @@ extern ushort vttoif_tab[];
/*
* Vnode flags.
*
* The vnode flags fall into two categories:
* 1) Local only -
* Flags that are relevant only to a particular cell
* 2) Single system image -
* Flags that must be maintained coherent across all cells
*/
/* Local only flags */
#define VINACT 0x1 /* vnode is being inactivated */
#define VRECLM 0x2 /* vnode is being reclaimed */
#define VWAIT 0x4 /* waiting for VINACT
or VRECLM to finish */
#define VMODIFIED 0x8 /* xfs inode state possibly different
* from linux inode state.
*/
/* Single system image flags */
#define VWAIT 0x4 /* waiting for VINACT/VRECLM to end */
#define VMODIFIED 0x8 /* XFS inode state possibly differs */
/* to the Linux inode state. */
#define VROOT 0x100000 /* root of its file system */
#define VNOSWAP 0x200000 /* cannot be used as virt swap device */
#define VISSWAP 0x400000 /* vnode is part of virt swap device */
......@@ -115,7 +139,6 @@ extern ushort vttoif_tab[];
#define VNONREPLICABLE 0x1000000 /* Vnode has writers. Don't replicate */
#define VDOCMP 0x2000000 /* Vnode has special VOP_CMP impl. */
#define VSHARE 0x4000000 /* vnode part of global cache */
/* VSHARE applies to local cell only */
#define VFRLOCKS 0x8000000 /* vnode has FR locks applied */
#define VENF_LOCKING 0x10000000 /* enf. mode FR locking in effect */
#define VOPLOCK 0x20000000 /* oplock set on the vnode */
......@@ -143,35 +166,6 @@ typedef enum vchange {
VCHANGE_FLAGS_IOEXCL_COUNT = 4
} vchange_t;
/*
* Macros for dealing with the behavior descriptor inside of the vnode.
*/
#define BHV_TO_VNODE(bdp) ((vnode_t *)BHV_VOBJ(bdp))
#define BHV_TO_VNODE_NULL(bdp) ((vnode_t *)BHV_VOBJNULL(bdp))
#define VNODE_TO_FIRST_BHV(vp) (BHV_HEAD_FIRST(&(vp)->v_bh))
#define VN_BHV_HEAD(vp) ((vn_bhv_head_t *)(&((vp)->v_bh)))
#define VN_BHV_READ_LOCK(bhp) BHV_READ_LOCK(bhp)
#define VN_BHV_READ_UNLOCK(bhp) BHV_READ_UNLOCK(bhp)
#define VN_BHV_WRITE_LOCK(bhp) BHV_WRITE_LOCK(bhp)
#define VN_BHV_NOT_READ_LOCKED(bhp) BHV_NOT_READ_LOCKED(bhp)
#define VN_BHV_NOT_WRITE_LOCKED(bhp) BHV_NOT_WRITE_LOCKED(bhp)
#define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name)
#define vn_bhv_head_reinit(bhp) bhv_head_reinit(bhp)
#define vn_bhv_insert_initial(bhp,bdp) bhv_insert_initial(bhp,bdp)
#define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp)
#define vn_bhv_lookup(bhp,ops) bhv_lookup(bhp,ops)
#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
#define v_fbhv v_bh.bh_first /* first behavior */
#define v_fops v_bh.bh_first->bd_ops /* ops for first behavior */
struct uio;
struct file;
struct vattr;
struct page_buf_bmap_s;
struct attrlist_cursor_kern;
typedef int (*vop_open_t)(bhv_desc_t *, struct cred *);
typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct file *,
......@@ -183,37 +177,39 @@ typedef ssize_t (*vop_write_t)(bhv_desc_t *, struct file *,
typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *,
loff_t *, size_t, read_actor_t,
void *, struct cred *);
typedef int (*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *, unsigned int, unsigned long);
typedef int (*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *,
unsigned int, unsigned long);
typedef int (*vop_getattr_t)(bhv_desc_t *, struct vattr *, int,
struct cred *);
typedef int (*vop_setattr_t)(bhv_desc_t *, struct vattr *, int,
struct cred *);
typedef int (*vop_access_t)(bhv_desc_t *, int, struct cred *);
typedef int (*vop_lookup_t)(bhv_desc_t *, struct dentry *, vnode_t **,
typedef int (*vop_lookup_t)(bhv_desc_t *, vname_t *, vnode_t **,
int, vnode_t *, struct cred *);
typedef int (*vop_create_t)(bhv_desc_t *, struct dentry *, struct vattr *,
typedef int (*vop_create_t)(bhv_desc_t *, vname_t *, struct vattr *,
vnode_t **, struct cred *);
typedef int (*vop_remove_t)(bhv_desc_t *, struct dentry *, struct cred *);
typedef int (*vop_link_t)(bhv_desc_t *, vnode_t *, struct dentry *,
typedef int (*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *);
typedef int (*vop_link_t)(bhv_desc_t *, vnode_t *, vname_t *,
struct cred *);
typedef int (*vop_rename_t)(bhv_desc_t *, vname_t *, vnode_t *, vname_t *,
struct cred *);
typedef int (*vop_rename_t)(bhv_desc_t *, struct dentry *, vnode_t *,
struct dentry *, struct cred *);
typedef int (*vop_mkdir_t)(bhv_desc_t *, struct dentry *, struct vattr *,
typedef int (*vop_mkdir_t)(bhv_desc_t *, vname_t *, struct vattr *,
vnode_t **, struct cred *);
typedef int (*vop_rmdir_t)(bhv_desc_t *, struct dentry *, struct cred *);
typedef int (*vop_rmdir_t)(bhv_desc_t *, vname_t *, struct cred *);
typedef int (*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *,
int *);
typedef int (*vop_symlink_t)(bhv_desc_t *, struct dentry *,
struct vattr *, char *,
vnode_t **, struct cred *);
typedef int (*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *,
char *, vnode_t **, struct cred *);
typedef int (*vop_readlink_t)(bhv_desc_t *, struct uio *, struct cred *);
typedef int (*vop_fsync_t)(bhv_desc_t *, int, struct cred *, xfs_off_t, xfs_off_t);
typedef int (*vop_fsync_t)(bhv_desc_t *, int, struct cred *,
xfs_off_t, xfs_off_t);
typedef int (*vop_inactive_t)(bhv_desc_t *, struct cred *);
typedef int (*vop_fid2_t)(bhv_desc_t *, struct fid *);
typedef int (*vop_release_t)(bhv_desc_t *);
typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
typedef void (*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t);
typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int, struct page_buf_bmap_s *, int *);
typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
struct page_buf_bmap_s *, int *);
typedef int (*vop_reclaim_t)(bhv_desc_t *);
typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
struct cred *);
......@@ -226,7 +222,8 @@ typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int);
typedef void (*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t);
typedef void (*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
typedef void (*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
typedef int (*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
typedef int (*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t,
uint64_t, int);
typedef int (*vop_iflush_t)(bhv_desc_t *, int);
......@@ -676,9 +673,17 @@ extern void vn_rele(struct vnode *);
#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING) */
/*
* Vname handling macros.
*/
#define VNAME(dentry) ((char *) (dentry)->d_name.name)
#define VNAMELEN(dentry) ((dentry)->d_name.len)
/*
* Vnode spinlock manipulation.
*/
#define VN_LOCK(vp) spin_lock(&(vp)->v_lock)
#define VN_UNLOCK(vp) spin_unlock(&(vp)->v_lock)
#define VN_FLAGSET(vp,b) vn_flagset(vp,b)
#define VN_FLAGCLR(vp,b) vn_flagclr(vp,b)
......
......@@ -78,8 +78,8 @@ STATIC int
xfs_lock_for_rename(
xfs_inode_t *dp1, /* old (source) directory inode */
xfs_inode_t *dp2, /* new (target) directory inode */
struct dentry *dentry1, /* old entry name */
struct dentry *dentry2, /* new entry name */
vname_t *dentry1, /* old entry name */
vname_t *dentry2, /* new entry name */
xfs_inode_t **ipp1, /* inode of old entry */
xfs_inode_t **ipp2, /* inode of new entry, if it
already exists, NULL otherwise. */
......@@ -224,9 +224,9 @@ int xfs_renames;
int
xfs_rename(
bhv_desc_t *src_dir_bdp,
struct dentry *src_dentry,
vname_t *src_dentry,
vnode_t *target_dir_vp,
struct dentry *target_dentry,
vname_t *target_dentry,
cred_t *credp)
{
xfs_trans_t *tp;
......@@ -246,8 +246,8 @@ xfs_rename(
int spaceres;
int target_link_zero = 0;
int num_inodes;
char *src_name = (char *)src_dentry->d_name.name;
char *target_name = (char *)target_dentry->d_name.name;
char *src_name = VNAME(src_dentry);
char *target_name = VNAME(target_dentry);
int src_namelen;
int target_namelen;
#ifdef DEBUG
......@@ -268,10 +268,10 @@ xfs_rename(
if (target_dir_bdp == NULL) {
return XFS_ERROR(EXDEV);
}
src_namelen = src_dentry->d_name.len;
src_namelen = VNAMELEN(src_dentry);
if (src_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
target_namelen = target_dentry->d_name.len;
target_namelen = VNAMELEN(target_dentry);
if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
src_dp = XFS_BHVTOI(src_dir_bdp);
......
......@@ -45,7 +45,7 @@ struct xfsstats xfsstats;
*/
int
xfs_get_dir_entry(
struct dentry *dentry,
vname_t *dentry,
xfs_inode_t **ipp)
{
vnode_t *vp;
......@@ -68,7 +68,7 @@ int
xfs_dir_lookup_int(
bhv_desc_t *dir_bdp,
uint lock_mode,
struct dentry *dentry,
vname_t *dentry,
xfs_ino_t *inum,
xfs_inode_t **ipp)
{
......@@ -77,13 +77,12 @@ xfs_dir_lookup_int(
int error;
dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, "xfs_dir_lookup_int",
(inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp);
error = XFS_DIR_LOOKUP(dp->i_mount, NULL, dp,
(char *)dentry->d_name.name, dentry->d_name.len, inum);
VNAME(dentry), VNAMELEN(dentry), inum);
if (!error) {
/*
* Unlock the directory. We do this because we can't
......
......@@ -37,66 +37,16 @@
#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \
(inst_t *)__return_address)
struct bhv_desc;
struct cred;
struct vnode;
struct xfs_inode;
struct xfs_mount;
struct xfs_trans;
extern int
xfs_rename(
struct bhv_desc *src_dir_bdp,
struct dentry *src_dentry,
struct vnode *target_dir_vp,
struct dentry *target_dentry,
struct cred *credp);
extern int
xfs_get_dir_entry(
struct dentry *dentry,
xfs_inode_t **ipp);
extern int
xfs_dir_lookup_int(
struct bhv_desc *dir_bdp,
uint lock_mode,
struct dentry *dentry,
xfs_ino_t *inum,
struct xfs_inode **ipp);
extern int
xfs_truncate_file(
struct xfs_mount *mp,
struct xfs_inode *ip);
extern int
xfs_dir_ialloc(
struct xfs_trans **tpp,
struct xfs_inode *dp,
mode_t mode,
nlink_t nlink,
xfs_dev_t rdev,
struct cred *credp,
prid_t prid,
int okalloc,
struct xfs_inode **ipp,
int *committed);
extern int
xfs_droplink(
struct xfs_trans *tp,
struct xfs_inode *ip);
extern int
xfs_bumplink(
struct xfs_trans *tp,
struct xfs_inode *ip);
extern void
xfs_bump_ino_vers2(
struct xfs_trans *tp,
struct xfs_inode *ip);
#endif /* XFS_UTILS_H */
extern int xfs_rename (bhv_desc_t *, vname_t *, vnode_t *, vname_t *, cred_t *);
extern int xfs_get_dir_entry (vname_t *, xfs_inode_t **);
extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *,
xfs_inode_t **);
extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, nlink_t,
xfs_dev_t, cred_t *, prid_t, int,
xfs_inode_t **, int *);
extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *);
extern int xfs_bumplink (xfs_trans_t *, xfs_inode_t *);
extern void xfs_bump_ino_vers2 (xfs_trans_t *, xfs_inode_t *);
#endif /* __XFS_UTILS_H__ */
......@@ -60,7 +60,6 @@ xfs_ctrunc_trace(
* fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively,
* when a new vnode is first looked up or created.
*/
/*ARGSUSED*/
STATIC int
xfs_open(
bhv_desc_t *bdp,
......@@ -92,7 +91,6 @@ xfs_open(
/*
* xfs_getattr
*/
/*ARGSUSED*/
int
xfs_getattr(
bhv_desc_t *bdp,
......@@ -105,8 +103,7 @@ xfs_getattr(
vnode_t *vp;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, "xfs_getattr", (inst_t *)__return_address);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
mp = ip->i_mount;
......@@ -284,12 +281,12 @@ xfs_setattr(
int privileged;
int mandlock_before, mandlock_after;
uint qflags;
struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
xfs_dquot_t *udqp, *gdqp, *olddquot1, *olddquot2;
int file_owner;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_setattr", (inst_t *)__return_address);
/*
* Cannot set certain attributes.
*/
......@@ -914,14 +911,13 @@ xfs_setattr(
xfs_iunlock(ip, lock_flags);
}
return code;
} /* xfs_setattr */
}
/*
* xfs_access
* Null conversion from vnode mode bits to inode mode bits, as in efs.
*/
/*ARGSUSED*/
STATIC int
xfs_access(
bhv_desc_t *bdp,
......@@ -931,7 +927,7 @@ xfs_access(
xfs_inode_t *ip;
int error;
vn_trace_entry(BHV_TO_VNODE(bdp), "xfs_access",
vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__,
(inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
......@@ -946,7 +942,6 @@ xfs_access(
* xfs_readlink
*
*/
/*ARGSUSED*/
STATIC int
xfs_readlink(
bhv_desc_t *bdp,
......@@ -968,8 +963,7 @@ xfs_readlink(
xfs_buf_t *bp;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, "xfs_readlink", (inst_t *)__return_address);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
mp = ip->i_mount;
......@@ -1049,6 +1043,7 @@ xfs_readlink(
return error;
}
/*
* xfs_fsync
*
......@@ -1058,7 +1053,6 @@ xfs_readlink(
* be held while flushing the data, so acquire after we're done
* with that.
*/
/*ARGSUSED*/
STATIC int
xfs_fsync(
bhv_desc_t *bdp,
......@@ -1069,16 +1063,13 @@ xfs_fsync(
{
xfs_inode_t *ip;
int error;
/* REFERENCED */
int error2;
/* REFERENCED */
int syncall;
vnode_t *vp;
xfs_trans_t *tp;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, "xfs_fsync", (inst_t *)__return_address);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
......@@ -1528,6 +1519,7 @@ xfs_inactive_symlink_local(
xfs_trans_t **tpp)
{
int error;
ASSERT(ip->i_d.di_size <= XFS_IFORK_DSIZE(ip));
/*
* We're freeing a symlink which fit into
......@@ -1610,7 +1602,6 @@ xfs_inactive_attrs(
return (0);
}
/*ARGSUSED*/
STATIC int
xfs_release(
bhv_desc_t *bdp)
......@@ -1657,14 +1648,12 @@ xfs_release(
* now be truncated. Also, we clear all of the read-ahead state
* kept for the inode here since the file is now closed.
*/
/*ARGSUSED*/
STATIC int
xfs_inactive(
bhv_desc_t *bdp,
cred_t *credp)
{
xfs_inode_t *ip;
/* REFERENCED */
vnode_t *vp;
xfs_trans_t *tp;
xfs_mount_t *mp;
......@@ -1673,8 +1662,7 @@ xfs_inactive(
int truncate;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, "xfs_inactive", (inst_t *)__return_address);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
......@@ -1882,11 +1870,10 @@ xfs_inactive(
/*
* xfs_lookup
*/
/*ARGSUSED*/
STATIC int
xfs_lookup(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
vnode_t **vpp,
int flags,
vnode_t *rdir,
......@@ -1900,8 +1887,7 @@ xfs_lookup(
vnode_t *dir_vp;
dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, "xfs_lookup", (inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp);
......@@ -1966,12 +1952,12 @@ xfs_ctrunc_trace(
STATIC int
xfs_create(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
vattr_t *vap,
vnode_t **vpp,
cred_t *credp)
{
char *name = (char *)dentry->d_name.name;
char *name = VNAME(dentry);
vnode_t *dir_vp;
xfs_inode_t *dp, *ip;
vnode_t *vp=NULL;
......@@ -1986,19 +1972,19 @@ xfs_create(
uint cancel_flags;
int committed;
xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp;
xfs_dquot_t *udqp, *gdqp;
uint resblks;
int dm_di_mode;
int namelen;
ASSERT(!*vpp);
dir_vp = BHV_TO_VNODE(dir_bdp);
dp = XFS_BHVTOI(dir_bdp);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(dir_vp, "xfs_create", (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp);
dm_di_mode = vap->va_mode|VTTOIF(vap->va_type);
namelen = dentry->d_name.len;
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
......@@ -2222,7 +2208,6 @@ xfs_create(
}
#ifdef DEBUG
/*
* Some counters to see if (and how often) we are hitting some deadlock
* prevention code paths.
......@@ -2263,7 +2248,7 @@ int xfs_rm_attempts;
STATIC int
xfs_lock_dir_and_entry(
xfs_inode_t *dp,
struct dentry *dentry,
vname_t *dentry,
xfs_inode_t *ip, /* inode of entry 'name' */
int *entry_changed)
{
......@@ -2359,7 +2344,8 @@ int xfs_lock_delays;
* in the log.
*/
void
xfs_lock_inodes (xfs_inode_t **ips,
xfs_lock_inodes(
xfs_inode_t **ips,
int inodes,
int first_locked,
uint lock_mode)
......@@ -2470,6 +2456,7 @@ int remove_which_error_return = 0;
#define REMOVE_DEBUG_TRACE(x)
#endif /* ! DEBUG */
/*
* xfs_remove
*
......@@ -2477,11 +2464,11 @@ int remove_which_error_return = 0;
STATIC int
xfs_remove(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
cred_t *credp)
{
vnode_t *dir_vp;
char *name = (char *) dentry->d_name.name;
char *name = VNAME(dentry);
xfs_inode_t *dp, *ip;
xfs_trans_t *tp = NULL;
xfs_mount_t *mp;
......@@ -2495,11 +2482,9 @@ xfs_remove(
int link_zero;
uint resblks;
int namelen;
/* bhv_desc_t *bdp; */
dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, "xfs_remove", (inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp);
mp = dp->i_mount;
......@@ -2507,7 +2492,7 @@ xfs_remove(
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
namelen = dentry->d_name.len;
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
......@@ -2542,7 +2527,7 @@ xfs_remove(
dm_di_mode = ip->i_d.di_mode;
vn_trace_entry(XFS_ITOV(ip), "xfs_remove", (inst_t *)__return_address);
vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
ITRACE(ip);
......@@ -2701,8 +2686,7 @@ xfs_remove(
goto std_return;
}
vn_trace_exit(XFS_ITOV(ip), "xfs_remove",
(inst_t *)__return_address);
vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
/*
* Let interposed file systems know about removed links.
......@@ -2756,7 +2740,7 @@ STATIC int
xfs_link(
bhv_desc_t *target_dir_bdp,
vnode_t *src_vp,
struct dentry *dentry,
vname_t *dentry,
cred_t *credp)
{
xfs_inode_t *tdp, *sip;
......@@ -2771,18 +2755,18 @@ xfs_link(
vnode_t *target_dir_vp;
bhv_desc_t *src_bdp;
int resblks;
char *target_name = (char *)dentry->d_name.name;
char *target_name = VNAME(dentry);
int target_namelen;
target_dir_vp = BHV_TO_VNODE(target_dir_bdp);
vn_trace_entry(target_dir_vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(target_dir_vp, "xfs_link", (inst_t *)__return_address);
target_namelen = dentry->d_name.len;
target_namelen = VNAMELEN(dentry);
if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
vn_trace_entry(src_vp, "xfs_link", (inst_t *)__return_address);
if (src_vp->v_type == VDIR)
return XFS_ERROR(EPERM);
/*
* For now, manually find the XFS behavior descriptor for
......@@ -2927,8 +2911,6 @@ xfs_link(
}
/*
* xfs_mkdir
*
......@@ -2936,12 +2918,12 @@ xfs_link(
STATIC int
xfs_mkdir(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
vattr_t *vap,
vnode_t **vpp,
cred_t *credp)
{
char *dir_name = (char *)dentry->d_name.name;
char *dir_name = VNAME(dentry);
xfs_inode_t *dp;
xfs_inode_t *cdp; /* inode of created dir */
vnode_t *cvp; /* vnode of created dir */
......@@ -2958,7 +2940,7 @@ xfs_mkdir(
boolean_t created = B_FALSE;
int dm_event_sent = 0;
xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp;
xfs_dquot_t *udqp, *gdqp;
uint resblks;
int dm_di_mode;
int dir_namelen;
......@@ -2970,7 +2952,7 @@ xfs_mkdir(
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
dir_namelen = dentry->d_name.len;
dir_namelen = VNAMELEN(dentry);
if (dir_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
......@@ -2987,7 +2969,7 @@ xfs_mkdir(
/* Return through std_return after this point. */
vn_trace_entry(dir_vp, "xfs_mkdir", (inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
mp = dp->i_mount;
udqp = gdqp = NULL;
......@@ -3185,15 +3167,14 @@ xfs_mkdir(
STATIC int
xfs_rmdir(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
cred_t *credp)
{
char *name = (char *)dentry->d_name.name;
char *name = VNAME(dentry);
xfs_inode_t *dp;
xfs_inode_t *cdp; /* child directory */
xfs_trans_t *tp;
xfs_mount_t *mp;
/* bhv_desc_t *bdp;*/
int error;
xfs_bmap_free_t free_list;
xfs_fsblock_t first_block;
......@@ -3209,11 +3190,11 @@ xfs_rmdir(
dir_vp = BHV_TO_VNODE(dir_bdp);
dp = XFS_BHVTOI(dir_bdp);
vn_trace_entry(dir_vp, "xfs_rmdir", (inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
if (XFS_FORCED_SHUTDOWN(XFS_BHVTOI(dir_bdp)->i_mount))
return XFS_ERROR(EIO);
namelen = dentry->d_name.len;
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
......@@ -3446,14 +3427,12 @@ xfs_rmdir(
}
/*
* xfs_readdir
*
* Read dp's entries starting at uiop->uio_offset and translate them into
* bufsize bytes worth of struct dirents starting at bufbase.
*/
/*ARGSUSED*/
STATIC int
xfs_readdir(
bhv_desc_t *dir_bdp,
......@@ -3467,7 +3446,7 @@ xfs_readdir(
uint lock_mode;
xfs_off_t start_offset;
vn_trace_entry(BHV_TO_VNODE(dir_bdp), "xfs_readdir",
vn_trace_entry(BHV_TO_VNODE(dir_bdp), __FUNCTION__,
(inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp);
......@@ -3493,6 +3472,7 @@ xfs_readdir(
return error;
}
/*
* xfs_symlink
*
......@@ -3500,7 +3480,7 @@ xfs_readdir(
STATIC int
xfs_symlink(
bhv_desc_t *dir_bdp,
struct dentry *dentry,
vname_t *dentry,
vattr_t *vap,
char *target_path,
vnode_t **vpp,
......@@ -3529,9 +3509,9 @@ xfs_symlink(
int n;
xfs_buf_t *bp;
xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp;
xfs_dquot_t *udqp, *gdqp;
uint resblks;
char *link_name = (char *)dentry->d_name.name;
char *link_name = VNAME(dentry);
int link_namelen;
*vpp = NULL;
......@@ -3542,14 +3522,14 @@ xfs_symlink(
ip = NULL;
tp = NULL;
vn_trace_entry(dir_vp, "xfs_symlink", (inst_t *)__return_address);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
mp = dp->i_mount;
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
link_namelen = dentry->d_name.len;
link_namelen = VNAMELEN(dentry);
if (link_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
/*
......@@ -3841,7 +3821,7 @@ xfs_fid2(
xfs_inode_t *ip;
xfs_fid2_t *xfid;
vn_trace_entry(BHV_TO_VNODE(bdp), "xfs_fid2",
vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__,
(inst_t *)__return_address);
ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
......@@ -3917,7 +3897,8 @@ xfs_rwunlock(
}
STATIC int
xfs_inode_flush(bhv_desc_t *bdp,
xfs_inode_flush(
bhv_desc_t *bdp,
int flags)
{
xfs_inode_t *ip;
......@@ -4063,7 +4044,7 @@ xfs_reclaim(
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, "xfs_reclaim", (inst_t *)__return_address);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
ASSERT(!VN_MAPPED(vp));
ip = XFS_BHVTOI(bdp);
......@@ -4251,8 +4232,7 @@ xfs_alloc_file_space(
xfs_trans_t *tp;
int xfs_bmapi_flags;
vn_trace_entry(XFS_ITOV(ip), "xfs_alloc_file_space",
(inst_t *)__return_address);
vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
mp = ip->i_mount;
if (XFS_FORCED_SHUTDOWN(mp))
......@@ -4410,7 +4390,7 @@ xfs_alloc_file_space(
NULL, NULL, 0, 0, 0); /* Delay flag intentionally unused */
if (error == 0)
goto retry; /* Maybe DMAPI app. has made space */
/* else fall through with error = xfs_dm_send_data_event result. */
/* else fall through with error from xfs_dm_send_data_event */
}
return error;
......@@ -4534,8 +4514,7 @@ xfs_free_file_space(
xfs_fileoff_t startoffset_fsb;
xfs_trans_t *tp;
vn_trace_entry(XFS_ITOV(ip), "xfs_free_file_space",
(inst_t *)__return_address);
vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
mp = ip->i_mount;
if (XFS_IS_QUOTA_ON(mp)) {
......@@ -4738,9 +4717,8 @@ xfs_change_file_space(
vnode_t *vp;
vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_change_file_space",
(inst_t *)__return_address);
ip = XFS_BHVTOI(bdp);
mp = ip->i_mount;
......@@ -4889,6 +4867,7 @@ xfs_change_file_space(
}
vnodeops_t xfs_vnodeops = {
BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
.vop_open = xfs_open,
.vop_read = xfs_read,
.vop_write = xfs_write,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment