Skip to content

Commit

Permalink
xfs: reshuffle dir2 headers
Browse files Browse the repository at this point in the history
Replace the current mess of dir2 headers with just three that have a clear
purpose:

 - xfs_dir2_format.h for all format definitions, including the inline helpers
   to access our variable size structures
 - xfs_dir2_priv.h for all prototypes that are internal to the dir2 code
   and not needed by anything outside of the directory code.  For this
   purpose xfs_da_btree.c, and phase6.c in xfs_repair are considered part
   of the directory code.
 - xfs_dir2.h for the public interface to the directory code

In addition to the reshuffle I have also update the comments to not only
match the new file structure, but also to describe the directory format
better.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
  • Loading branch information
Christoph Hellwig committed Jul 13, 2011
1 parent 2bcf6e9 commit 5792664
Show file tree
Hide file tree
Showing 16 changed files with 751 additions and 900 deletions.
4 changes: 0 additions & 4 deletions fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_mount.h"
#include "xfs_itable.h"
#include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h"
#include "xfs_inode_item.h"
#include "xfs_extfree_item.h"
#include "xfs_alloc.h"
Expand Down
9 changes: 3 additions & 6 deletions fs/xfs/xfs_da_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,19 @@
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_dir2.h"
#include "xfs_dir2_format.h"
#include "xfs_dir2_priv.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_alloc.h"
#include "xfs_bmap.h"
#include "xfs_attr.h"
#include "xfs_attr_leaf.h"
#include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h"
#include "xfs_dir2_node.h"
#include "xfs_error.h"
#include "xfs_trace.h"

Expand Down
9 changes: 3 additions & 6 deletions fs/xfs/xfs_dir2.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_bmap.h"
#include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h"
#include "xfs_dir2_node.h"
#include "xfs_dir2.h"
#include "xfs_dir2_format.h"
#include "xfs_dir2_priv.h"
#include "xfs_error.h"
#include "xfs_vnodeops.h"
#include "xfs_trace.h"
Expand Down
54 changes: 4 additions & 50 deletions fs/xfs/xfs_dir2.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,14 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_DIR2_H__
#define __XFS_DIR2_H__
#define __XFS_DIR2_H__

struct uio;
struct xfs_dabuf;
struct xfs_da_args;
struct xfs_dir2_put_args;
struct xfs_bmap_free;
struct xfs_da_args;
struct xfs_inode;
struct xfs_mount;
struct xfs_trans;

/*
* Directory version 2.
* There are 4 possible formats:
* shortform
* single block - data with embedded leaf at the end
* multiple data blocks, single leaf+freeindex block
* data blocks, node&leaf blocks (btree), freeindex blocks
*
* The shortform format is in xfs_dir2_sf.h.
* The single block format is in xfs_dir2_block.h.
* The data block format is in xfs_dir2_data.h.
* The leaf and freeindex block formats are in xfs_dir2_leaf.h.
* Node blocks are the same as the other version, in xfs_da_btree.h.
*/

/*
* Byte offset in data block and shortform entry.
*/
typedef __uint16_t xfs_dir2_data_off_t;
#define NULLDATAOFF 0xffffU
typedef uint xfs_dir2_data_aoff_t; /* argument form */

/*
* Directory block number (logical dirblk in file)
*/
typedef __uint32_t xfs_dir2_db_t;

/*
* Byte offset in a directory.
*/
typedef xfs_off_t xfs_dir2_off_t;

extern struct xfs_name xfs_name_dotdot;

/*
Expand Down Expand Up @@ -86,21 +51,10 @@ extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
struct xfs_bmap_free *flist, xfs_extlen_t tot);
extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
struct xfs_name *name, uint resblks);
extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);

/*
* Utility routines for v2 directories.
* Direct call from the bmap code, bypassing the generic directory layer.
*/
extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
xfs_dir2_db_t *dbp);
extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp,
int *vp);
extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,
int *vp);
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
struct xfs_dabuf *bp);

extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
const unsigned char *name, int len);
extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);

#endif /* __XFS_DIR2_H__ */
7 changes: 2 additions & 5 deletions fs/xfs/xfs_dir2_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h"
#include "xfs_dir2_format.h"
#include "xfs_dir2_priv.h"
#include "xfs_error.h"
#include "xfs_trace.h"

Expand Down
93 changes: 0 additions & 93 deletions fs/xfs/xfs_dir2_block.h

This file was deleted.

7 changes: 2 additions & 5 deletions fs/xfs/xfs_dir2_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h"
#include "xfs_dir2_format.h"
#include "xfs_dir2_priv.h"
#include "xfs_error.h"

STATIC xfs_dir2_data_free_t *
Expand Down
Loading

0 comments on commit 5792664

Please sign in to comment.