Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff55068c authored by Dave Chinner's avatar Dave Chinner Committed by Ben Myers
Browse files

xfs: introduce xfs_sb.c for sharing with libxfs



xfs_mount.c is shared with userspace, but the only functions that
are shared are to do with physical superblock manipulations. This
means that less than 25% of the xfs_mount.c code is actually shared
with userspace. Move all the superblock functions to xfs_sb.c and
share that instead with libxfs.

Note that this will leave all the in-core transaction related
superblock counter modifications in xfs_mount.c as none of that is
shared with userspace. With a few more small changes, xfs_mount.h
won't need to be shared with userspace anymore, either.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 1fb7e48d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ xfs-y += xfs_aops.o \
				   xfs_iops.o \
				   xfs_itable.o \
				   xfs_message.o \
				   xfs_mount.o \
				   xfs_mru_cache.o \
				   xfs_rename.o \
				   xfs_super.o \
@@ -81,7 +82,7 @@ xfs-y += xfs_alloc.o \
				   xfs_inode_fork.o \
				   xfs_inode_buf.o \
				   xfs_log_recover.o \
				   xfs_mount.o \
				   xfs_sb.o \
				   xfs_symlink_remote.o \
				   xfs_trans_resv.o

+5 −779

File changed.

Preview size limit exceeded, changes collapsed.

+2 −17
Original line number Diff line number Diff line
@@ -291,14 +291,6 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
	return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
}

/*
 * perag get/put wrappers for ref counting
 */
struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *mp, xfs_agnumber_t agno,
					int tag);
void	xfs_perag_put(struct xfs_perag *pag);

/*
 * Per-cpu superblock locking functions
 */
@@ -331,6 +323,8 @@ typedef struct xfs_mod_sb {
extern int	xfs_log_sbcount(xfs_mount_t *);
extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
extern int	xfs_mountfs(xfs_mount_t *mp);
extern int	xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount,
				     xfs_agnumber_t *maxagi);

extern void	xfs_unmountfs(xfs_mount_t *);
extern int	xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int);
@@ -349,13 +343,4 @@ extern void xfs_set_low_space_thresholds(struct xfs_mount *);

#endif	/* __KERNEL__ */

extern void	xfs_sb_calc_crc(struct xfs_buf	*);
extern void	xfs_mod_sb(struct xfs_trans *, __int64_t);
extern int	xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
					xfs_agnumber_t *);
extern void	xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
extern void	xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);

extern const struct xfs_buf_ops xfs_sb_buf_ops;

#endif	/* __XFS_MOUNT_H__ */

fs/xfs/xfs_sb.c

0 → 100644
+834 −0

File added.

Preview size limit exceeded, changes collapsed.

+20 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

struct xfs_buf;
struct xfs_mount;
struct xfs_trans;

#define	XFS_SB_MAGIC		0x58465342	/* 'XFSB' */
#define	XFS_SB_VERSION_1	1		/* 5.3, 6.0.1, 6.1 */
@@ -674,4 +675,23 @@ xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
#define XFS_B_TO_FSBT(mp,b)	(((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_FSB_OFFSET(mp,b)	((b) & (mp)->m_blockmask)

/*
 * perag get/put wrappers for ref counting
 */
extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t);
extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber_t,
					   int tag);
extern void	xfs_perag_put(struct xfs_perag *pag);
extern int	xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t);

extern void	xfs_sb_calc_crc(struct xfs_buf	*);
extern void	xfs_mod_sb(struct xfs_trans *, __int64_t);
extern void	xfs_sb_mount_common(struct xfs_mount *, struct xfs_sb *);
extern void	xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
extern void	xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
extern void	xfs_sb_quota_from_disk(struct xfs_sb *sbp);

extern const struct xfs_buf_ops xfs_sb_buf_ops;
extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;

#endif	/* __XFS_SB_H__ */