public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 31/50] xfs: separate dquot on disk format definitions out of xfs_quota.h
Date: Wed, 19 Jun 2013 15:35:54 +1000	[thread overview]
Message-ID: <1371620173-712-32-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1371620173-712-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

The on disk format definitions of the on-disk dquot, log formats and
quota off log formats are all intertwined with other definitions for
quotas. Separate them out into their own header file so they can
easily be shared with userspace.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 include/Makefile           |    4 +-
 include/libxfs.h           |    1 +
 include/xfs_dquot_format.h |  132 ++++++++++++++++++++++++++++++++++++++++++++
 include/xfs_quota.h        |  112 -------------------------------------
 4 files changed, 136 insertions(+), 113 deletions(-)
 create mode 100644 include/xfs_dquot_format.h

diff --git a/include/Makefile b/include/Makefile
index 2bd7fbe..144e9dc 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -36,7 +36,9 @@ QAHFILES = libxfs.h libxlog.h \
 	xfs_inode_item_format.h \
 	xfs_inum.h \
 	xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \
-	xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \
+	xfs_quota.h \
+	xfs_dquot_format.h \
+	xfs_rtalloc.h xfs_sb.h xfs_symlink.h \
 	xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h
 
 HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h
diff --git a/include/libxfs.h b/include/libxfs.h
index 5e78378..6448bc9 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -412,6 +412,7 @@ extern void	libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
 
 
 #include <xfs/xfs_quota.h>
+#include <xfs/xfs_dquot_format.h>
 #include <xfs/xfs_trans_space.h>
 #include <xfs/xfs_log.h>
 #include <xfs/xfs_log_priv.h>
diff --git a/include/xfs_dquot_format.h b/include/xfs_dquot_format.h
new file mode 100644
index 0000000..f34615b
--- /dev/null
+++ b/include/xfs_dquot_format.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#ifndef __XFS_DQUOT_FORMAT_H__
+#define __XFS_DQUOT_FORMAT_H__
+
+/*
+ * The ondisk form of a dquot structure.
+ */
+#define XFS_DQUOT_MAGIC		0x4451		/* 'DQ' */
+#define XFS_DQUOT_VERSION	(u_int8_t)0x01	/* latest version number */
+
+/*
+ * uid_t and gid_t are hard-coded to 32 bits in the inode.
+ * Hence, an 'id' in a dquot is 32 bits..
+ */
+typedef __uint32_t	xfs_dqid_t;
+
+/*
+ * This is the main portion of the on-disk representation of quota
+ * information for a user. This is the q_core of the xfs_dquot_t that
+ * is kept in kernel memory. We pad this with some more expansion room
+ * to construct the on disk structure.
+ */
+typedef struct	xfs_disk_dquot {
+	__be16		d_magic;	/* dquot magic = XFS_DQUOT_MAGIC */
+	__u8		d_version;	/* dquot version */
+	__u8		d_flags;	/* XFS_DQ_USER/PROJ/GROUP */
+	__be32		d_id;		/* user,project,group id */
+	__be64		d_blk_hardlimit;/* absolute limit on disk blks */
+	__be64		d_blk_softlimit;/* preferred limit on disk blks */
+	__be64		d_ino_hardlimit;/* maximum # allocated inodes */
+	__be64		d_ino_softlimit;/* preferred inode limit */
+	__be64		d_bcount;	/* disk blocks owned by the user */
+	__be64		d_icount;	/* inodes owned by the user */
+	__be32		d_itimer;	/* zero if within inode limits if not,
+					   this is when we refuse service */
+	__be32		d_btimer;	/* similar to above; for disk blocks */
+	__be16		d_iwarns;	/* warnings issued wrt num inodes */
+	__be16		d_bwarns;	/* warnings issued wrt disk blocks */
+	__be32		d_pad0;		/* 64 bit align */
+	__be64		d_rtb_hardlimit;/* absolute limit on realtime blks */
+	__be64		d_rtb_softlimit;/* preferred limit on RT disk blks */
+	__be64		d_rtbcount;	/* realtime blocks owned */
+	__be32		d_rtbtimer;	/* similar to above; for RT disk blocks */
+	__be16		d_rtbwarns;	/* warnings issued wrt RT disk blocks */
+	__be16		d_pad;
+} xfs_disk_dquot_t;
+
+/*
+ * This is what goes on disk. This is separated from the xfs_disk_dquot because
+ * carrying the unnecessary padding would be a waste of memory.
+ */
+typedef struct xfs_dqblk {
+	xfs_disk_dquot_t  dd_diskdq;	/* portion that lives incore as well */
+	char		  dd_fill[4];	/* filling for posterity */
+
+	/*
+	 * These two are only present on filesystems with the CRC bits set.
+	 */
+	__be32		  dd_crc;	/* checksum */
+	__be64		  dd_lsn;	/* last modification in log */
+	uuid_t		  dd_uuid;	/* location information */
+} xfs_dqblk_t;
+
+#define XFS_DQUOT_CRC_OFF	offsetof(struct xfs_dqblk, dd_crc)
+
+/*
+ * These are the structures used to lay out dquots and quotaoff
+ * records on the log. Quite similar to those of inodes.
+ */
+
+/*
+ * log format struct for dquots.
+ * The first two fields must be the type and size fitting into
+ * 32 bits : log_recovery code assumes that.
+ */
+typedef struct xfs_dq_logformat {
+	__uint16_t		qlf_type;      /* dquot log item type */
+	__uint16_t		qlf_size;      /* size of this item */
+	xfs_dqid_t		qlf_id;	       /* usr/grp/proj id : 32 bits */
+	__int64_t		qlf_blkno;     /* blkno of dquot buffer */
+	__int32_t		qlf_len;       /* len of dquot buffer */
+	__uint32_t		qlf_boffset;   /* off of dquot in buffer */
+} xfs_dq_logformat_t;
+
+/*
+ * log format struct for QUOTAOFF records.
+ * The first two fields must be the type and size fitting into
+ * 32 bits : log_recovery code assumes that.
+ * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
+ * to the first and ensures that the first logitem is taken out of the AIL
+ * only when the last one is securely committed.
+ */
+typedef struct xfs_qoff_logformat {
+	unsigned short		qf_type;	/* quotaoff log item type */
+	unsigned short		qf_size;	/* size of this item */
+	unsigned int		qf_flags;	/* USR and/or GRP */
+	char			qf_pad[12];	/* padding for future */
+} xfs_qoff_logformat_t;
+
+/*
+ * Disk quotas status in m_qflags, sb_qflags and xfs_qoff_logformat. 16 bits.
+ */
+#define XFS_UQUOTA_ACCT	0x0001  /* user quota accounting ON */
+#define XFS_UQUOTA_ENFD	0x0002  /* user quota limits enforced */
+#define XFS_UQUOTA_CHKD	0x0004  /* quotacheck run on usr quotas */
+#define XFS_PQUOTA_ACCT	0x0008  /* project quota accounting ON */
+#define XFS_OQUOTA_ENFD	0x0010  /* other (grp/prj) quota limits enforced */
+#define XFS_OQUOTA_CHKD	0x0020  /* quotacheck run on other (grp/prj) quotas */
+#define XFS_GQUOTA_ACCT	0x0040  /* group quota accounting ON */
+
+#define XFS_ALL_QUOTA_ACCT	\
+		(XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
+#define XFS_ALL_QUOTA_ENFD	(XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD)
+#define XFS_ALL_QUOTA_CHKD	(XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)
+
+#endif /* __XFS_DQUOT_FORMAT_H__ */
diff --git a/include/xfs_quota.h b/include/xfs_quota.h
index c38068f..ec80623 100644
--- a/include/xfs_quota.h
+++ b/include/xfs_quota.h
@@ -21,18 +21,6 @@
 struct xfs_trans;
 
 /*
- * The ondisk form of a dquot structure.
- */
-#define XFS_DQUOT_MAGIC		0x4451		/* 'DQ' */
-#define XFS_DQUOT_VERSION	(u_int8_t)0x01	/* latest version number */
-
-/*
- * uid_t and gid_t are hard-coded to 32 bits in the inode.
- * Hence, an 'id' in a dquot is 32 bits..
- */
-typedef __uint32_t	xfs_dqid_t;
-
-/*
  * Even though users may not have quota limits occupying all 64-bits,
  * they may need 64-bit accounting. Hence, 64-bit quota-counters,
  * and quota-limits. This is a waste in the common case, but hey ...
@@ -41,55 +29,6 @@ typedef __uint64_t	xfs_qcnt_t;
 typedef __uint16_t	xfs_qwarncnt_t;
 
 /*
- * This is the main portion of the on-disk representation of quota
- * information for a user. This is the q_core of the xfs_dquot_t that
- * is kept in kernel memory. We pad this with some more expansion room
- * to construct the on disk structure.
- */
-typedef struct	xfs_disk_dquot {
-	__be16		d_magic;	/* dquot magic = XFS_DQUOT_MAGIC */
-	__u8		d_version;	/* dquot version */
-	__u8		d_flags;	/* XFS_DQ_USER/PROJ/GROUP */
-	__be32		d_id;		/* user,project,group id */
-	__be64		d_blk_hardlimit;/* absolute limit on disk blks */
-	__be64		d_blk_softlimit;/* preferred limit on disk blks */
-	__be64		d_ino_hardlimit;/* maximum # allocated inodes */
-	__be64		d_ino_softlimit;/* preferred inode limit */
-	__be64		d_bcount;	/* disk blocks owned by the user */
-	__be64		d_icount;	/* inodes owned by the user */
-	__be32		d_itimer;	/* zero if within inode limits if not,
-					   this is when we refuse service */
-	__be32		d_btimer;	/* similar to above; for disk blocks */
-	__be16		d_iwarns;	/* warnings issued wrt num inodes */
-	__be16		d_bwarns;	/* warnings issued wrt disk blocks */
-	__be32		d_pad0;		/* 64 bit align */
-	__be64		d_rtb_hardlimit;/* absolute limit on realtime blks */
-	__be64		d_rtb_softlimit;/* preferred limit on RT disk blks */
-	__be64		d_rtbcount;	/* realtime blocks owned */
-	__be32		d_rtbtimer;	/* similar to above; for RT disk blocks */
-	__be16		d_rtbwarns;	/* warnings issued wrt RT disk blocks */
-	__be16		d_pad;
-} xfs_disk_dquot_t;
-
-/*
- * This is what goes on disk. This is separated from the xfs_disk_dquot because
- * carrying the unnecessary padding would be a waste of memory.
- */
-typedef struct xfs_dqblk {
-	xfs_disk_dquot_t  dd_diskdq;	/* portion that lives incore as well */
-	char		  dd_fill[4];	/* filling for posterity */
-
-	/*
-	 * These two are only present on filesystems with the CRC bits set.
-	 */
-	__be32		  dd_crc;	/* checksum */
-	__be64		  dd_lsn;	/* last modification in log */
-	uuid_t		  dd_uuid;	/* location information */
-} xfs_dqblk_t;
-
-#define XFS_DQUOT_CRC_OFF	offsetof(struct xfs_dqblk, dd_crc)
-
-/*
  * flags for q_flags field in the dquot.
  */
 #define XFS_DQ_USER		0x0001		/* a user quota */
@@ -113,60 +52,9 @@ typedef struct xfs_dqblk {
  */
 #define XFS_DQUOT_LOGRES(mp)	(sizeof(xfs_disk_dquot_t) * 3)
 
-
-/*
- * These are the structures used to lay out dquots and quotaoff
- * records on the log. Quite similar to those of inodes.
- */
-
-/*
- * log format struct for dquots.
- * The first two fields must be the type and size fitting into
- * 32 bits : log_recovery code assumes that.
- */
-typedef struct xfs_dq_logformat {
-	__uint16_t		qlf_type;      /* dquot log item type */
-	__uint16_t		qlf_size;      /* size of this item */
-	xfs_dqid_t		qlf_id;	       /* usr/grp/proj id : 32 bits */
-	__int64_t		qlf_blkno;     /* blkno of dquot buffer */
-	__int32_t		qlf_len;       /* len of dquot buffer */
-	__uint32_t		qlf_boffset;   /* off of dquot in buffer */
-} xfs_dq_logformat_t;
-
-/*
- * log format struct for QUOTAOFF records.
- * The first two fields must be the type and size fitting into
- * 32 bits : log_recovery code assumes that.
- * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
- * to the first and ensures that the first logitem is taken out of the AIL
- * only when the last one is securely committed.
- */
-typedef struct xfs_qoff_logformat {
-	unsigned short		qf_type;	/* quotaoff log item type */
-	unsigned short		qf_size;	/* size of this item */
-	unsigned int		qf_flags;	/* USR and/or GRP */
-	char			qf_pad[12];	/* padding for future */
-} xfs_qoff_logformat_t;
-
-
-/*
- * Disk quotas status in m_qflags, and also sb_qflags. 16 bits.
- */
-#define XFS_UQUOTA_ACCT	0x0001  /* user quota accounting ON */
-#define XFS_UQUOTA_ENFD	0x0002  /* user quota limits enforced */
-#define XFS_UQUOTA_CHKD	0x0004  /* quotacheck run on usr quotas */
-#define XFS_PQUOTA_ACCT	0x0008  /* project quota accounting ON */
-#define XFS_OQUOTA_ENFD	0x0010  /* other (grp/prj) quota limits enforced */
-#define XFS_OQUOTA_CHKD	0x0020  /* quotacheck run on other (grp/prj) quotas */
-#define XFS_GQUOTA_ACCT	0x0040  /* group quota accounting ON */
-
 /*
  * Quota Accounting/Enforcement flags
  */
-#define XFS_ALL_QUOTA_ACCT	\
-		(XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
-#define XFS_ALL_QUOTA_ENFD	(XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD)
-#define XFS_ALL_QUOTA_CHKD	(XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)
 
 #define XFS_IS_QUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
 #define XFS_IS_UQUOTA_RUNNING(mp)	((mp)->m_qflags & XFS_UQUOTA_ACCT)
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-06-19  5:36 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19  5:35 [PATCH 00/50] xfsprogs: patch queue for crc-dev Dave Chinner
2013-06-19  5:35 ` [PATCH 01/50] xfsprogs: introduce xfs_icreate.h Dave Chinner
2013-06-19  5:35 ` [PATCH 02/50] xfsprogs: port inode create transaction changes Dave Chinner
2013-06-19  5:35 ` [PATCH 03/50] xfsprogs: teach logprint about icreate transaction Dave Chinner
2013-06-19  5:35 ` [PATCH 04/50] libxfs: switch over to xfs_sb.c and remove xfs_mount.c Dave Chinner
2013-06-19  5:35 ` [PATCH 05/50] libxfs: move the transaction reservation structures Dave Chinner
2013-06-19  5:35 ` [PATCH 06/50] xfsprogs: remove xfs_mount.h Dave Chinner
2013-06-19  5:35 ` [PATCH 07/50] libxfs: update xfs_inode.h to match new kernel version Dave Chinner
2013-06-19  5:35 ` [PATCH 08/50] xfs: remove local fork format handling from xfs_bmapi_write() Dave Chinner
2013-06-19  5:35 ` [PATCH 09/50] libxfs: local to remote format support of remote symlinks Dave Chinner
2013-06-19  5:35 ` [PATCH 10/50] xfsprogs: sync minor kernel header differences Dave Chinner
2013-06-19  5:35 ` [PATCH 11/50] libxfs: introduce xfs_trans_resv.c Dave Chinner
2013-06-19  5:35 ` [PATCH 12/50] libxfs: fix directory/attribute format issues Dave Chinner
2013-06-19  5:35 ` [PATCH 13/50] libxfs: ensure btree root split sets blkno correctly Dave Chinner
2013-06-19  5:35 ` [PATCH 14/50] libxfs: move transaction code to trans.c Dave Chinner
2013-06-19  5:35 ` [PATCH 15/50] libxfs: fix byte swapping on constants Dave Chinner
2013-06-19  5:35 ` [PATCH 16/50] libxfs: sync xfs_da_btree.c Dave Chinner
2013-06-19  5:35 ` [PATCH 17/50] libxfs: update xfs_alloc to current kernel version Dave Chinner
2013-06-19  5:35 ` [PATCH 18/50] libxfs: sync attr code with kernel Dave Chinner
2013-06-19  5:35 ` [PATCH 19/50] libxfs: sync dir2 kernel differences Dave Chinner
2013-06-19  5:35 ` [PATCH 20/50] libxfs: sync xfs_ialloc.c to the kernel code Dave Chinner
2013-06-19  5:35 ` [PATCH 21/50] xfsprogs: define min/max once and use them everywhere Dave Chinner
2013-06-19  5:35 ` [PATCH 22/50] libxfs: fix compile warnings Dave Chinner
2013-06-19  5:35 ` [PATCH 23/50] xfsprogs: fix make deb Dave Chinner
2013-06-19  5:35 ` [PATCH 24/50] xfs: split out inode log item format definition Dave Chinner
2013-06-19  5:35 ` [PATCH 25/50] xfs: split out buf log item format definitions Dave Chinner
2013-06-19  5:35 ` [PATCH 26/50] xfs: move inode fork definitions to a new header file Dave Chinner
2013-06-19  5:35 ` [PATCH 27/50] xfs: move unrealted definitions out of xfs_inode.h Dave Chinner
2013-06-19  5:35 ` [PATCH 28/50] xfs: introduce xfs_inode_buf.c for inode buffer operations Dave Chinner
2013-06-19  5:35 ` [PATCH 29/50] xfs: move swap extent code to xfs_extent_ops Dave Chinner
2013-06-19  5:35 ` [PATCH 30/50] xfs: split out inode log item format definition Dave Chinner
2013-06-19  5:35 ` Dave Chinner [this message]
2013-06-19  5:35 ` [PATCH 32/50] xfs: separate icreate log format definitions from xfs_icreate_item.h Dave Chinner
2013-06-19  5:35 ` [PATCH 33/50] xfs: don't special case shared superblock mounts Dave Chinner
2013-06-19  5:35 ` [PATCH 34/50] xfs: kill __KERNEL__ check for debug code in allocation code Dave Chinner
2013-06-19  5:35 ` [PATCH 35/50] xfs: split out on-disk transaction definitions Dave Chinner
2013-06-19  5:35 ` [PATCH 36/50] xfs: remove __KERNEL__ from debug code Dave Chinner
2013-06-19  5:36 ` [PATCH 37/50] xfs: remove __KERNEL__ check from xfs_dir2_leaf.c Dave Chinner
2013-06-19  5:36 ` [PATCH 38/50] xfs: split out the remote symlink handling Dave Chinner
2013-06-19  5:36 ` [PATCH 39/50] xfs: separate out log format definitions Dave Chinner
2013-06-19  5:36 ` [PATCH 40/50] xfs: move kernel specific type definitions to xfs.h Dave Chinner
2013-06-19  5:36 ` [PATCH 41/50] xfs: make struct xfs_perag kernel only Dave Chinner
2013-06-19  5:36 ` [PATCH 42/50] xfs: create xfs_bmap_util.[ch] Dave Chinner
2013-06-19  5:36 ` [PATCH 43/50] xfs: introduce xfs_quota_defs.h Dave Chinner
2013-06-19  5:36 ` [PATCH 44/50] xfs: introduce xfs_rtalloc_defs.h Dave Chinner
2013-06-19  5:36 ` [PATCH 45/50] xfs: Introduce a new structure to hold transaction reservation items Dave Chinner
2013-06-19  5:36 ` [PATCH 46/50] xfs: Introduce tr_fsyncts to m_reservation Dave Chinner
2013-06-19  5:36 ` [PATCH 47/50] xfs: Make writeid transaction use tr_writeid Dave Chinner
2013-06-19  5:36 ` [PATCH 48/50] xfs: refactor xfs_trans_reserve() interface Dave Chinner
2013-06-19  5:36 ` [PATCH 49/50] xfs: Get rid of all XFS_XXX_LOG_RES() macro Dave Chinner
2013-06-19  5:36 ` [PATCH 50/50] xfs: Add xfs_log_rlimit.c Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371620173-712-32-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox