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

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

xfs: split out transaction reservation code



The transaction reservation size calculations is used by both kernel
and userspace, but most of the transaction code in xfs_trans.c is
kernel specific. Split all the transaction reservation code out into
it's own files to make sharing with userspace simpler. This just
leaves kernel-only definitions in xfs_trans.h, so it doesn't need to
be shared with userspace anymore, either.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent d386b32b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ xfs-y += xfs_aops.o \
				   xfs_mru_cache.o \
				   xfs_rename.o \
				   xfs_super.o \
				   xfs_trans.o \
				   xfs_utils.o \
				   xfs_vnodeops.o \
				   xfs_xattr.o \
@@ -76,7 +77,7 @@ xfs-y += xfs_alloc.o \
				   xfs_log_recover.o \
				   xfs_mount.o \
				   xfs_symlink.o \
				   xfs_trans.o
				   xfs_trans_resv.o

# low-level transaction/log code
xfs-y				+= xfs_log.o \
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
 */
#include "xfs.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_acl.h"
#include "xfs_attr.h"
#include "xfs_bmap_btree.h"
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <linux/freezer.h>

#include "xfs_sb.h"
#include "xfs_trans_resv.h"
#include "xfs_log.h"
#include "xfs_ag.h"
#include "xfs_mount.h"
+2 −2
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@
 */
#include "xfs.h"
#include "xfs_format.h"
#include "xfs_sb.h"
#include "xfs_log.h"
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_mount.h"
#include "xfs_quota.h"
#include "xfs_trans.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_ialloc_btree.h"
+2 −40
Original line number Diff line number Diff line
@@ -18,45 +18,7 @@
#ifndef __XFS_MOUNT_H__
#define	__XFS_MOUNT_H__

typedef struct xfs_trans_reservations {
	uint	tr_write;	/* extent alloc trans */
	uint	tr_itruncate;	/* truncate trans */
	uint	tr_rename;	/* rename trans */
	uint	tr_link;	/* link trans */
	uint	tr_remove;	/* unlink trans */
	uint	tr_symlink;	/* symlink trans */
	uint	tr_create;	/* create trans */
	uint	tr_mkdir;	/* mkdir trans */
	uint	tr_ifree;	/* inode free trans */
	uint	tr_ichange;	/* inode update trans */
	uint	tr_growdata;	/* fs data section grow trans */
	uint	tr_swrite;	/* sync write inode trans */
	uint	tr_addafork;	/* cvt inode to attributed trans */
	uint	tr_writeid;	/* write setuid/setgid file */
	uint	tr_attrinval;	/* attr fork buffer invalidation */
	uint	tr_attrsetm;	/* set/create an attribute at mount time */
	uint	tr_attrsetrt;	/* set/create an attribute at runtime */
	uint	tr_attrrm;	/* remove an attribute */
	uint	tr_clearagi;	/* clear bad agi unlinked ino bucket */
	uint	tr_growrtalloc;	/* grow realtime allocations */
	uint	tr_growrtzero;	/* grow realtime zeroing */
	uint	tr_growrtfree;	/* grow realtime freeing */
	uint	tr_qm_sbchange;	/* change quota flags */
	uint	tr_qm_setqlim;	/* adjust quota limits */
	uint	tr_qm_dqalloc;	/* allocate quota on disk */
	uint	tr_qm_quotaoff;	/* turn quota off */
	uint	tr_qm_equotaoff;/* end of turn quota off */
	uint	tr_sb;		/* modify superblock */
} xfs_trans_reservations_t;

#ifndef __KERNEL__

#define xfs_daddr_to_agno(mp,d) \
	((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
#define xfs_daddr_to_agbno(mp,d) \
	((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))

#else /* __KERNEL__ */
#ifdef __KERNEL__

struct xlog;
struct xfs_inode;
@@ -174,7 +136,7 @@ typedef struct xfs_mount {
	int			m_ialloc_blks;	/* blocks in inode allocation */
	int			m_inoalign_mask;/* mask sb_inoalignmt if used */
	uint			m_qflags;	/* quota status flags */
	xfs_trans_reservations_t m_reservations;/* precomputed res values */
	struct xfs_trans_resv	m_reservations;	/* precomputed res values */
	__uint64_t		m_maxicount;	/* maximum inode count */
	__uint64_t		m_resblks;	/* total reserved blocks */
	__uint64_t		m_resblks_avail;/* available reserved blocks */
Loading