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

XFS: code cleanup

Date:  Thu Sep 12 20:10:49 PDT 2002
Workarea:  snort.melbourne.sgi.com:/home/nathans/2.5.x-xfs
Author:  nathans
Merged by:  nathans
Merged mods:  2.4.x-xfs:slinx:127321a

The following file(s) were checked into:
  bonnie.engr.sgi.com:/isms/slinx/2.5.x-xfs


Modid:  2.5.x-xfs:slinx:127321a
linux/fs/xfs/linux/xfs_super.c - 1.227
	- Merge of 2.4.x-xfs:slinx:127321a by nathans.
	  tidy up code consistency - same argument formatting throughout and make
	  consistent use of STATIC.
parent 789ac4bb
...@@ -57,7 +57,7 @@ extern void xfs_cleanup(void); ...@@ -57,7 +57,7 @@ extern void xfs_cleanup(void);
#endif #endif
#ifdef CONFIG_XFS_QUOTA #ifdef CONFIG_XFS_QUOTA
static struct quotactl_ops linvfs_qops = { STATIC struct quotactl_ops linvfs_qops = {
.get_xstate = linvfs_getxstate, .get_xstate = linvfs_getxstate,
.set_xstate = linvfs_setxstate, .set_xstate = linvfs_setxstate,
.get_xquota = linvfs_getxquota, .get_xquota = linvfs_getxquota,
...@@ -76,8 +76,8 @@ void dmapi_uninit(void); ...@@ -76,8 +76,8 @@ void dmapi_uninit(void);
#define dmapi_uninit() #define dmapi_uninit()
#endif #endif
static struct super_operations linvfs_sops; STATIC struct super_operations linvfs_sops;
static struct export_operations linvfs_export_ops; STATIC struct export_operations linvfs_export_ops;
#define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */ #define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */
#define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */ #define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */
...@@ -123,9 +123,6 @@ xfs_parseargs( ...@@ -123,9 +123,6 @@ xfs_parseargs(
int rval = 1; /* failure is default */ int rval = 1; /* failure is default */
iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0; iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0;
memset(args, 0, sizeof(struct xfs_mount_args));
args->slcount = args->stimeout = args->ctimeout = -1;
args->mtpt[0] = '\0';
/* Copy the already-parsed mount(2) flags we're interested in */ /* Copy the already-parsed mount(2) flags we're interested in */
if (flags & MS_NOATIME) if (flags & MS_NOATIME)
...@@ -137,10 +134,10 @@ xfs_parseargs( ...@@ -137,10 +134,10 @@ xfs_parseargs(
return 0; return 0;
} }
while ((this_char = strsep (&options, ",")) != NULL) { while ((this_char = strsep(&options, ",")) != NULL) {
if (!*this_char) if (!*this_char)
continue; continue;
if ((value = strchr (this_char, '=')) != NULL) if ((value = strchr(this_char, '=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp(this_char, MNTOPT_LOGBUFS)) { if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
...@@ -317,9 +314,9 @@ spectodevs( ...@@ -317,9 +314,9 @@ spectodevs(
} }
static kmem_cache_t * linvfs_inode_cachep; STATIC kmem_cache_t * linvfs_inode_cachep;
static __inline__ unsigned int gfp_mask(void) STATIC __inline__ unsigned int gfp_mask(void)
{ {
/* If we're not in a transaction, FS activity is ok */ /* If we're not in a transaction, FS activity is ok */
if (current->flags & PF_FSTRANS) return GFP_NOFS; if (current->flags & PF_FSTRANS) return GFP_NOFS;
...@@ -327,7 +324,9 @@ static __inline__ unsigned int gfp_mask(void) ...@@ -327,7 +324,9 @@ static __inline__ unsigned int gfp_mask(void)
} }
static struct inode *linvfs_alloc_inode(struct super_block *sb) STATIC struct inode *
linvfs_alloc_inode(
struct super_block *sb)
{ {
vnode_t *vp; vnode_t *vp;
...@@ -337,20 +336,28 @@ static struct inode *linvfs_alloc_inode(struct super_block *sb) ...@@ -337,20 +336,28 @@ static struct inode *linvfs_alloc_inode(struct super_block *sb)
return LINVFS_GET_IP(vp); return LINVFS_GET_IP(vp);
} }
static void linvfs_destroy_inode(struct inode *inode) STATIC void
linvfs_destroy_inode(
struct inode *inode)
{ {
kmem_cache_free(linvfs_inode_cachep, LINVFS_GET_VP(inode)); kmem_cache_free(linvfs_inode_cachep, LINVFS_GET_VP(inode));
} }
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) STATIC void
init_once(
void *data,
kmem_cache_t *cachep,
unsigned long flags)
{ {
vnode_t *vp = (vnode_t *)foo; vnode_t *vp = (vnode_t *)data;
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) SLAB_CTOR_CONSTRUCTOR)
inode_init_once(LINVFS_GET_IP(vp)); inode_init_once(LINVFS_GET_IP(vp));
} }
static int init_inodecache(void) STATIC int
init_inodecache( void )
{ {
linvfs_inode_cachep = kmem_cache_create("linvfs_icache", linvfs_inode_cachep = kmem_cache_create("linvfs_icache",
sizeof(vnode_t), 0, SLAB_HWCACHE_ALIGN, sizeof(vnode_t), 0, SLAB_HWCACHE_ALIGN,
...@@ -361,10 +368,12 @@ static int init_inodecache(void) ...@@ -361,10 +368,12 @@ static int init_inodecache(void)
return 0; return 0;
} }
static void destroy_inodecache(void) STATIC void
destroy_inodecache( void )
{ {
if (kmem_cache_destroy(linvfs_inode_cachep)) if (kmem_cache_destroy(linvfs_inode_cachep))
printk(KERN_INFO "linvfs_inode_cache: not all structures were freed\n"); printk(KERN_INFO
"linvfs_inode_cache: not all structures were freed\n");
} }
static int static int
...@@ -381,16 +390,14 @@ linvfs_fill_super( ...@@ -381,16 +390,14 @@ linvfs_fill_super(
struct statfs statvfs; struct statfs statvfs;
int error = EINVAL; int error = EINVAL;
args = (struct xfs_mount_args *)kmalloc(sizeof(struct xfs_mount_args), GFP_KERNEL); args = kmalloc(sizeof(struct xfs_mount_args), GFP_KERNEL);
if (!args) if (!args)
return -EINVAL; return -EINVAL;
memset(args, 0, sizeof(struct xfs_mount_args));
args->slcount = args->stimeout = args->ctimeout = -1;
strncpy(args->fsname, sb->s_id, MAXNAMELEN); strncpy(args->fsname, sb->s_id, MAXNAMELEN);
if (xfs_parseargs((char *)data, sb->s_flags, args))
if (xfs_parseargs((char *)data, sb->s_flags, args)) {
goto out_null; goto out_null;
}
strncpy(args->fsname, bdevname(sb->s_bdev), MAXNAMELEN);
/* args->rtdev and args->logdev done in xfs_parseargs */
/* Kludge in XFS until we have other VFS/VNODE FSs */ /* Kludge in XFS until we have other VFS/VNODE FSs */
vfsops = &xfs_vfsops; vfsops = &xfs_vfsops;
...@@ -628,24 +635,25 @@ linvfs_remount( ...@@ -628,24 +635,25 @@ linvfs_remount(
xfs_mount_t *mp; xfs_mount_t *mp;
int error = 0; int error = 0;
args = (struct xfs_mount_args *)kmalloc(sizeof(struct xfs_mount_args), GFP_KERNEL);
if (!args)
return -ENOMEM;
vfsp = LINVFS_GET_VFS(sb); vfsp = LINVFS_GET_VFS(sb);
mp = XFS_BHVTOM(vfsp->vfs_fbhv); mp = XFS_BHVTOM(vfsp->vfs_fbhv);
args = kmalloc(sizeof(struct xfs_mount_args), GFP_KERNEL);
if (!args)
return -ENOMEM;
memset(args, 0, sizeof(struct xfs_mount_args));
args->slcount = args->stimeout = args->ctimeout = -1;
if (xfs_parseargs(options, *flags, args)) { if (xfs_parseargs(options, *flags, args)) {
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} }
set_posix_acl(sb);
if (args->flags & XFSMNT_NOATIME) if (args->flags & XFSMNT_NOATIME)
mp->m_flags |= XFS_MOUNT_NOATIME; mp->m_flags |= XFS_MOUNT_NOATIME;
else else
mp->m_flags &= ~XFS_MOUNT_NOATIME; mp->m_flags &= ~XFS_MOUNT_NOATIME;
set_posix_acl(sb);
linvfs_write_super(sb); linvfs_write_super(sb);
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
...@@ -695,7 +703,9 @@ linvfs_unfreeze_fs( ...@@ -695,7 +703,9 @@ linvfs_unfreeze_fs(
} }
struct dentry *linvfs_get_parent(struct dentry *child) STATIC struct dentry *
linvfs_get_parent(
struct dentry *child)
{ {
int error; int error;
vnode_t *vp, *cvp; vnode_t *vp, *cvp;
...@@ -730,18 +740,24 @@ struct dentry *linvfs_get_parent(struct dentry *child) ...@@ -730,18 +740,24 @@ struct dentry *linvfs_get_parent(struct dentry *child)
return parent; return parent;
} }
static struct super_block *linvfs_get_sb(struct file_system_type *fs_type, STATIC struct super_block *
int flags, char *dev_name, void *data) linvfs_get_sb(
struct file_system_type *fs_type,
int flags,
char *dev_name,
void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, linvfs_fill_super); return get_sb_bdev(fs_type, flags, dev_name, data, linvfs_fill_super);
} }
static struct export_operations linvfs_export_ops = { STATIC struct export_operations linvfs_export_ops = {
.get_parent = linvfs_get_parent, .get_parent = linvfs_get_parent,
}; };
int STATIC int
linvfs_show_options(struct seq_file *m, struct vfsmount *mnt) linvfs_show_options(
struct seq_file *m,
struct vfsmount *mnt)
{ {
vfs_t *vfsp; vfs_t *vfsp;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -757,7 +773,6 @@ linvfs_show_options(struct seq_file *m, struct vfsmount *mnt) ...@@ -757,7 +773,6 @@ linvfs_show_options(struct seq_file *m, struct vfsmount *mnt)
{ XFS_MOUNT_IRIXSGID, ",irixsgid" }, { XFS_MOUNT_IRIXSGID, ",irixsgid" },
{ 0, NULL } { 0, NULL }
}; };
struct proc_xfs_info *xfs_infop; struct proc_xfs_info *xfs_infop;
vfsp = LINVFS_GET_VFS(mnt->mnt_sb); vfsp = LINVFS_GET_VFS(mnt->mnt_sb);
...@@ -812,7 +827,7 @@ linvfs_show_options(struct seq_file *m, struct vfsmount *mnt) ...@@ -812,7 +827,7 @@ linvfs_show_options(struct seq_file *m, struct vfsmount *mnt)
return 0; return 0;
} }
static struct super_operations linvfs_sops = { STATIC struct super_operations linvfs_sops = {
.alloc_inode = linvfs_alloc_inode, .alloc_inode = linvfs_alloc_inode,
.destroy_inode = linvfs_destroy_inode, .destroy_inode = linvfs_destroy_inode,
.write_inode = linvfs_write_inode, .write_inode = linvfs_write_inode,
...@@ -827,7 +842,7 @@ static struct super_operations linvfs_sops = { ...@@ -827,7 +842,7 @@ static struct super_operations linvfs_sops = {
.show_options = linvfs_show_options, .show_options = linvfs_show_options,
}; };
static struct file_system_type xfs_fs_type = { STATIC struct file_system_type xfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "xfs", .name = "xfs",
.get_sb = linvfs_get_sb, .get_sb = linvfs_get_sb,
...@@ -835,7 +850,8 @@ static struct file_system_type xfs_fs_type = { ...@@ -835,7 +850,8 @@ static struct file_system_type xfs_fs_type = {
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
static int __init init_xfs_fs(void) STATIC int __init
init_xfs_fs( void )
{ {
int error; int error;
struct sysinfo si; struct sysinfo si;
...@@ -843,6 +859,8 @@ static int __init init_xfs_fs(void) ...@@ -843,6 +859,8 @@ static int __init init_xfs_fs(void)
KERN_INFO "SGI XFS " XFS_VERSION_STRING " with " KERN_INFO "SGI XFS " XFS_VERSION_STRING " with "
XFS_BUILD_OPTIONS " enabled\n"; XFS_BUILD_OPTIONS " enabled\n";
printk(message);
error = init_inodecache(); error = init_inodecache();
if (error < 0) if (error < 0)
return error; return error;
...@@ -854,8 +872,6 @@ static int __init init_xfs_fs(void) ...@@ -854,8 +872,6 @@ static int __init init_xfs_fs(void)
si_meminfo(&si); si_meminfo(&si);
xfs_physmem = si.totalram; xfs_physmem = si.totalram;
printk(message);
vn_init(); vn_init();
xfs_init(); xfs_init();
dmapi_init(); dmapi_init();
...@@ -870,8 +886,8 @@ static int __init init_xfs_fs(void) ...@@ -870,8 +886,8 @@ static int __init init_xfs_fs(void)
return error; return error;
} }
STATIC void __exit
static void __exit exit_xfs_fs(void) exit_xfs_fs( void )
{ {
dmapi_uninit(); dmapi_uninit();
xfs_cleanup(); xfs_cleanup();
......
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