Skip to content

Commit

Permalink
[XFS] streamline init/exit path
Browse files Browse the repository at this point in the history
Currently the xfs module init/exit code is a mess. It's farmed out over a
lot of function with very little error checking. This patch makes sure we
propagate all initialization failures properly and clean up after them.
Various runtime initializations are replaced with compile-time
initializations where possible to make this easier. The exit path is
similarly consolidated.

There's now split out function to create/destroy the kmem zones and
alloc/free the trace buffers. I've also changed the ktrace allocations to
KM_MAYFAIL and handled errors resulting from that.

And yes, we really should replace the XFS_*_TRACE ifdefs with a single
XFS_TRACE..

SGI-PV: 976035

SGI-Modid: xfs-linux-melb:xfs-kern:31354a

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Niv Sardi <[email protected]>
Signed-off-by: Lachlan McIlroy <[email protected]>
  • Loading branch information
Christoph Hellwig authored and xaiki committed Jul 28, 2008
1 parent 136f8f2 commit 9f8868f
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 221 deletions.
15 changes: 12 additions & 3 deletions fs/xfs/linux-2.6/xfs_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,21 @@ xfs_read_xfsstats(
return len;
}

void
int
xfs_init_procfs(void)
{
if (!proc_mkdir("fs/xfs", NULL))
return;
create_proc_read_entry("fs/xfs/stat", 0, NULL, xfs_read_xfsstats, NULL);
goto out;

if (!create_proc_read_entry("fs/xfs/stat", 0, NULL,
xfs_read_xfsstats, NULL))
goto out_remove_entry;
return 0;

out_remove_entry:
remove_proc_entry("fs/xfs", NULL);
out:
return -ENOMEM;
}

void
Expand Down
11 changes: 8 additions & 3 deletions fs/xfs/linux-2.6/xfs_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ DECLARE_PER_CPU(struct xfsstats, xfsstats);
#define XFS_STATS_DEC(v) (per_cpu(xfsstats, current_cpu()).v--)
#define XFS_STATS_ADD(v, inc) (per_cpu(xfsstats, current_cpu()).v += (inc))

extern void xfs_init_procfs(void);
extern int xfs_init_procfs(void);
extern void xfs_cleanup_procfs(void);


Expand All @@ -144,8 +144,13 @@ extern void xfs_cleanup_procfs(void);
# define XFS_STATS_DEC(count)
# define XFS_STATS_ADD(count, inc)

static inline void xfs_init_procfs(void) { };
static inline void xfs_cleanup_procfs(void) { };
static inline int xfs_init_procfs(void)
{
return 0
};
static inline void xfs_cleanup_procfs(void)
{
};

#endif /* !CONFIG_PROC_FS */

Expand Down
Loading

0 comments on commit 9f8868f

Please sign in to comment.