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,8 +35,7 @@ ...@@ -35,8 +35,7 @@
uint64_t vn_generation; /* vnode generation number */ uint64_t vn_generation; /* vnode generation number */
spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
/* /*
* Dedicated vnode inactive/reclaim sync semaphores. * Dedicated vnode inactive/reclaim sync semaphores.
...@@ -59,9 +58,6 @@ u_short vttoif_tab[] = { ...@@ -59,9 +58,6 @@ u_short vttoif_tab[] = {
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, 0, S_IFSOCK 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 void
vn_init(void) vn_init(void)
...@@ -73,14 +69,13 @@ vn_init(void) ...@@ -73,14 +69,13 @@ vn_init(void)
init_sv(svp, SV_DEFAULT, "vsy", i); init_sv(svp, SV_DEFAULT, "vsy", i);
} }
/* /*
* Clean a vnode of filesystem-specific data and prepare it for reuse. * Clean a vnode of filesystem-specific data and prepare it for reuse.
*/ */
STATIC int STATIC int
vn_reclaim(struct vnode *vp) vn_reclaim(struct vnode *vp)
{ {
int error; int error;
XFS_STATS_INC(xfsstats.vn_reclaim); XFS_STATS_INC(xfsstats.vn_reclaim);
...@@ -98,7 +93,6 @@ vn_reclaim(struct vnode *vp) ...@@ -98,7 +93,6 @@ vn_reclaim(struct vnode *vp)
ASSERT(vp->v_fbhv == NULL); ASSERT(vp->v_fbhv == NULL);
VN_LOCK(vp); VN_LOCK(vp);
vp->v_flag &= (VRECLM|VWAIT); vp->v_flag &= (VRECLM|VWAIT);
VN_UNLOCK(vp); VN_UNLOCK(vp);
...@@ -189,7 +183,7 @@ vn_get(struct vnode *vp, vmap_t *vmap) ...@@ -189,7 +183,7 @@ vn_get(struct vnode *vp, vmap_t *vmap)
} }
/* /*
* "revalidate" the linux inode. * Revalidate the Linux inode from the vnode.
*/ */
int int
vn_revalidate(struct vnode *vp) vn_revalidate(struct vnode *vp)
...@@ -199,17 +193,12 @@ vn_revalidate(struct vnode *vp) ...@@ -199,17 +193,12 @@ vn_revalidate(struct vnode *vp)
vattr_t va; vattr_t va;
vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address); vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
ASSERT(vp->v_fbhv != NULL);
va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT; va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT;
ASSERT(vp->v_bh.bh_first != NULL);
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (!error) {
if (! error) {
inode = LINVFS_GET_IP(vp); inode = LINVFS_GET_IP(vp);
ASSERT(inode);
inode->i_mode = VTTOIF(va.va_type) | va.va_mode; inode->i_mode = VTTOIF(va.va_type) | va.va_mode;
inode->i_nlink = va.va_nlink; inode->i_nlink = va.va_nlink;
inode->i_uid = va.va_uid; inode->i_uid = va.va_uid;
...@@ -224,11 +213,9 @@ vn_revalidate(struct vnode *vp) ...@@ -224,11 +213,9 @@ vn_revalidate(struct vnode *vp)
inode->i_atime.tv_nsec = va.va_atime.tv_nsec; inode->i_atime.tv_nsec = va.va_atime.tv_nsec;
VUNMODIFY(vp); VUNMODIFY(vp);
} }
return -error; return -error;
} }
/* /*
* purge a vnode from the cache * purge a vnode from the cache
* At this point the vnode is guaranteed to have no references (vn_count == 0) * At this point the vnode is guaranteed to have no references (vn_count == 0)
...@@ -317,12 +304,10 @@ void ...@@ -317,12 +304,10 @@ void
vn_rele(struct vnode *vp) vn_rele(struct vnode *vp)
{ {
int vcnt; int vcnt;
/* REFERENCED */ int cache;
int cache;
XFS_STATS_INC(xfsstats.vn_rele); XFS_STATS_INC(xfsstats.vn_rele);
VN_LOCK(vp); VN_LOCK(vp);
vn_trace_entry(vp, "vn_rele", (inst_t *)__return_address); vn_trace_entry(vp, "vn_rele", (inst_t *)__return_address);
...@@ -365,7 +350,6 @@ vn_rele(struct vnode *vp) ...@@ -365,7 +350,6 @@ vn_rele(struct vnode *vp)
vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address); vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
} }
/* /*
* Finish the removal of a vnode. * Finish the removal of a vnode.
*/ */
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
#ifndef __XFS_VNODE_H__ #ifndef __XFS_VNODE_H__
#define __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. * Vnode types (unrelated to on-disk inodes). VNON means no type.
*/ */
...@@ -47,12 +53,9 @@ typedef enum vtype { ...@@ -47,12 +53,9 @@ typedef enum vtype {
VSOCK = 8 VSOCK = 8
} vtype_t; } vtype_t;
typedef __u64 vnumber_t; typedef xfs_ino_t vnumber_t;
typedef struct dentry vname_t;
/* typedef bhv_head_t vn_bhv_head_t;
* Define the type of behavior head used by vnodes.
*/
#define vn_bhv_head_t bhv_head_t
/* /*
* MP locking protocols: * MP locking protocols:
...@@ -61,18 +64,50 @@ typedef __u64 vnumber_t; ...@@ -61,18 +64,50 @@ typedef __u64 vnumber_t;
*/ */
typedef struct vnode { typedef struct vnode {
__u32 v_flag; /* vnode flags (see below) */ __u32 v_flag; /* vnode flags (see below) */
enum vtype v_type; /* vnode type */ 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 */ vnumber_t v_number; /* in-core vnode number */
vn_bhv_head_t v_bh; /* behavior head */ vn_bhv_head_t v_bh; /* behavior head */
spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
spinlock_t v_lock; /* don't use VLOCK on Linux */ struct inode v_inode; /* Linux inode */
struct inode v_inode; /* linux inode */
#ifdef CONFIG_XFS_VNODE_TRACING #ifdef CONFIG_XFS_VNODE_TRACING
struct ktrace *v_trace; /* trace header structure */ struct ktrace *v_trace; /* trace header structure */
#endif #endif
} vnode_t; } 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. * Vnode to Linux inode mapping.
*/ */
...@@ -91,23 +126,12 @@ extern ushort vttoif_tab[]; ...@@ -91,23 +126,12 @@ extern ushort vttoif_tab[];
/* /*
* Vnode flags. * 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 VINACT 0x1 /* vnode is being inactivated */
#define VRECLM 0x2 /* vnode is being reclaimed */ #define VRECLM 0x2 /* vnode is being reclaimed */
#define VWAIT 0x4 /* waiting for VINACT #define VWAIT 0x4 /* waiting for VINACT/VRECLM to end */
or VRECLM to finish */ #define VMODIFIED 0x8 /* XFS inode state possibly differs */
#define VMODIFIED 0x8 /* xfs inode state possibly different /* to the Linux inode state. */
* from linux inode state.
*/
/* Single system image flags */
#define VROOT 0x100000 /* root of its file system */ #define VROOT 0x100000 /* root of its file system */
#define VNOSWAP 0x200000 /* cannot be used as virt swap device */ #define VNOSWAP 0x200000 /* cannot be used as virt swap device */
#define VISSWAP 0x400000 /* vnode is part of virt swap device */ #define VISSWAP 0x400000 /* vnode is part of virt swap device */
...@@ -115,7 +139,6 @@ extern ushort vttoif_tab[]; ...@@ -115,7 +139,6 @@ extern ushort vttoif_tab[];
#define VNONREPLICABLE 0x1000000 /* Vnode has writers. Don't replicate */ #define VNONREPLICABLE 0x1000000 /* Vnode has writers. Don't replicate */
#define VDOCMP 0x2000000 /* Vnode has special VOP_CMP impl. */ #define VDOCMP 0x2000000 /* Vnode has special VOP_CMP impl. */
#define VSHARE 0x4000000 /* vnode part of global cache */ #define VSHARE 0x4000000 /* vnode part of global cache */
/* VSHARE applies to local cell only */
#define VFRLOCKS 0x8000000 /* vnode has FR locks applied */ #define VFRLOCKS 0x8000000 /* vnode has FR locks applied */
#define VENF_LOCKING 0x10000000 /* enf. mode FR locking in effect */ #define VENF_LOCKING 0x10000000 /* enf. mode FR locking in effect */
#define VOPLOCK 0x20000000 /* oplock set on the vnode */ #define VOPLOCK 0x20000000 /* oplock set on the vnode */
...@@ -143,35 +166,6 @@ typedef enum vchange { ...@@ -143,35 +166,6 @@ typedef enum vchange {
VCHANGE_FLAGS_IOEXCL_COUNT = 4 VCHANGE_FLAGS_IOEXCL_COUNT = 4
} vchange_t; } 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 int (*vop_open_t)(bhv_desc_t *, struct cred *);
typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct file *, 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 *, ...@@ -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 *, typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *,
loff_t *, size_t, read_actor_t, loff_t *, size_t, read_actor_t,
void *, struct cred *); 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, typedef int (*vop_getattr_t)(bhv_desc_t *, struct vattr *, int,
struct cred *); struct cred *);
typedef int (*vop_setattr_t)(bhv_desc_t *, struct vattr *, int, typedef int (*vop_setattr_t)(bhv_desc_t *, struct vattr *, int,
struct cred *); struct cred *);
typedef int (*vop_access_t)(bhv_desc_t *, 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 *); 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 *); vnode_t **, struct cred *);
typedef int (*vop_remove_t)(bhv_desc_t *, struct dentry *, struct cred *); typedef int (*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *);
typedef int (*vop_link_t)(bhv_desc_t *, vnode_t *, struct dentry *, typedef int (*vop_link_t)(bhv_desc_t *, vnode_t *, vname_t *,
struct cred *); struct cred *);
typedef int (*vop_rename_t)(bhv_desc_t *, struct dentry *, vnode_t *, typedef int (*vop_rename_t)(bhv_desc_t *, vname_t *, vnode_t *, vname_t *,
struct dentry *, struct cred *); 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 *); 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 *, typedef int (*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *,
int *); int *);
typedef int (*vop_symlink_t)(bhv_desc_t *, struct dentry *, typedef int (*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *,
struct vattr *, char *, char *, vnode_t **, struct cred *);
vnode_t **, struct cred *);
typedef int (*vop_readlink_t)(bhv_desc_t *, struct uio *, 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_inactive_t)(bhv_desc_t *, struct cred *);
typedef int (*vop_fid2_t)(bhv_desc_t *, struct fid *); typedef int (*vop_fid2_t)(bhv_desc_t *, struct fid *);
typedef int (*vop_release_t)(bhv_desc_t *); typedef int (*vop_release_t)(bhv_desc_t *);
typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t); typedef int (*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
typedef void (*vop_rwunlock_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_reclaim_t)(bhv_desc_t *);
typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int, typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
struct cred *); struct cred *);
...@@ -226,7 +222,8 @@ typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int); ...@@ -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_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_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 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); typedef int (*vop_iflush_t)(bhv_desc_t *, int);
...@@ -676,9 +673,17 @@ extern void vn_rele(struct vnode *); ...@@ -676,9 +673,17 @@ extern void vn_rele(struct vnode *);
#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING) */ #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. * 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_FLAGSET(vp,b) vn_flagset(vp,b)
#define VN_FLAGCLR(vp,b) vn_flagclr(vp,b) #define VN_FLAGCLR(vp,b) vn_flagclr(vp,b)
......
...@@ -78,8 +78,8 @@ STATIC int ...@@ -78,8 +78,8 @@ STATIC int
xfs_lock_for_rename( xfs_lock_for_rename(
xfs_inode_t *dp1, /* old (source) directory inode */ xfs_inode_t *dp1, /* old (source) directory inode */
xfs_inode_t *dp2, /* new (target) directory inode */ xfs_inode_t *dp2, /* new (target) directory inode */
struct dentry *dentry1, /* old entry name */ vname_t *dentry1, /* old entry name */
struct dentry *dentry2, /* new entry name */ vname_t *dentry2, /* new entry name */
xfs_inode_t **ipp1, /* inode of old entry */ xfs_inode_t **ipp1, /* inode of old entry */
xfs_inode_t **ipp2, /* inode of new entry, if it xfs_inode_t **ipp2, /* inode of new entry, if it
already exists, NULL otherwise. */ already exists, NULL otherwise. */
...@@ -224,9 +224,9 @@ int xfs_renames; ...@@ -224,9 +224,9 @@ int xfs_renames;
int int
xfs_rename( xfs_rename(
bhv_desc_t *src_dir_bdp, bhv_desc_t *src_dir_bdp,
struct dentry *src_dentry, vname_t *src_dentry,
vnode_t *target_dir_vp, vnode_t *target_dir_vp,
struct dentry *target_dentry, vname_t *target_dentry,
cred_t *credp) cred_t *credp)
{ {
xfs_trans_t *tp; xfs_trans_t *tp;
...@@ -246,8 +246,8 @@ xfs_rename( ...@@ -246,8 +246,8 @@ xfs_rename(
int spaceres; int spaceres;
int target_link_zero = 0; int target_link_zero = 0;
int num_inodes; int num_inodes;
char *src_name = (char *)src_dentry->d_name.name; char *src_name = VNAME(src_dentry);
char *target_name = (char *)target_dentry->d_name.name; char *target_name = VNAME(target_dentry);
int src_namelen; int src_namelen;
int target_namelen; int target_namelen;
#ifdef DEBUG #ifdef DEBUG
...@@ -268,10 +268,10 @@ xfs_rename( ...@@ -268,10 +268,10 @@ xfs_rename(
if (target_dir_bdp == NULL) { if (target_dir_bdp == NULL) {
return XFS_ERROR(EXDEV); return XFS_ERROR(EXDEV);
} }
src_namelen = src_dentry->d_name.len; src_namelen = VNAMELEN(src_dentry);
if (src_namelen >= MAXNAMELEN) if (src_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
target_namelen = target_dentry->d_name.len; target_namelen = VNAMELEN(target_dentry);
if (target_namelen >= MAXNAMELEN) if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
src_dp = XFS_BHVTOI(src_dir_bdp); src_dp = XFS_BHVTOI(src_dir_bdp);
......
...@@ -45,11 +45,11 @@ struct xfsstats xfsstats; ...@@ -45,11 +45,11 @@ struct xfsstats xfsstats;
*/ */
int int
xfs_get_dir_entry( xfs_get_dir_entry(
struct dentry *dentry, vname_t *dentry,
xfs_inode_t **ipp) xfs_inode_t **ipp)
{ {
vnode_t *vp; vnode_t *vp;
bhv_desc_t *bdp; bhv_desc_t *bdp;
ASSERT(dentry->d_inode); ASSERT(dentry->d_inode);
...@@ -66,24 +66,23 @@ xfs_get_dir_entry( ...@@ -66,24 +66,23 @@ xfs_get_dir_entry(
int int
xfs_dir_lookup_int( xfs_dir_lookup_int(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
uint lock_mode, uint lock_mode,
struct dentry *dentry, vname_t *dentry,
xfs_ino_t *inum, xfs_ino_t *inum,
xfs_inode_t **ipp) xfs_inode_t **ipp)
{ {
vnode_t *dir_vp; vnode_t *dir_vp;
xfs_inode_t *dp; xfs_inode_t *dp;
int error; int error;
dir_vp = BHV_TO_VNODE(dir_bdp); dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, "xfs_dir_lookup_int", vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
(inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp); dp = XFS_BHVTOI(dir_bdp);
error = XFS_DIR_LOOKUP(dp->i_mount, NULL, dp, 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) { if (!error) {
/* /*
* Unlock the directory. We do this because we can't * Unlock the directory. We do this because we can't
......
...@@ -37,66 +37,16 @@ ...@@ -37,66 +37,16 @@
#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ #define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \
(inst_t *)__return_address) (inst_t *)__return_address)
struct bhv_desc; extern int xfs_rename (bhv_desc_t *, vname_t *, vnode_t *, vname_t *, cred_t *);
struct cred; extern int xfs_get_dir_entry (vname_t *, xfs_inode_t **);
struct vnode; extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *,
struct xfs_inode; xfs_inode_t **);
struct xfs_mount; extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
struct xfs_trans; extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, nlink_t,
xfs_dev_t, cred_t *, prid_t, int,
extern int xfs_inode_t **, int *);
xfs_rename( extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *);
struct bhv_desc *src_dir_bdp, extern int xfs_bumplink (xfs_trans_t *, xfs_inode_t *);
struct dentry *src_dentry, extern void xfs_bump_ino_vers2 (xfs_trans_t *, xfs_inode_t *);
struct vnode *target_dir_vp,
struct dentry *target_dentry, #endif /* __XFS_UTILS_H__ */
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 */
...@@ -60,7 +60,6 @@ xfs_ctrunc_trace( ...@@ -60,7 +60,6 @@ xfs_ctrunc_trace(
* fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively, * fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively,
* when a new vnode is first looked up or created. * when a new vnode is first looked up or created.
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_open( xfs_open(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -92,7 +91,6 @@ xfs_open( ...@@ -92,7 +91,6 @@ xfs_open(
/* /*
* xfs_getattr * xfs_getattr
*/ */
/*ARGSUSED*/
int int
xfs_getattr( xfs_getattr(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -105,8 +103,7 @@ xfs_getattr( ...@@ -105,8 +103,7 @@ xfs_getattr(
vnode_t *vp; vnode_t *vp;
vp = BHV_TO_VNODE(bdp); vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_getattr", (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
mp = ip->i_mount; mp = ip->i_mount;
...@@ -284,12 +281,12 @@ xfs_setattr( ...@@ -284,12 +281,12 @@ xfs_setattr(
int privileged; int privileged;
int mandlock_before, mandlock_after; int mandlock_before, mandlock_after;
uint qflags; uint qflags;
struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; xfs_dquot_t *udqp, *gdqp, *olddquot1, *olddquot2;
int file_owner; int file_owner;
vp = BHV_TO_VNODE(bdp); 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. * Cannot set certain attributes.
*/ */
...@@ -914,14 +911,13 @@ xfs_setattr( ...@@ -914,14 +911,13 @@ xfs_setattr(
xfs_iunlock(ip, lock_flags); xfs_iunlock(ip, lock_flags);
} }
return code; return code;
} /* xfs_setattr */ }
/* /*
* xfs_access * xfs_access
* Null conversion from vnode mode bits to inode mode bits, as in efs. * Null conversion from vnode mode bits to inode mode bits, as in efs.
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_access( xfs_access(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -931,7 +927,7 @@ xfs_access( ...@@ -931,7 +927,7 @@ xfs_access(
xfs_inode_t *ip; xfs_inode_t *ip;
int error; int error;
vn_trace_entry(BHV_TO_VNODE(bdp), "xfs_access", vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__,
(inst_t *)__return_address); (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
...@@ -946,7 +942,6 @@ xfs_access( ...@@ -946,7 +942,6 @@ xfs_access(
* xfs_readlink * xfs_readlink
* *
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_readlink( xfs_readlink(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -968,8 +963,7 @@ xfs_readlink( ...@@ -968,8 +963,7 @@ xfs_readlink(
xfs_buf_t *bp; xfs_buf_t *bp;
vp = BHV_TO_VNODE(bdp); vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_readlink", (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
mp = ip->i_mount; mp = ip->i_mount;
...@@ -1049,6 +1043,7 @@ xfs_readlink( ...@@ -1049,6 +1043,7 @@ xfs_readlink(
return error; return error;
} }
/* /*
* xfs_fsync * xfs_fsync
* *
...@@ -1058,7 +1053,6 @@ xfs_readlink( ...@@ -1058,7 +1053,6 @@ xfs_readlink(
* be held while flushing the data, so acquire after we're done * be held while flushing the data, so acquire after we're done
* with that. * with that.
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_fsync( xfs_fsync(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -1069,16 +1063,13 @@ xfs_fsync( ...@@ -1069,16 +1063,13 @@ xfs_fsync(
{ {
xfs_inode_t *ip; xfs_inode_t *ip;
int error; int error;
/* REFERENCED */
int error2; int error2;
/* REFERENCED */
int syncall; int syncall;
vnode_t *vp; vnode_t *vp;
xfs_trans_t *tp; xfs_trans_t *tp;
vp = BHV_TO_VNODE(bdp); vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_fsync", (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
...@@ -1528,6 +1519,7 @@ xfs_inactive_symlink_local( ...@@ -1528,6 +1519,7 @@ xfs_inactive_symlink_local(
xfs_trans_t **tpp) xfs_trans_t **tpp)
{ {
int error; int error;
ASSERT(ip->i_d.di_size <= XFS_IFORK_DSIZE(ip)); ASSERT(ip->i_d.di_size <= XFS_IFORK_DSIZE(ip));
/* /*
* We're freeing a symlink which fit into * We're freeing a symlink which fit into
...@@ -1610,7 +1602,6 @@ xfs_inactive_attrs( ...@@ -1610,7 +1602,6 @@ xfs_inactive_attrs(
return (0); return (0);
} }
/*ARGSUSED*/
STATIC int STATIC int
xfs_release( xfs_release(
bhv_desc_t *bdp) bhv_desc_t *bdp)
...@@ -1657,14 +1648,12 @@ xfs_release( ...@@ -1657,14 +1648,12 @@ xfs_release(
* now be truncated. Also, we clear all of the read-ahead state * now be truncated. Also, we clear all of the read-ahead state
* kept for the inode here since the file is now closed. * kept for the inode here since the file is now closed.
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_inactive( xfs_inactive(
bhv_desc_t *bdp, bhv_desc_t *bdp,
cred_t *credp) cred_t *credp)
{ {
xfs_inode_t *ip; xfs_inode_t *ip;
/* REFERENCED */
vnode_t *vp; vnode_t *vp;
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -1673,8 +1662,7 @@ xfs_inactive( ...@@ -1673,8 +1662,7 @@ xfs_inactive(
int truncate; int truncate;
vp = BHV_TO_VNODE(bdp); vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(vp, "xfs_inactive", (inst_t *)__return_address);
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
...@@ -1882,15 +1870,14 @@ xfs_inactive( ...@@ -1882,15 +1870,14 @@ xfs_inactive(
/* /*
* xfs_lookup * xfs_lookup
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_lookup( xfs_lookup(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
vnode_t **vpp, vnode_t **vpp,
int flags, int flags,
vnode_t *rdir, vnode_t *rdir,
cred_t *credp) cred_t *credp)
{ {
xfs_inode_t *dp, *ip; xfs_inode_t *dp, *ip;
struct vnode *vp; struct vnode *vp;
...@@ -1900,8 +1887,7 @@ xfs_lookup( ...@@ -1900,8 +1887,7 @@ xfs_lookup(
vnode_t *dir_vp; vnode_t *dir_vp;
dir_vp = BHV_TO_VNODE(dir_bdp); dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(dir_vp, "xfs_lookup", (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp); dp = XFS_BHVTOI(dir_bdp);
...@@ -1965,13 +1951,13 @@ xfs_ctrunc_trace( ...@@ -1965,13 +1951,13 @@ xfs_ctrunc_trace(
*/ */
STATIC int STATIC int
xfs_create( xfs_create(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
vattr_t *vap, vattr_t *vap,
vnode_t **vpp, vnode_t **vpp,
cred_t *credp) cred_t *credp)
{ {
char *name = (char *)dentry->d_name.name; char *name = VNAME(dentry);
vnode_t *dir_vp; vnode_t *dir_vp;
xfs_inode_t *dp, *ip; xfs_inode_t *dp, *ip;
vnode_t *vp=NULL; vnode_t *vp=NULL;
...@@ -1986,19 +1972,19 @@ xfs_create( ...@@ -1986,19 +1972,19 @@ xfs_create(
uint cancel_flags; uint cancel_flags;
int committed; int committed;
xfs_prid_t prid; xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp; xfs_dquot_t *udqp, *gdqp;
uint resblks; uint resblks;
int dm_di_mode; int dm_di_mode;
int namelen; int namelen;
ASSERT(!*vpp); ASSERT(!*vpp);
dir_vp = BHV_TO_VNODE(dir_bdp); 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); dm_di_mode = vap->va_mode|VTTOIF(vap->va_type);
namelen = dentry->d_name.len; namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN) if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
...@@ -2222,7 +2208,6 @@ xfs_create( ...@@ -2222,7 +2208,6 @@ xfs_create(
} }
#ifdef DEBUG #ifdef DEBUG
/* /*
* Some counters to see if (and how often) we are hitting some deadlock * Some counters to see if (and how often) we are hitting some deadlock
* prevention code paths. * prevention code paths.
...@@ -2263,14 +2248,14 @@ int xfs_rm_attempts; ...@@ -2263,14 +2248,14 @@ int xfs_rm_attempts;
STATIC int STATIC int
xfs_lock_dir_and_entry( xfs_lock_dir_and_entry(
xfs_inode_t *dp, xfs_inode_t *dp,
struct dentry *dentry, vname_t *dentry,
xfs_inode_t *ip, /* inode of entry 'name' */ xfs_inode_t *ip, /* inode of entry 'name' */
int *entry_changed) int *entry_changed)
{ {
int attempts; int attempts;
xfs_ino_t e_inum; xfs_ino_t e_inum;
xfs_inode_t *ips[2]; xfs_inode_t *ips[2];
xfs_log_item_t *lp; xfs_log_item_t *lp;
#ifdef DEBUG #ifdef DEBUG
xfs_rm_locks++; xfs_rm_locks++;
...@@ -2359,12 +2344,13 @@ int xfs_lock_delays; ...@@ -2359,12 +2344,13 @@ int xfs_lock_delays;
* in the log. * in the log.
*/ */
void void
xfs_lock_inodes (xfs_inode_t **ips, xfs_lock_inodes(
int inodes, xfs_inode_t **ips,
int first_locked, int inodes,
uint lock_mode) int first_locked,
uint lock_mode)
{ {
int attempts = 0, i, j, try_lock; int attempts = 0, i, j, try_lock;
xfs_log_item_t *lp; xfs_log_item_t *lp;
ASSERT(ips && (inodes >= 2)); /* we need at least two */ ASSERT(ips && (inodes >= 2)); /* we need at least two */
...@@ -2470,18 +2456,19 @@ int remove_which_error_return = 0; ...@@ -2470,18 +2456,19 @@ int remove_which_error_return = 0;
#define REMOVE_DEBUG_TRACE(x) #define REMOVE_DEBUG_TRACE(x)
#endif /* ! DEBUG */ #endif /* ! DEBUG */
/* /*
* xfs_remove * xfs_remove
* *
*/ */
STATIC int STATIC int
xfs_remove( xfs_remove(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
cred_t *credp) cred_t *credp)
{ {
vnode_t *dir_vp; vnode_t *dir_vp;
char *name = (char *) dentry->d_name.name; char *name = VNAME(dentry);
xfs_inode_t *dp, *ip; xfs_inode_t *dp, *ip;
xfs_trans_t *tp = NULL; xfs_trans_t *tp = NULL;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -2495,11 +2482,9 @@ xfs_remove( ...@@ -2495,11 +2482,9 @@ xfs_remove(
int link_zero; int link_zero;
uint resblks; uint resblks;
int namelen; int namelen;
/* bhv_desc_t *bdp; */
dir_vp = BHV_TO_VNODE(dir_bdp); dir_vp = BHV_TO_VNODE(dir_bdp);
vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
vn_trace_entry(dir_vp, "xfs_remove", (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp); dp = XFS_BHVTOI(dir_bdp);
mp = dp->i_mount; mp = dp->i_mount;
...@@ -2507,7 +2492,7 @@ xfs_remove( ...@@ -2507,7 +2492,7 @@ xfs_remove(
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
namelen = dentry->d_name.len; namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN) if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
...@@ -2542,7 +2527,7 @@ xfs_remove( ...@@ -2542,7 +2527,7 @@ xfs_remove(
dm_di_mode = ip->i_d.di_mode; 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); ITRACE(ip);
...@@ -2701,8 +2686,7 @@ xfs_remove( ...@@ -2701,8 +2686,7 @@ xfs_remove(
goto std_return; goto std_return;
} }
vn_trace_exit(XFS_ITOV(ip), "xfs_remove", vn_trace_exit(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
(inst_t *)__return_address);
/* /*
* Let interposed file systems know about removed links. * Let interposed file systems know about removed links.
...@@ -2754,10 +2738,10 @@ xfs_remove( ...@@ -2754,10 +2738,10 @@ xfs_remove(
*/ */
STATIC int STATIC int
xfs_link( xfs_link(
bhv_desc_t *target_dir_bdp, bhv_desc_t *target_dir_bdp,
vnode_t *src_vp, vnode_t *src_vp,
struct dentry *dentry, vname_t *dentry,
cred_t *credp) cred_t *credp)
{ {
xfs_inode_t *tdp, *sip; xfs_inode_t *tdp, *sip;
xfs_trans_t *tp; xfs_trans_t *tp;
...@@ -2771,18 +2755,18 @@ xfs_link( ...@@ -2771,18 +2755,18 @@ xfs_link(
vnode_t *target_dir_vp; vnode_t *target_dir_vp;
bhv_desc_t *src_bdp; bhv_desc_t *src_bdp;
int resblks; int resblks;
char *target_name = (char *)dentry->d_name.name; char *target_name = VNAME(dentry);
int target_namelen; int target_namelen;
target_dir_vp = BHV_TO_VNODE(target_dir_bdp); 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 = VNAMELEN(dentry);
target_namelen = dentry->d_name.len;
if (target_namelen >= MAXNAMELEN) if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
if (src_vp->v_type == VDIR)
vn_trace_entry(src_vp, "xfs_link", (inst_t *)__return_address); return XFS_ERROR(EPERM);
/* /*
* For now, manually find the XFS behavior descriptor for * For now, manually find the XFS behavior descriptor for
...@@ -2927,21 +2911,19 @@ xfs_link( ...@@ -2927,21 +2911,19 @@ xfs_link(
} }
/* /*
* xfs_mkdir * xfs_mkdir
* *
*/ */
STATIC int STATIC int
xfs_mkdir( xfs_mkdir(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
vattr_t *vap, vattr_t *vap,
vnode_t **vpp, vnode_t **vpp,
cred_t *credp) cred_t *credp)
{ {
char *dir_name = (char *)dentry->d_name.name; char *dir_name = VNAME(dentry);
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_inode_t *cdp; /* inode of created dir */ xfs_inode_t *cdp; /* inode of created dir */
vnode_t *cvp; /* vnode of created dir */ vnode_t *cvp; /* vnode of created dir */
...@@ -2958,7 +2940,7 @@ xfs_mkdir( ...@@ -2958,7 +2940,7 @@ xfs_mkdir(
boolean_t created = B_FALSE; boolean_t created = B_FALSE;
int dm_event_sent = 0; int dm_event_sent = 0;
xfs_prid_t prid; xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp; xfs_dquot_t *udqp, *gdqp;
uint resblks; uint resblks;
int dm_di_mode; int dm_di_mode;
int dir_namelen; int dir_namelen;
...@@ -2970,7 +2952,7 @@ xfs_mkdir( ...@@ -2970,7 +2952,7 @@ xfs_mkdir(
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
dir_namelen = dentry->d_name.len; dir_namelen = VNAMELEN(dentry);
if (dir_namelen >= MAXNAMELEN) if (dir_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
...@@ -2987,7 +2969,7 @@ xfs_mkdir( ...@@ -2987,7 +2969,7 @@ xfs_mkdir(
/* Return through std_return after this point. */ /* 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; mp = dp->i_mount;
udqp = gdqp = NULL; udqp = gdqp = NULL;
...@@ -3184,16 +3166,15 @@ xfs_mkdir( ...@@ -3184,16 +3166,15 @@ xfs_mkdir(
*/ */
STATIC int STATIC int
xfs_rmdir( xfs_rmdir(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
cred_t *credp) cred_t *credp)
{ {
char *name = (char *)dentry->d_name.name; char *name = VNAME(dentry);
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_inode_t *cdp; /* child directory */ xfs_inode_t *cdp; /* child directory */
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_mount_t *mp; xfs_mount_t *mp;
/* bhv_desc_t *bdp;*/
int error; int error;
xfs_bmap_free_t free_list; xfs_bmap_free_t free_list;
xfs_fsblock_t first_block; xfs_fsblock_t first_block;
...@@ -3209,11 +3190,11 @@ xfs_rmdir( ...@@ -3209,11 +3190,11 @@ xfs_rmdir(
dir_vp = BHV_TO_VNODE(dir_bdp); dir_vp = BHV_TO_VNODE(dir_bdp);
dp = XFS_BHVTOI(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)) if (XFS_FORCED_SHUTDOWN(XFS_BHVTOI(dir_bdp)->i_mount))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
namelen = dentry->d_name.len; namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN) if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
...@@ -3446,14 +3427,12 @@ xfs_rmdir( ...@@ -3446,14 +3427,12 @@ xfs_rmdir(
} }
/* /*
* xfs_readdir * xfs_readdir
* *
* Read dp's entries starting at uiop->uio_offset and translate them into * Read dp's entries starting at uiop->uio_offset and translate them into
* bufsize bytes worth of struct dirents starting at bufbase. * bufsize bytes worth of struct dirents starting at bufbase.
*/ */
/*ARGSUSED*/
STATIC int STATIC int
xfs_readdir( xfs_readdir(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
...@@ -3461,13 +3440,13 @@ xfs_readdir( ...@@ -3461,13 +3440,13 @@ xfs_readdir(
cred_t *credp, cred_t *credp,
int *eofp) int *eofp)
{ {
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_trans_t *tp = NULL; xfs_trans_t *tp = NULL;
int error = 0; int error = 0;
uint lock_mode; uint lock_mode;
xfs_off_t start_offset; 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); (inst_t *)__return_address);
dp = XFS_BHVTOI(dir_bdp); dp = XFS_BHVTOI(dir_bdp);
...@@ -3493,18 +3472,19 @@ xfs_readdir( ...@@ -3493,18 +3472,19 @@ xfs_readdir(
return error; return error;
} }
/* /*
* xfs_symlink * xfs_symlink
* *
*/ */
STATIC int STATIC int
xfs_symlink( xfs_symlink(
bhv_desc_t *dir_bdp, bhv_desc_t *dir_bdp,
struct dentry *dentry, vname_t *dentry,
vattr_t *vap, vattr_t *vap,
char *target_path, char *target_path,
vnode_t **vpp, vnode_t **vpp,
cred_t *credp) cred_t *credp)
{ {
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -3529,9 +3509,9 @@ xfs_symlink( ...@@ -3529,9 +3509,9 @@ xfs_symlink(
int n; int n;
xfs_buf_t *bp; xfs_buf_t *bp;
xfs_prid_t prid; xfs_prid_t prid;
struct xfs_dquot *udqp, *gdqp; xfs_dquot_t *udqp, *gdqp;
uint resblks; uint resblks;
char *link_name = (char *)dentry->d_name.name; char *link_name = VNAME(dentry);
int link_namelen; int link_namelen;
*vpp = NULL; *vpp = NULL;
...@@ -3542,14 +3522,14 @@ xfs_symlink( ...@@ -3542,14 +3522,14 @@ xfs_symlink(
ip = NULL; ip = NULL;
tp = 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; mp = dp->i_mount;
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
link_namelen = dentry->d_name.len; link_namelen = VNAMELEN(dentry);
if (link_namelen >= MAXNAMELEN) if (link_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG); return XFS_ERROR(ENAMETOOLONG);
/* /*
...@@ -3841,8 +3821,8 @@ xfs_fid2( ...@@ -3841,8 +3821,8 @@ xfs_fid2(
xfs_inode_t *ip; xfs_inode_t *ip;
xfs_fid2_t *xfid; 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); (inst_t *)__return_address);
ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t)); ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
xfid = (xfs_fid2_t *)fidp; xfid = (xfs_fid2_t *)fidp;
...@@ -3917,8 +3897,9 @@ xfs_rwunlock( ...@@ -3917,8 +3897,9 @@ xfs_rwunlock(
} }
STATIC int STATIC int
xfs_inode_flush(bhv_desc_t *bdp, xfs_inode_flush(
int flags) bhv_desc_t *bdp,
int flags)
{ {
xfs_inode_t *ip; xfs_inode_t *ip;
xfs_dinode_t *dip; xfs_dinode_t *dip;
...@@ -4063,7 +4044,7 @@ xfs_reclaim( ...@@ -4063,7 +4044,7 @@ xfs_reclaim(
vp = BHV_TO_VNODE(bdp); 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)); ASSERT(!VN_MAPPED(vp));
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
...@@ -4251,8 +4232,7 @@ xfs_alloc_file_space( ...@@ -4251,8 +4232,7 @@ xfs_alloc_file_space(
xfs_trans_t *tp; xfs_trans_t *tp;
int xfs_bmapi_flags; int xfs_bmapi_flags;
vn_trace_entry(XFS_ITOV(ip), "xfs_alloc_file_space", vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
(inst_t *)__return_address);
mp = ip->i_mount; mp = ip->i_mount;
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
...@@ -4410,7 +4390,7 @@ xfs_alloc_file_space( ...@@ -4410,7 +4390,7 @@ xfs_alloc_file_space(
NULL, NULL, 0, 0, 0); /* Delay flag intentionally unused */ NULL, NULL, 0, 0, 0); /* Delay flag intentionally unused */
if (error == 0) if (error == 0)
goto retry; /* Maybe DMAPI app. has made space */ 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; return error;
...@@ -4534,8 +4514,7 @@ xfs_free_file_space( ...@@ -4534,8 +4514,7 @@ xfs_free_file_space(
xfs_fileoff_t startoffset_fsb; xfs_fileoff_t startoffset_fsb;
xfs_trans_t *tp; xfs_trans_t *tp;
vn_trace_entry(XFS_ITOV(ip), "xfs_free_file_space", vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
(inst_t *)__return_address);
mp = ip->i_mount; mp = ip->i_mount;
if (XFS_IS_QUOTA_ON(mp)) { if (XFS_IS_QUOTA_ON(mp)) {
...@@ -4738,9 +4717,8 @@ xfs_change_file_space( ...@@ -4738,9 +4717,8 @@ xfs_change_file_space(
vnode_t *vp; vnode_t *vp;
vp = BHV_TO_VNODE(bdp); 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); ip = XFS_BHVTOI(bdp);
mp = ip->i_mount; mp = ip->i_mount;
...@@ -4889,6 +4867,7 @@ xfs_change_file_space( ...@@ -4889,6 +4867,7 @@ xfs_change_file_space(
} }
vnodeops_t xfs_vnodeops = { vnodeops_t xfs_vnodeops = {
BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
.vop_open = xfs_open, .vop_open = xfs_open,
.vop_read = xfs_read, .vop_read = xfs_read,
.vop_write = xfs_write, .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