Skip to contentSkip to conversation

xfs: more code movement for userspace

PATCH In review Dave Chinner 2 participants 8 messages Sep 5, 2013 – Sep 6, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

cover xfs: more code movement for userspace

Hi folks,

The following three patches move code around to help with userspace support and maintainance. The first patch is done because xfs_db requires access to all the verifiers that libxfs uses, so exporting them with eh disk formats they verify makes sense.

The second patch unifies all the directory and attribute on-disk format definitions in a single file - xfs_da_format.h - and switches all the code to include that.

The last patch is required for xfs_db to support reading, verifying and recalculating CRCs via libxfs, similar to what xfs_inode_buf.c supplies the userspace tools.

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH 1/3 xfs: move buf_ops externs to a xfs_format.h

All of the buffer operations structures are needed to be exported for xfs_db, so move them all to a common location rather than spreading them all over the place. They are verifying the on-disk format, so xfs_format.h is as good a place as any.

Don't move the dir2 buffer verifiers - they are already shared in a "central" place for all the dir2 and moving them just requires adding more include files...

---
 fs/xfs/xfs_ag.h           |  4 ----
 fs/xfs/xfs_alloc.h        |  3 ---
 fs/xfs/xfs_alloc_btree.h  |  2 --
 fs/xfs/xfs_attr_leaf.h    |  2 --
 fs/xfs/xfs_attr_remote.h  |  2 --
 fs/xfs/xfs_bmap_btree.h   |  2 --
 fs/xfs/xfs_da_btree.c     |  1 +
 fs/xfs/xfs_da_btree.h     |  2 --
 fs/xfs/xfs_dquot.h        |  2 --
 fs/xfs/xfs_format.h       | 23 +++++++++++++++++++++++
 fs/xfs/xfs_fsops.c        |  1 +
 fs/xfs/xfs_ialloc.c       |  1 +
 fs/xfs/xfs_ialloc.h       |  2 --
 fs/xfs/xfs_ialloc_btree.h |  2 --
 fs/xfs/xfs_inode_buf.h    |  3 ---
 fs/xfs/xfs_itable.c       |  1 +
 fs/xfs/xfs_quota.h        |  2 --
 fs/xfs/xfs_sb.h           |  3 ---
 18 files changed, 27 insertions(+), 31 deletions(-)
fs/xfs/xfs_ag.h +0 -4
index 1cb740a..3fc1098 100644
@@ -128,8 +128,6 @@ typedef struct xfs_agf {
 extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
 			xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
 
-extern const struct xfs_buf_ops xfs_agf_buf_ops;
-
 /*
  * Size of the unlinked inode hash table in the agi.
  */
@@ -191,8 +189,6 @@ typedef struct xfs_agi {
 extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
 				xfs_agnumber_t agno, struct xfs_buf **bpp);
 
-extern const struct xfs_buf_ops xfs_agi_buf_ops;
-
 /*
  * The third a.g. block contains the a.g. freelist, an array
  * of block pointers to blocks owned by the allocation btree code.
fs/xfs/xfs_alloc.h +0 -3
index 99d0a61..feacb06 100644
@@ -231,7 +231,4 @@ xfs_alloc_get_rec(
 	xfs_extlen_t		*len,	/* output: length of extent */
 	int			*stat);	/* output: success/failure */
 
-extern const struct xfs_buf_ops xfs_agf_buf_ops;
-extern const struct xfs_buf_ops xfs_agfl_buf_ops;
-
 #endif	/* __XFS_ALLOC_H__ */
fs/xfs/xfs_alloc_btree.h +0 -2
index e3a3f74..72676c3 100644
@@ -95,6 +95,4 @@ extern struct xfs_btree_cur *xfs_allocbt_init_cursor(struct xfs_mount *,
 		xfs_agnumber_t, xfs_btnum_t);
 extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int);
 
-extern const struct xfs_buf_ops xfs_allocbt_buf_ops;
-
 #endif	/* __XFS_ALLOC_BTREE_H__ */
fs/xfs/xfs_attr_leaf.h +0 -2
index c102213..da34e64 100644
@@ -336,6 +336,4 @@ void	xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to,
 void	xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to,
 				   struct xfs_attr3_icleaf_hdr *from);
 
-extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
-
 #endif	/* __XFS_ATTR_LEAF_H__ */
fs/xfs/xfs_attr_remote.h +0 -2
index 92a8fd7..b3e1e1b 100644
@@ -45,8 +45,6 @@ struct xfs_attr3_rmt_hdr {
 	((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
 			sizeof(struct xfs_attr3_rmt_hdr) : 0))
 
-extern const struct xfs_buf_ops xfs_attr3_rmt_buf_ops;
-
 int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);
 
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
fs/xfs/xfs_bmap_btree.h +0 -2
index e367461..e2b0768 100644
@@ -243,6 +243,4 @@ extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
 extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_inode *, int);
 
-extern const struct xfs_buf_ops xfs_bmbt_buf_ops;
-
 #endif	/* __XFS_BMAP_BTREE_H__ */
fs/xfs/xfs_da_btree.c +1 -0
index 069537c..459e9d9 100644
@@ -19,6 +19,7 @@
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
fs/xfs/xfs_da_btree.h +0 -2
index b1f2679..a762cfa 100644
@@ -309,8 +309,6 @@ int	xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp,
 			 xfs_dablk_t bno, xfs_daddr_t mappedbno,
 			 struct xfs_buf **bpp, int which_fork);
 
-extern const struct xfs_buf_ops xfs_da3_node_buf_ops;
-
 /*
  * Utility routines.
  */
fs/xfs/xfs_dquot.h +0 -2
index 55abbca..d22ed00 100644
@@ -172,6 +172,4 @@ static inline struct xfs_dquot *xfs_qm_dqhold(struct xfs_dquot *dqp)
 	return dqp;
 }
 
-extern const struct xfs_buf_ops xfs_dquot_buf_ops;
-
 #endif /* __XFS_DQUOT_H__ */
fs/xfs/xfs_format.h +23 -0
index 35c08ff..ead7fc2 100644
@@ -34,6 +34,29 @@ struct xfs_buf;
 struct xfs_ifork;
 
 /*
+ * Central location for exporting buffer verifier operations as they are
+ * widely used, including userspace tools
+ */
+extern const struct xfs_buf_ops xfs_agf_buf_ops;
+extern const struct xfs_buf_ops xfs_agi_buf_ops;
+extern const struct xfs_buf_ops xfs_agf_buf_ops;
+extern const struct xfs_buf_ops xfs_agfl_buf_ops;
+extern const struct xfs_buf_ops xfs_allocbt_buf_ops;
+extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
+extern const struct xfs_buf_ops xfs_attr3_rmt_buf_ops;
+extern const struct xfs_buf_ops xfs_bmbt_buf_ops;
+extern const struct xfs_buf_ops xfs_da3_node_buf_ops;
+extern const struct xfs_buf_ops xfs_dquot_buf_ops;
+extern const struct xfs_buf_ops xfs_symlink_buf_ops;
+extern const struct xfs_buf_ops xfs_agi_buf_ops;
+extern const struct xfs_buf_ops xfs_inobt_buf_ops;
+extern const struct xfs_buf_ops xfs_inode_buf_ops;
+extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
+extern const struct xfs_buf_ops xfs_dquot_buf_ops;
+extern const struct xfs_buf_ops xfs_sb_buf_ops;
+extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
+
+/*
  * RealTime Device format definitions
  */
 
fs/xfs/xfs_fsops.c +1 -0
index e64ee52..f319f5d 100644
@@ -18,6 +18,7 @@
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
fs/xfs/xfs_ialloc.c +1 -0
index ccf2fb1..d565adf 100644
@@ -18,6 +18,7 @@
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_bit.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
fs/xfs/xfs_ialloc.h +0 -2
index 68c0732..1557798 100644
@@ -158,6 +158,4 @@ int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
 			  xfs_agnumber_t agno, xfs_agblock_t agbno,
 			  xfs_agblock_t length, unsigned int gen);
 
-extern const struct xfs_buf_ops xfs_agi_buf_ops;
-
 #endif	/* __XFS_IALLOC_H__ */
fs/xfs/xfs_ialloc_btree.h +0 -2
index 3ac36b76..cfbfe46 100644
@@ -110,6 +110,4 @@ extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *,
 		struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t);
 extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
 
-extern const struct xfs_buf_ops xfs_inobt_buf_ops;
-
 #endif	/* __XFS_IALLOC_BTREE_H__ */
fs/xfs/xfs_inode_buf.h +0 -3
index abba0ae..9308c47 100644
@@ -47,7 +47,4 @@ void	xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
 #define	xfs_inobp_check(mp, bp)
 #endif /* DEBUG */
 
-extern const struct xfs_buf_ops xfs_inode_buf_ops;
-extern const struct xfs_buf_ops xfs_inode_buf_ra_ops;
-
 #endif	/* __XFS_INODE_BUF_H__ */
fs/xfs/xfs_itable.c +1 -0
index 084b3e1..1399163 100644
@@ -18,6 +18,7 @@
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
+#include "xfs_format.h"
 #include "xfs_log.h"
 #include "xfs_inum.h"
 #include "xfs_trans.h"
fs/xfs/xfs_quota.h +0 -2
index e7d84d2..84661d4 100644
@@ -154,6 +154,4 @@ extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
 				xfs_dqid_t, uint, uint, char *);
 extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
 
-extern const struct xfs_buf_ops xfs_dquot_buf_ops;
-
 #endif	/* __XFS_QUOTA_H__ */
fs/xfs/xfs_sb.h +0 -3
index 6835b44..35061d4 100644
@@ -699,7 +699,4 @@ 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__ */
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

Re: [PATCH 1/3] xfs: move buf_ops externs to a xfs_format.h

Quoted 8 lines · Dave Chinner

All of the buffer operations structures are needed to be exported for xfs_db, so move them all to a common location rather than spreading them all over the place. They are verifying the on-disk format, so xfs_format.h is as good a place as any.

Don't move the dir2 buffer verifiers - they are already shared in a "central" place for all the dir2 and moving them just requires adding more include files...

Please only keep the actual format in the _format.h headers and use a different shared header for incore bits that can be shared.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

Re: [PATCH 1/3] xfs: move buf_ops externs to a xfs_format.h

Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Dave Chinner

All of the buffer operations structures are needed to be exported for xfs_db, so move them all to a common location rather than spreading them all over the place. They are verifying the on-disk format, so xfs_format.h is as good a place as any.

Quoted 6 lines
Quoted 3 lines

Don't move the dir2 buffer verifiers - they are already shared in a "central" place for all the dir2 and moving them just requires adding more include files...

Please only keep the actual format in the _format.h headers and use a different shared header for incore bits that can be shared.

Fair enough - I thought about that, but then realised we don't really have any "global" shared header files that fit this purpose. The only two really are xfs_fs.h - which is used for ioctl interface definitions - and xfs_types.h which is used for type definitions, not structure instances...

So I'm not really sure where we'd put something like this without creating a new header file, and I don't really want to do that, either.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

Re: [PATCH 1/3] xfs: move buf_ops externs to a xfs_format.h

Quoted 9 lines · Dave Chinner

Fair enough - I thought about that, but then realised we don't really have any "global" shared header files that fit this purpose. The only two really are xfs_fs.h - which is used for ioctl interface definitions - and xfs_types.h which is used for type definitions, not structure instances...

So I'm not really sure where we'd put something like this without creating a new header file, and I don't really want to do that, either.

We might need a new one, the headers still need major work anyway.

If we start with

xfs*_format.h - purely disk format xfs_fs.h - ioctl and userspace ABI constants

an

xfs_shared.h

and
xfs_kernel.h

seem like logical additions to move most of the misc headers to instead of all the silly ones for just a handful or two worth of prototypes.

Note that a few non-format bits already sneaked into xfs_format.h unfortunately, guess I need to watch more closely :)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw

Re: [PATCH 1/3] xfs: move buf_ops externs to a xfs_format.h

Quoted 18 lines · Christoph Hellwig
Quoted 9 lines · Dave Chinner

Fair enough - I thought about that, but then realised we don't really have any "global" shared header files that fit this purpose. The only two really are xfs_fs.h - which is used for ioctl interface definitions - and xfs_types.h which is used for type definitions, not structure instances...

So I'm not really sure where we'd put something like this without creating a new header file, and I don't really want to do that, either.

We might need a new one, the headers still need major work anyway.

If we start with

xfs*_format.h - purely disk format xfs_fs.h - ioctl and userspace ABI constants

Quoted 6 lines

an

xfs_shared.h

and
xfs_kernel.h

OK. I'm not a great fan of the "xfs_shared.h" name, I'll see if I can come up with something better....

Quoted 5 lines

seem like logical additions to move most of the misc headers to instead of all the silly ones for just a handful or two worth of prototypes.

Note that a few non-format bits already sneaked into xfs_format.h unfortunately, guess I need to watch more closely :)

They did, for the same reason as I put these ones there. I'll move them to the "xfs_shared.h" once I create it....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw

PATCH 2/3 xfs: unify directory/attribute format definitions

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The on-disk format definitions for the directory and attribute structures are spread across 3 header files right now, only one of which is dedicated to defining on-disk structures and their manipulation (xfs_dir2_format.h). Pull all the format definitions into a single header file - xfs_da_format.h - and switch all the code over to point at that.

---
 fs/xfs/xfs_attr.c          |    1 +
 fs/xfs/xfs_attr_inactive.c |    1 +
 fs/xfs/xfs_attr_leaf.c     |    1 +
 fs/xfs/xfs_attr_leaf.h     |  230 --------
 fs/xfs/xfs_attr_list.c     |    1 +
 fs/xfs/xfs_attr_remote.c   |    1 +
 fs/xfs/xfs_attr_remote.h   |   27 -
 fs/xfs/xfs_bmap.c          |    2 +-
 fs/xfs/xfs_bmap_util.c     |    2 +-
 fs/xfs/xfs_da_btree.c      |    2 +-
 fs/xfs/xfs_da_btree.h      |  140 -----
 fs/xfs/xfs_da_format.h     | 1373 ++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_dir2.c          |    2 +-
 fs/xfs/xfs_dir2_block.c    |    2 +-
 fs/xfs/xfs_dir2_data.c     |    2 +-
 fs/xfs/xfs_dir2_format.h   |  975 -------------------------------
 fs/xfs/xfs_dir2_leaf.c     |    2 +-
 fs/xfs/xfs_dir2_node.c     |    2 +-
 fs/xfs/xfs_dir2_readdir.c  |    2 +-
 fs/xfs/xfs_dir2_sf.c       |    2 +-
 fs/xfs/xfs_export.c        |    3 +-
 fs/xfs/xfs_file.c          |    4 +-
 fs/xfs/xfs_inode.c         |    2 +-
 fs/xfs/xfs_iops.c          |    2 +-
 fs/xfs/xfs_log_recover.c   |    2 +-
 fs/xfs/xfs_log_rlimit.c    |    1 +
 fs/xfs/xfs_mount.c         |    3 +-
 fs/xfs/xfs_sb.c            |    2 +-
 fs/xfs/xfs_super.c         |    2 +-
 fs/xfs/xfs_symlink.c       |    3 +-
 fs/xfs/xfs_trace.c         |    3 +-
 fs/xfs/xfs_trans.c         |    2 +-
 fs/xfs/xfs_trans_resv.c    |    1 +
 fs/xfs/xfs_xattr.c         |    7 +-
 34 files changed, 1409 insertions(+), 1398 deletions(-)
 create mode 100644 fs/xfs/xfs_da_format.h
 delete mode 100644 fs/xfs/xfs_dir2_format.h
fs/xfs/xfs_attr.c +1 -0
index ddcf226..63430c2 100644
@@ -25,6 +25,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_attr_sf.h"
fs/xfs/xfs_attr_inactive.c +1 -0
index bb24b07..e1749bd 100644
@@ -25,6 +25,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
fs/xfs/xfs_attr_leaf.c +1 -0
index 86db20a..94838fe 100644
@@ -26,6 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
fs/xfs/xfs_attr_leaf.h +0 -230

242 lines not on this page · raw message

fs/xfs/xfs_attr_list.c +1 -0
index cbc80d4..8ba8e4b 100644
@@ -25,6 +25,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
fs/xfs/xfs_attr_remote.c +1 -0
index 712a502..578f21b 100644
@@ -26,6 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_error.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
fs/xfs/xfs_attr_remote.h +0 -27
index b3e1e1b..5a9acfa 100644
@@ -18,33 +18,6 @@
 #ifndef __XFS_ATTR_REMOTE_H__
 #define	__XFS_ATTR_REMOTE_H__
 
-#define XFS_ATTR3_RMT_MAGIC	0x5841524d	/* XARM */
-
-/*
- * There is one of these headers per filesystem block in a remote attribute.
- * This is done to ensure there is a 1:1 mapping between the attribute value
- * length and the number of blocks needed to store the attribute. This makes the
- * verification of a buffer a little more complex, but greatly simplifies the
- * allocation, reading and writing of these attributes as we don't have to guess
- * the number of blocks needed to store the attribute data.
- */
-struct xfs_attr3_rmt_hdr {
-	__be32	rm_magic;
-	__be32	rm_offset;
-	__be32	rm_bytes;
-	__be32	rm_crc;
-	uuid_t	rm_uuid;
-	__be64	rm_owner;
-	__be64	rm_blkno;
-	__be64	rm_lsn;
-};
-
-#define XFS_ATTR3_RMT_CRC_OFF	offsetof(struct xfs_attr3_rmt_hdr, rm_crc)
-
-#define XFS_ATTR3_RMT_BUF_SPACE(mp, bufsize)	\
-	((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
-			sizeof(struct xfs_attr3_rmt_hdr) : 0))
-
 int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);
 
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
fs/xfs/xfs_bmap.c +1 -1
index f47e65c..d4c035f 100644
@@ -25,8 +25,8 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
fs/xfs/xfs_bmap_util.c +1 -1
index 97f952c..2b865b9 100644
@@ -26,7 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
-#include "xfs_da_btree.h"
+#include "xfs_da_format.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
fs/xfs/xfs_da_btree.c +1 -1
index 459e9d9..37380e2 100644
@@ -26,9 +26,9 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_dinode.h"
fs/xfs/xfs_da_btree.h +0 -140

146 lines not on this page · raw message

fs/xfs/xfs_da_format.h new file +1373 -0

1,373 lines not on this page · raw message

fs/xfs/xfs_dir2.c +1 -1
index edf203a..f46777f 100644
@@ -24,6 +24,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
@@ -31,7 +32,6 @@
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_block.c +1 -1
index 0957aa9..bd8e7ed 100644
@@ -24,6 +24,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
@@ -31,7 +32,6 @@
 #include "xfs_inode_item.h"
 #include "xfs_bmap.h"
 #include "xfs_buf_item.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_data.c +1 -1
index 47e1326..8cf8034 100644
@@ -24,11 +24,11 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_format.h deleted +0 -975

975 lines not on this page · raw message

fs/xfs/xfs_dir2_leaf.c +1 -1
index fb57893..2863b24 100644
@@ -25,12 +25,12 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_node.c +1 -1
index 4c3dba7..6d12a9a 100644
@@ -24,12 +24,12 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_bmap.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_readdir.c +1 -1
index 8993ec1..69b2b6c 100644
@@ -25,11 +25,11 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
fs/xfs/xfs_dir2_sf.c +1 -1
index bb6e284..044d117 100644
@@ -23,13 +23,13 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_error.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_trace.h"
fs/xfs/xfs_export.c +1 -2
index 066df42..96be1d6 100644
@@ -22,8 +22,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
-#include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
+#include "xfs_da_format.h"
 #include "xfs_dir2.h"
 #include "xfs_export.h"
 #include "xfs_bmap_btree.h"
fs/xfs/xfs_file.c +2 -2
index 4c749ab..f3ee034 100644
@@ -22,6 +22,8 @@
 #include "xfs_ag.h"
 #include "xfs_trans.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc.h"
 #include "xfs_dinode.h"
@@ -30,8 +32,6 @@
 #include "xfs_bmap.h"
 #include "xfs_bmap_util.h"
 #include "xfs_error.h"
-#include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_ioctl.h"
fs/xfs/xfs_inode.c +1 -1
index e3d7538..0921666 100644
@@ -28,8 +28,8 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
fs/xfs/xfs_iops.c +1 -1
index 2b8952d..9212286 100644
@@ -26,6 +26,7 @@
 #include "xfs_alloc.h"
 #include "xfs_quota.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
@@ -41,7 +42,6 @@
 #include "xfs_icache.h"
 #include "xfs_symlink.h"
 #include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2_priv.h"
 
 #include <linux/capability.h>
fs/xfs/xfs_log_recover.c +1 -1
index 5868297..ff64733 100644
@@ -26,6 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_error.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
@@ -50,7 +51,6 @@
 /* Need all the magic numbers and buffer ops structures from these headers */
 #include "xfs_symlink.h"
 #include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
 #include "xfs_dir2.h"
 #include "xfs_attr_leaf.h"
 #include "xfs_attr_remote.h"
fs/xfs/xfs_log_rlimit.c +1 -0
index bbcec0b..ea9258a 100644
@@ -22,6 +22,7 @@
 #include "xfs_ag.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
+#include "xfs_da_format.h"
 #include "xfs_trans_space.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_inode.h"
fs/xfs/xfs_mount.c +1 -2
index 5dcc680..8ac98c7 100644
@@ -26,8 +26,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_mount.h"
-#include "xfs_da_btree.h"
-#include "xfs_dir2_format.h"
+#include "xfs_da_format.h"
 #include "xfs_dir2.h"
 #include "xfs_bmap_btree.h"
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_sb.c +1 -1
index a5b59d9..ed2b3c6 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_super.c +1 -1
index 979a77d..8075d9f 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_symlink.c +1 -2
index f622a97..d8702e5 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_trace.c +2 -1
index 5d7b3e4..9f4c0a0 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_trans.c +1 -1
index 5411e01..7d84cef 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_trans_resv.c +1 -0
index a65a3cc..14317fa 100644

Lines of this file are not shown. View the raw message.

fs/xfs/xfs_xattr.c +6 -1
index e01f35e..0804750 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH 3/3 xfs: split dquot buffer operations out

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Parts of userspace want to be able to read and modify dquot buffers (e.g. xfs_db) so we need to split out the reading and writing of these buffers so it is easy to shared code with libxfs in userspace.

---
 fs/xfs/Makefile          |   1 +
 fs/xfs/xfs_dquot.c       | 117 +------------------
 fs/xfs/xfs_dquot_buf.c   | 288 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_log_recover.c | 133 +---------------------
 fs/xfs/xfs_qm.c          |  20 +---
 fs/xfs/xfs_qm.h          |   2 +-
 fs/xfs/xfs_quota.h       |   2 +-
 7 files changed, 300 insertions(+), 263 deletions(-)
 create mode 100644 fs/xfs/xfs_dquot_buf.c
fs/xfs/Makefile +1 -0
index 0719e4d..08f11bb 100644
@@ -72,6 +72,7 @@ xfs-y				+= xfs_alloc.o \
 				   xfs_dir2_leaf.o \
 				   xfs_dir2_node.o \
 				   xfs_dir2_sf.o \
+				   xfs_dquot_buf.o \
 				   xfs_ialloc.o \
 				   xfs_ialloc_btree.o \
 				   xfs_icreate_item.o \
fs/xfs/xfs_dquot.c +3 -114

141 lines not on this page · raw message

fs/xfs/xfs_dquot_buf.c new file +288 -0

288 lines not on this page · raw message

fs/xfs/xfs_log_recover.c +3 -130

157 lines not on this page · raw message

fs/xfs/xfs_qm.c +3 -17
index 6218a0a..b0b18a1 100644
@@ -666,20 +666,6 @@ xfs_qm_dqdetach(
 	}
 }
 
-int
-xfs_qm_calc_dquots_per_chunk(
-	struct xfs_mount	*mp,
-	unsigned int		nbblks)	/* basic block units */
-{
-	unsigned int	ndquots;
-
-	ASSERT(nbblks > 0);
-	ndquots = BBTOB(nbblks);
-	do_div(ndquots, sizeof(xfs_dqblk_t));
-
-	return ndquots;
-}
-
 /*
  * This initializes all the quota information that's kept in the
  * mount structure
@@ -720,7 +706,7 @@ xfs_qm_init_quotainfo(
 
 	/* Precalc some constants */
 	qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
-	qinf->qi_dqperchunk = xfs_qm_calc_dquots_per_chunk(mp,
+	qinf->qi_dqperchunk = xfs_calc_dquots_per_chunk(mp,
 							qinf->qi_dqchunklen);
 
 	mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD);
@@ -951,9 +937,9 @@ xfs_qm_reset_dqcounts(
 		/*
 		 * Do a sanity check, and if needed, repair the dqblk. Don't
 		 * output any warnings because it's perfectly possible to
-		 * find uninitialised dquot blks. See comment in xfs_qm_dqcheck.
+		 * find uninitialised dquot blks. See comment in xfs_dqcheck.
 		 */
-		(void) xfs_qm_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
+		(void) xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
 				      "xfs_quotacheck");
 		ddq->d_bcount = 0;
 		ddq->d_icount = 0;
fs/xfs/xfs_qm.h +1 -1
index 670cd44..ab9485c 100644
@@ -105,7 +105,7 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp)
 	return NULL;
 }
 
-extern int	xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp,
+extern int	xfs_calc_dquots_per_chunk(struct xfs_mount *mp,
 					     unsigned int nbblks);
 extern void	xfs_trans_mod_dquot(struct xfs_trans *,
 					struct xfs_dquot *, uint, long);
fs/xfs/xfs_quota.h +1 -1
index 84661d4..2ce9cd7 100644
@@ -150,7 +150,7 @@ static inline int xfs_trans_reserve_quota_bydquots(struct xfs_trans *tp,
 	xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, pd, nb, ni, \
 				f | XFS_QMOPT_RES_REGBLKS)
 
-extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
+extern int xfs_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
 				xfs_dqid_t, uint, uint, char *);
 extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
 
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs