提交 a844f451 编写于 作者: N Nathan Scott

[XFS] Remove xfs_macros.c, xfs_macros.h, rework headers a whole lot.

SGI-PV: 943122
SGI-Modid: xfs-linux:xfs-kern:23901a
Signed-off-by: NNathan Scott <nathans@sgi.com>
上级 61c1e689
...@@ -29,11 +29,12 @@ ...@@ -29,11 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_trans.h" #include "xfs_trans.h"
...@@ -42,13 +43,13 @@ ...@@ -42,13 +43,13 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_iomap.h" #include "xfs_iomap.h"
......
...@@ -29,11 +29,12 @@ ...@@ -29,11 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_trans.h" #include "xfs_trans.h"
......
...@@ -29,39 +29,38 @@ ...@@ -29,39 +29,38 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_btree.h"
#include "xfs_bit.h" #include "xfs_ialloc.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
#include "xfs_mac.h" #include "xfs_mac.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_bmap.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_dfrag.h" #include "xfs_dfrag.h"
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,18 +43,17 @@ ...@@ -43,18 +43,17 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
......
...@@ -29,16 +29,11 @@ ...@@ -29,16 +29,11 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* fs/xfs/linux/xfs_lrw.c (Linux Read Write stuff)
*
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -48,18 +43,17 @@ ...@@ -48,18 +43,17 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
......
...@@ -107,9 +107,4 @@ extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *, ...@@ -107,9 +107,4 @@ extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
extern int xfs_dev_is_read_only(struct xfs_mount *, char *); extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
#define XFS_FSB_TO_DB_IO(io,fsb) \
(((io)->io_flags & XFS_IOCORE_RT) ? \
XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
#endif /* __XFS_LRW_H__ */ #endif /* __XFS_LRW_H__ */
...@@ -29,32 +29,31 @@ ...@@ -29,32 +29,31 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_bit.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_clnt.h" #include "xfs_clnt.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_rw.h"
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -76,7 +74,7 @@ xfs_stats_clear_proc_handler( ...@@ -76,7 +74,7 @@ xfs_stats_clear_proc_handler(
STATIC ctl_table xfs_table[] = { STATIC ctl_table xfs_table[] = {
{XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val, {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max}, &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
{XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val, {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
...@@ -86,22 +84,22 @@ STATIC ctl_table xfs_table[] = { ...@@ -86,22 +84,22 @@ STATIC ctl_table xfs_table[] = {
{XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val, {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max}, &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val, {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.panic_mask.min, &xfs_params.panic_mask.max}, &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
{XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val, {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.error_level.min, &xfs_params.error_level.max}, &xfs_params.error_level.min, &xfs_params.error_level.max},
{XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val, {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max}, &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
{XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val, {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
...@@ -118,7 +116,7 @@ STATIC ctl_table xfs_table[] = { ...@@ -118,7 +116,7 @@ STATIC ctl_table xfs_table[] = {
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max}, &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
{XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val, {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
...@@ -136,14 +134,14 @@ STATIC ctl_table xfs_table[] = { ...@@ -136,14 +134,14 @@ STATIC ctl_table xfs_table[] = {
{XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val, {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.rotorstep.min, &xfs_params.rotorstep.max}, &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
/* please keep this the last entry */ /* please keep this the last entry */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
{XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val, {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler, sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.stats_clear.min, &xfs_params.stats_clear.max}, &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
......
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_clnt.h" #include "xfs_clnt.h"
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,18 +44,17 @@ ...@@ -43,18 +44,17 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,18 +44,17 @@ ...@@ -43,18 +44,17 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_qm.h" #include "xfs_qm.h"
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_clnt.h" #include "xfs_clnt.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
...@@ -44,21 +45,20 @@ ...@@ -44,21 +45,20 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_btree.h"
#include "xfs_bit.h" #include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_bmap.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_qm.h" #include "xfs_qm.h"
/* /*
......
...@@ -32,39 +32,39 @@ ...@@ -32,39 +32,39 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_clnt.h" #include "xfs_clnt.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_btree.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
#include "xfs_mac.h" #include "xfs_mac.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_qm.h" #include "xfs_qm.h"
#define MNTOPT_QUOTA "quota" /* disk quotas (user) */ #define MNTOPT_QUOTA "quota" /* disk quotas (user) */
......
...@@ -32,31 +32,32 @@ ...@@ -32,31 +32,32 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
......
...@@ -32,31 +32,32 @@ ...@@ -32,31 +32,32 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
...@@ -64,7 +65,6 @@ ...@@ -64,7 +65,6 @@
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_qm.h" #include "xfs_qm.h"
#ifdef DEBUG #ifdef DEBUG
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,21 +44,20 @@ ...@@ -43,21 +44,20 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_btree.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_cap.h" #include "xfs_cap.h"
......
...@@ -34,7 +34,4 @@ ...@@ -34,7 +34,4 @@
#include <linux-2.6/xfs_linux.h> #include <linux-2.6/xfs_linux.h>
#include <xfs_fs.h>
#include <xfs_macros.h>
#endif /* __XFS_H__ */ #endif /* __XFS_H__ */
...@@ -29,21 +29,23 @@ ...@@ -29,21 +29,23 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_types.h"
#include "xfs_bit.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_mac.h" #include "xfs_mac.h"
#include "xfs_attr.h" #include "xfs_attr.h"
......
...@@ -46,18 +46,9 @@ struct xfs_trans; ...@@ -46,18 +46,9 @@ struct xfs_trans;
#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ #define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
#define XFS_AGF_VERSION 1 #define XFS_AGF_VERSION 1
#define XFS_AGI_VERSION 1 #define XFS_AGI_VERSION 1
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_GOOD_VERSION)
int xfs_agf_good_version(unsigned v); #define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v) #define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
#else
#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_GOOD_VERSION)
int xfs_agi_good_version(unsigned v);
#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v)
#else
#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
#endif
/* /*
* Btree number 0 is bno, 1 is cnt. This value gives the size of the * Btree number 0 is bno, 1 is cnt. This value gives the size of the
...@@ -110,12 +101,9 @@ typedef struct xfs_agf ...@@ -110,12 +101,9 @@ typedef struct xfs_agf
/* disk block (xfs_daddr_t) in the AG */ /* disk block (xfs_daddr_t) in the AG */
#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_BLOCK) #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
xfs_agblock_t xfs_agf_block(struct xfs_mount *mp); #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp)
#else
#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
#endif
/* /*
* Size of the unlinked inode hash table in the agi. * Size of the unlinked inode hash table in the agi.
...@@ -165,25 +153,17 @@ typedef struct xfs_agi ...@@ -165,25 +153,17 @@ typedef struct xfs_agi
/* disk block (xfs_daddr_t) in the AG */ /* disk block (xfs_daddr_t) in the AG */
#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_BLOCK) #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
xfs_agblock_t xfs_agi_block(struct xfs_mount *mp); #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp)
#else
#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
#endif
/* /*
* The third a.g. block contains the a.g. freelist, an array * The third a.g. block contains the a.g. freelist, an array
* of block pointers to blocks owned by the allocation btree code. * of block pointers to blocks owned by the allocation btree code.
*/ */
#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGFL_BLOCK) #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
xfs_agblock_t xfs_agfl_block(struct xfs_mount *mp);
#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp)
#else
#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
#endif
#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t)) #define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
typedef struct xfs_agfl { typedef struct xfs_agfl {
xfs_agblock_t agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ xfs_agblock_t agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */
...@@ -230,116 +210,38 @@ typedef struct xfs_perag ...@@ -230,116 +210,38 @@ typedef struct xfs_perag
xfs_perag_busy_t *pagb_list; /* unstable blocks */ xfs_perag_busy_t *pagb_list; /* unstable blocks */
} xfs_perag_t; } xfs_perag_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAXLEVELS) #define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
int xfs_ag_maxlevels(struct xfs_mount *mp); #define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp) (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
#else #define XFS_MIN_FREELIST(a,mp) \
#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) (XFS_MIN_FREELIST_RAW( \
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST)
int xfs_min_freelist(xfs_agf_t *a, struct xfs_mount *mp);
#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp)
#else
#define XFS_MIN_FREELIST(a,mp) \
XFS_MIN_FREELIST_RAW( \
INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \ INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \
INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp) INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_PAG)
int xfs_min_freelist_pag(xfs_perag_t *pag, struct xfs_mount *mp);
#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp)
#else
#define XFS_MIN_FREELIST_PAG(pag,mp) \ #define XFS_MIN_FREELIST_PAG(pag,mp) \
XFS_MIN_FREELIST_RAW((uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \ (XFS_MIN_FREELIST_RAW( \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp) (uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
#endif (uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_RAW)
int xfs_min_freelist_raw(int bl, int cl, struct xfs_mount *mp);
#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp)
#else
#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
(MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + \
MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_FSB) #define XFS_AGB_TO_FSB(mp,agno,agbno) \
xfs_fsblock_t xfs_agb_to_fsb(struct xfs_mount *mp, xfs_agnumber_t agno,
xfs_agblock_t agbno);
#define XFS_AGB_TO_FSB(mp,agno,agbno) xfs_agb_to_fsb(mp,agno,agbno)
#else
#define XFS_AGB_TO_FSB(mp,agno,agbno) \
(((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno)) (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
#endif #define XFS_FSB_TO_AGNO(mp,fsbno) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGNO)
xfs_agnumber_t xfs_fsb_to_agno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno)
#else
#define XFS_FSB_TO_AGNO(mp,fsbno) \
((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
#endif #define XFS_FSB_TO_AGBNO(mp,fsbno) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGBNO)
xfs_agblock_t xfs_fsb_to_agbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno)
#else
#define XFS_FSB_TO_AGBNO(mp,fsbno) \
((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog)))
#endif #define XFS_AGB_TO_DADDR(mp,agno,agbno) \
((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_DADDR) (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, #define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
xfs_agblock_t agbno);
#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno)
#else
#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
((xfs_daddr_t)(XFS_FSB_TO_BB(mp, \
(xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno))))
#endif
/*
* XFS_DADDR_TO_AGNO and XFS_DADDR_TO_AGBNO moved to xfs_mount.h
* to avoid header file ordering change
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_DADDR)
xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
xfs_daddr_t d);
#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d)
#else
#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGF)
xfs_agf_t *xfs_buf_to_agf(struct xfs_buf *bp);
#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp)
#else
#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGI)
xfs_agi_t *xfs_buf_to_agi(struct xfs_buf *bp);
#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp)
#else
#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGFL)
xfs_agfl_t *xfs_buf_to_agfl(struct xfs_buf *bp);
#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp)
#else
#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
#endif
/* /*
* For checking for bad ranges of xfs_daddr_t's, covering multiple * For checking for bad ranges of xfs_daddr_t's, covering multiple
* allocation groups or a single xfs_daddr_t that's a superblock copy. * allocation groups or a single xfs_daddr_t that's a superblock copy.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_CHECK_DADDR)
void xfs_ag_check_daddr(struct xfs_mount *mp, xfs_daddr_t d, xfs_extlen_t len);
#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len)
#else
#define XFS_AG_CHECK_DADDR(mp,d,len) \ #define XFS_AG_CHECK_DADDR(mp,d,len) \
((len) == 1 ? \ ((len) == 1 ? \
ASSERT((d) == XFS_SB_DADDR || \ ASSERT((d) == XFS_SB_DADDR || \
XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \
ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \ ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \
XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1))) XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1)))
#endif
#endif /* __XFS_AG_H__ */ #endif /* __XFS_AG_H__ */
...@@ -29,28 +29,30 @@ ...@@ -29,28 +29,30 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* Free space allocation for XFS.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_bit.h"
#include "xfs_error.h" #include "xfs_error.h"
......
...@@ -29,25 +29,27 @@ ...@@ -29,25 +29,27 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* Free space allocation for XFS.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
......
...@@ -62,38 +62,14 @@ typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */ ...@@ -62,38 +62,14 @@ typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */
/* btree block header type */ /* btree block header type */
typedef struct xfs_btree_sblock xfs_alloc_block_t; typedef struct xfs_btree_sblock xfs_alloc_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_ALLOC_BLOCK) #define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp))
xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp);
#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp)
#else
#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp)))
#endif
/* /*
* Real block structures have a size equal to the disk block size. * Real block structures have a size equal to the disk block size.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_SIZE)
int xfs_alloc_block_size(int lev, struct xfs_btree_cur *cur);
#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur)
#else
#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) #define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif #define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_alloc_mxr[lev != 0])
#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_alloc_mnr[lev != 0])
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS)
int xfs_alloc_block_maxrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur)
#else
#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mxr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS)
int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur)
#else
#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mnr[lev != 0])
#endif
/* /*
* Minimum and maximum blocksize and sectorsize. * Minimum and maximum blocksize and sectorsize.
...@@ -113,145 +89,80 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur); ...@@ -113,145 +89,80 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
* Block numbers in the AG: * Block numbers in the AG:
* SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3. * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
xfs_agblock_t xfs_bno_block(struct xfs_mount *mp);
#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp)
#else
#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1)) #define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK)
xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp);
#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp)
#else
#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1)) #define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1))
#endif
/* /*
* Record, key, and pointer address macros for btree blocks. * Record, key, and pointer address macros for btree blocks.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_REC_ADDR)
xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur)
#else
#define XFS_ALLOC_REC_ADDR(bb,i,cur) \ #define XFS_ALLOC_REC_ADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, bb, i, \ XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, \
XFS_ALLOC_BLOCK_MAXRECS(0, cur)) bb, i, XFS_ALLOC_BLOCK_MAXRECS(0, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_KEY_ADDR)
xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur)
#else
#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \ #define XFS_ALLOC_KEY_ADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur)) bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_PTR_ADDR)
xfs_alloc_ptr_t *xfs_alloc_ptr_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur)
#else
#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \ #define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur)) bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif
/*
* Prototypes for externally visible routines.
*/
/* /*
* Decrement cursor by one record at the level. * Decrement cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched. * For nonzero levels the leaf-ward information is untouched.
*/ */
int /* error */ extern int xfs_alloc_decrement(struct xfs_btree_cur *cur, int level, int *stat);
xfs_alloc_decrement(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
int *stat); /* success/failure */
/* /*
* Delete the record pointed to by cur. * Delete the record pointed to by cur.
* The cursor refers to the place where the record was (could be inserted) * The cursor refers to the place where the record was (could be inserted)
* when the operation returns. * when the operation returns.
*/ */
int /* error */ extern int xfs_alloc_delete(struct xfs_btree_cur *cur, int *stat);
xfs_alloc_delete(
struct xfs_btree_cur *cur, /* btree cursor */
int *stat); /* success/failure */
/* /*
* Get the data from the pointed-to record. * Get the data from the pointed-to record.
*/ */
int /* error */ extern int xfs_alloc_get_rec(struct xfs_btree_cur *cur, xfs_agblock_t *bno,
xfs_alloc_get_rec( xfs_extlen_t *len, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t *bno, /* output: starting block of extent */
xfs_extlen_t *len, /* output: length of extent */
int *stat); /* output: success/failure */
/* /*
* Increment cursor by one record at the level. * Increment cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched. * For nonzero levels the leaf-ward information is untouched.
*/ */
int /* error */ extern int xfs_alloc_increment(struct xfs_btree_cur *cur, int level, int *stat);
xfs_alloc_increment(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
int *stat); /* success/failure */
/* /*
* Insert the current record at the point referenced by cur. * Insert the current record at the point referenced by cur.
* The cursor may be inconsistent on return if splits have been done. * The cursor may be inconsistent on return if splits have been done.
*/ */
int /* error */ extern int xfs_alloc_insert(struct xfs_btree_cur *cur, int *stat);
xfs_alloc_insert(
struct xfs_btree_cur *cur, /* btree cursor */
int *stat); /* success/failure */
/* /*
* Lookup the record equal to [bno, len] in the btree given by cur. * Lookup the record equal to [bno, len] in the btree given by cur.
*/ */
int /* error */ extern int xfs_alloc_lookup_eq(struct xfs_btree_cur *cur, xfs_agblock_t bno,
xfs_alloc_lookup_eq( xfs_extlen_t len, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat); /* success/failure */
/* /*
* Lookup the first record greater than or equal to [bno, len] * Lookup the first record greater than or equal to [bno, len]
* in the btree given by cur. * in the btree given by cur.
*/ */
int /* error */ extern int xfs_alloc_lookup_ge(struct xfs_btree_cur *cur, xfs_agblock_t bno,
xfs_alloc_lookup_ge( xfs_extlen_t len, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat); /* success/failure */
/* /*
* Lookup the first record less than or equal to [bno, len] * Lookup the first record less than or equal to [bno, len]
* in the btree given by cur. * in the btree given by cur.
*/ */
int /* error */ extern int xfs_alloc_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno,
xfs_alloc_lookup_le( xfs_extlen_t len, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat); /* success/failure */
/* /*
* Update the record referred to by cur, to the value given by [bno, len]. * Update the record referred to by cur, to the value given by [bno, len].
* This either works (return 0) or gets an EFSCORRUPTED error. * This either works (return 0) or gets an EFSCORRUPTED error.
*/ */
int /* error */ extern int xfs_alloc_update(struct xfs_btree_cur *cur, xfs_agblock_t bno,
xfs_alloc_update( xfs_extlen_t len);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len); /* length of extent */
#endif /* __XFS_ALLOC_BTREE_H__ */ #endif /* __XFS_ALLOC_BTREE_H__ */
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,27 +43,26 @@ ...@@ -43,27 +43,26 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_inode_item.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_attr_leaf.h" #include "xfs_attr_leaf.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_rw.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_rw.h"
/* /*
* xfs_attr.c * xfs_attr.c
......
...@@ -29,18 +29,12 @@ ...@@ -29,18 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_attr_leaf.c
*
* GROT: figure out how to recover gracefully when bmap returns ENOSPC.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -48,23 +42,22 @@ ...@@ -48,23 +42,22 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_attr_leaf.h" #include "xfs_attr_leaf.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
/* /*
* xfs_attr_leaf.c * xfs_attr_leaf.c
......
...@@ -147,65 +147,58 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t; ...@@ -147,65 +147,58 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t;
/* /*
* Cast typed pointers for "local" and "remote" name/value structs. * Cast typed pointers for "local" and "remote" name/value structs.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_REMOTE)
xfs_attr_leaf_name_remote_t *
xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx);
#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \
xfs_attr_leaf_name_remote(leafp,idx) xfs_attr_leaf_name_remote(leafp,idx)
#else static inline xfs_attr_leaf_name_remote_t *
#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) /* remote name struct ptr */ \ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
((xfs_attr_leaf_name_remote_t *) \ {
&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) return (xfs_attr_leaf_name_remote_t *) &((char *)
#endif (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_LOCAL) }
xfs_attr_leaf_name_local_t *
xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx);
#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \
xfs_attr_leaf_name_local(leafp,idx) xfs_attr_leaf_name_local(leafp,idx)
#else static inline xfs_attr_leaf_name_local_t *
#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) /* local name struct ptr */ \ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
((xfs_attr_leaf_name_local_t *) \ {
&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) return (xfs_attr_leaf_name_local_t *) &((char *)
#endif (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME) }
char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx);
#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) #define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx)
#else static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
#define XFS_ATTR_LEAF_NAME(leafp,idx) /* generic name struct ptr */ \ {
(&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) return (&((char *)
#endif (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]);
}
/* /*
* Calculate total bytes used (including trailing pad for alignment) for * Calculate total bytes used (including trailing pad for alignment) for
* a "local" name/value structure, a "remote" name/value structure, and * a "local" name/value structure, a "remote" name/value structure, and
* a pointer which might be either. * a pointer which might be either.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_REMOTE)
int xfs_attr_leaf_entsize_remote(int nlen);
#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \
xfs_attr_leaf_entsize_remote(nlen) xfs_attr_leaf_entsize_remote(nlen)
#else static inline int xfs_attr_leaf_entsize_remote(int nlen)
#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) /* space for remote struct */ \ {
(((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL)
int xfs_attr_leaf_entsize_local(int nlen, int vlen);
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \
xfs_attr_leaf_entsize_local(nlen,vlen) xfs_attr_leaf_entsize_local(nlen,vlen)
#else static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) /* space for local struct */ \ {
(((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + \ return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX)
int xfs_attr_leaf_entsize_local_max(int bsize);
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \
xfs_attr_leaf_entsize_local_max(bsize) xfs_attr_leaf_entsize_local_max(bsize)
#else static inline int xfs_attr_leaf_entsize_local_max(int bsize)
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) /* max local struct size */ \ {
(((bsize) >> 1) + ((bsize) >> 2)) return (((bsize) >> 1) + ((bsize) >> 2));
#endif }
/*======================================================================== /*========================================================================
......
...@@ -71,38 +71,17 @@ typedef struct xfs_attr_sf_sort { ...@@ -71,38 +71,17 @@ typedef struct xfs_attr_sf_sort {
char *name; /* name value, pointer into buffer */ char *name; /* name value, pointer into buffer */
} xfs_attr_sf_sort_t; } xfs_attr_sf_sort_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_ENTSIZE_BYNAME)
int xfs_attr_sf_entsize_byname(int nlen, int vlen);
#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) \
xfs_attr_sf_entsize_byname(nlen,vlen)
#else
#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \
((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen)) (((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen)))
#endif
#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \ #define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \
((1 << (NBBY*(int)sizeof(__uint8_t))) - 1) ((1 << (NBBY*(int)sizeof(__uint8_t))) - 1)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_ENTSIZE)
int xfs_attr_sf_entsize(xfs_attr_sf_entry_t *sfep);
#define XFS_ATTR_SF_ENTSIZE(sfep) xfs_attr_sf_entsize(sfep)
#else
#define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \ #define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \
((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen) ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_NEXTENTRY)
xfs_attr_sf_entry_t *xfs_attr_sf_nextentry(xfs_attr_sf_entry_t *sfep);
#define XFS_ATTR_SF_NEXTENTRY(sfep) xfs_attr_sf_nextentry(sfep)
#else
#define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ #define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \
((xfs_attr_sf_entry_t *) \ ((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)))
((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_TOTSIZE)
int xfs_attr_sf_totsize(struct xfs_inode *dp);
#define XFS_ATTR_SF_TOTSIZE(dp) xfs_attr_sf_totsize(dp)
#else
#define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \ #define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \
(INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT)) (INT_GET(((xfs_attr_shortform_t *) \
#endif ((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT))
#if defined(XFS_ATTR_TRACE) #if defined(XFS_ATTR_TRACE)
/* /*
......
...@@ -39,30 +39,26 @@ ...@@ -39,30 +39,26 @@
/* /*
* masks with n high/low bits set, 32-bit values & 64-bit values * masks with n high/low bits set, 32-bit values & 64-bit values
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32HI)
__uint32_t xfs_mask32hi(int n);
#define XFS_MASK32HI(n) xfs_mask32hi(n) #define XFS_MASK32HI(n) xfs_mask32hi(n)
#else static inline __uint32_t xfs_mask32hi(int n)
#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n))) {
#endif return (__uint32_t)-1 << (32 - (n));
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64HI) }
__uint64_t xfs_mask64hi(int n);
#define XFS_MASK64HI(n) xfs_mask64hi(n) #define XFS_MASK64HI(n) xfs_mask64hi(n)
#else static inline __uint64_t xfs_mask64hi(int n)
#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n))) {
#endif return (__uint64_t)-1 << (64 - (n));
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32LO) }
__uint32_t xfs_mask32lo(int n);
#define XFS_MASK32LO(n) xfs_mask32lo(n) #define XFS_MASK32LO(n) xfs_mask32lo(n)
#else static inline __uint32_t xfs_mask32lo(int n)
#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1) {
#endif return ((__uint32_t)1 << (n)) - 1;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64LO) }
__uint64_t xfs_mask64lo(int n);
#define XFS_MASK64LO(n) xfs_mask64lo(n) #define XFS_MASK64LO(n) xfs_mask64lo(n)
#else static inline __uint64_t xfs_mask64lo(int n)
#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1) {
#endif return ((__uint64_t)1 << (n)) - 1;
}
/* Get high bit set out of 32-bit argument, -1 if none set */ /* Get high bit set out of 32-bit argument, -1 if none set */
extern int xfs_highbit32(__uint32_t v); extern int xfs_highbit32(__uint32_t v);
......
...@@ -29,41 +29,39 @@ ...@@ -29,41 +29,39 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_da_btree.h"
#include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_dmapi.h"
#include "xfs_mount.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_inode_item.h"
#include "xfs_extfree_item.h" #include "xfs_extfree_item.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_attr_leaf.h" #include "xfs_attr_leaf.h"
#include "xfs_bit.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
......
...@@ -77,12 +77,11 @@ typedef struct xfs_bmap_free ...@@ -77,12 +77,11 @@ typedef struct xfs_bmap_free
/* combine contig. space */ /* combine contig. space */
#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */ #define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAPI_AFLAG)
int xfs_bmapi_aflag(int w);
#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w) #define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
#else static inline int xfs_bmapi_aflag(int w)
#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0) {
#endif return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0);
}
/* /*
* Special values for xfs_bmbt_irec_t br_startblock field. * Special values for xfs_bmbt_irec_t br_startblock field.
...@@ -90,14 +89,12 @@ int xfs_bmapi_aflag(int w); ...@@ -90,14 +89,12 @@ int xfs_bmapi_aflag(int w);
#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp) #define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
#else static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
#define XFS_BMAP_INIT(flp,fbp) \ {
((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
(flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK) (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK);
#endif }
/* /*
* Argument structure for xfs_bmap_alloc. * Argument structure for xfs_bmap_alloc.
......
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,20 +42,19 @@ ...@@ -43,20 +42,19 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_quota.h" #include "xfs_quota.h"
......
此差异已折叠。
...@@ -29,17 +29,12 @@ ...@@ -29,17 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* This file contains common code for the space manager's btree implementations.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -47,17 +42,16 @@ ...@@ -47,17 +42,16 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bit.h" #include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_error.h" #include "xfs_error.h"
/* /*
......
...@@ -113,12 +113,7 @@ typedef struct xfs_btree_block ...@@ -113,12 +113,7 @@ typedef struct xfs_btree_block
/* /*
* Boolean to select which form of xfs_btree_block_t.bb_u to use. * Boolean to select which form of xfs_btree_block_t.bb_u to use.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BTREE_LONG_PTRS)
int xfs_btree_long_ptrs(xfs_btnum_t btnum);
#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) #define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
#else
#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
#endif
/* /*
* Magic numbers for btree blocks. * Magic numbers for btree blocks.
...@@ -205,24 +200,10 @@ typedef struct xfs_btree_cur ...@@ -205,24 +200,10 @@ typedef struct xfs_btree_cur
/* /*
* Convert from buffer to btree block header. * Convert from buffer to btree block header.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BLOCK) #define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)XFS_BUF_PTR(bp))
xfs_btree_block_t *xfs_buf_to_block(struct xfs_buf *bp); #define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)XFS_BUF_PTR(bp))
#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp) #define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)XFS_BUF_PTR(bp))
#else
#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_LBLOCK)
xfs_btree_lblock_t *xfs_buf_to_lblock(struct xfs_buf *bp);
#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp)
#else
#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBLOCK)
xfs_btree_sblock_t *xfs_buf_to_sblock(struct xfs_buf *bp);
#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp)
#else
#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp)))
#endif
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -477,106 +458,33 @@ xfs_btree_setbuf( ...@@ -477,106 +458,33 @@ xfs_btree_setbuf(
/* /*
* Min and max functions for extlen, agblock, fileoff, and filblks types. * Min and max functions for extlen, agblock, fileoff, and filblks types.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MIN)
xfs_extlen_t xfs_extlen_min(xfs_extlen_t a, xfs_extlen_t b);
#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b)
#else
#define XFS_EXTLEN_MIN(a,b) \ #define XFS_EXTLEN_MIN(a,b) \
((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \ ((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \
(xfs_extlen_t)(a) : (xfs_extlen_t)(b)) (xfs_extlen_t)(a) : (xfs_extlen_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MAX)
xfs_extlen_t xfs_extlen_max(xfs_extlen_t a, xfs_extlen_t b);
#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b)
#else
#define XFS_EXTLEN_MAX(a,b) \ #define XFS_EXTLEN_MAX(a,b) \
((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \ ((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \
(xfs_extlen_t)(a) : (xfs_extlen_t)(b)) (xfs_extlen_t)(a) : (xfs_extlen_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MIN)
xfs_agblock_t xfs_agblock_min(xfs_agblock_t a, xfs_agblock_t b);
#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b)
#else
#define XFS_AGBLOCK_MIN(a,b) \ #define XFS_AGBLOCK_MIN(a,b) \
((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \ ((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \
(xfs_agblock_t)(a) : (xfs_agblock_t)(b)) (xfs_agblock_t)(a) : (xfs_agblock_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MAX)
xfs_agblock_t xfs_agblock_max(xfs_agblock_t a, xfs_agblock_t b);
#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b)
#else
#define XFS_AGBLOCK_MAX(a,b) \ #define XFS_AGBLOCK_MAX(a,b) \
((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \ ((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \
(xfs_agblock_t)(a) : (xfs_agblock_t)(b)) (xfs_agblock_t)(a) : (xfs_agblock_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MIN)
xfs_fileoff_t xfs_fileoff_min(xfs_fileoff_t a, xfs_fileoff_t b);
#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b)
#else
#define XFS_FILEOFF_MIN(a,b) \ #define XFS_FILEOFF_MIN(a,b) \
((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \ ((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \
(xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MAX)
xfs_fileoff_t xfs_fileoff_max(xfs_fileoff_t a, xfs_fileoff_t b);
#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b)
#else
#define XFS_FILEOFF_MAX(a,b) \ #define XFS_FILEOFF_MAX(a,b) \
((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \ ((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \
(xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MIN)
xfs_filblks_t xfs_filblks_min(xfs_filblks_t a, xfs_filblks_t b);
#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b)
#else
#define XFS_FILBLKS_MIN(a,b) \ #define XFS_FILBLKS_MIN(a,b) \
((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \ ((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \
(xfs_filblks_t)(a) : (xfs_filblks_t)(b)) (xfs_filblks_t)(a) : (xfs_filblks_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MAX)
xfs_filblks_t xfs_filblks_max(xfs_filblks_t a, xfs_filblks_t b);
#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b)
#else
#define XFS_FILBLKS_MAX(a,b) \ #define XFS_FILBLKS_MAX(a,b) \
((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \ ((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \
(xfs_filblks_t)(a) : (xfs_filblks_t)(b)) (xfs_filblks_t)(a) : (xfs_filblks_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_SANITY_CHECK)
int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb);
#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb)
#else
#define XFS_FSB_SANITY_CHECK(mp,fsb) \ #define XFS_FSB_SANITY_CHECK(mp,fsb) \
(XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \ (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks) XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks)
#endif
/*
* Macros to set EFSCORRUPTED & return/branch.
*/
#define XFS_WANT_CORRUPTED_GOTO(x,l) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
if (unlikely(!fs_is_ok)) { \
XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
XFS_ERRLEVEL_LOW, NULL); \
error = XFS_ERROR(EFSCORRUPTED); \
goto l; \
} \
}
#define XFS_WANT_CORRUPTED_RETURN(x) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
if (unlikely(!fs_is_ok)) { \
XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
XFS_ERRLEVEL_LOW, NULL); \
return XFS_ERROR(EFSCORRUPTED); \
} \
}
#endif /* __XFS_BTREE_H__ */ #endif /* __XFS_BTREE_H__ */
...@@ -29,29 +29,19 @@ ...@@ -29,29 +29,19 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* This file contains the implementation of the xfs_buf_log_item.
* It contains the item operations used to manipulate the buf log
* items as well as utility routines used by the buffer specific
* transaction routines.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_buf_item.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_buf_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_rw.h"
#include "xfs_bit.h"
#include "xfs_error.h" #include "xfs_error.h"
......
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,19 +42,19 @@ ...@@ -43,19 +42,19 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_attr_leaf.h" #include "xfs_attr_leaf.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
...@@ -64,7 +63,6 @@ ...@@ -64,7 +63,6 @@
#include "xfs_dir2_block.h" #include "xfs_dir2_block.h"
#include "xfs_dir2_node.h" #include "xfs_dir2_node.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
/* /*
* xfs_da_btree.c * xfs_da_btree.c
......
...@@ -92,72 +92,24 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t; ...@@ -92,72 +92,24 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t;
#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */ #define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */
/* #define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize
* Macros used by directory code to interface to the filesystem. #define XFS_LBLOG(mp) (mp)->m_sb.sb_blocklog
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBSIZE)
int xfs_lbsize(struct xfs_mount *mp);
#define XFS_LBSIZE(mp) xfs_lbsize(mp)
#else
#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBLOG)
int xfs_lblog(struct xfs_mount *mp);
#define XFS_LBLOG(mp) xfs_lblog(mp)
#else
#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog)
#endif
/*
* Macros used by directory code to interface to the kernel
*/
/*
* Macros used to manipulate directory off_t's
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_BNOENTRY)
__uint32_t xfs_da_make_bnoentry(struct xfs_mount *mp, xfs_dablk_t bno,
int entry);
#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ #define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
xfs_da_make_bnoentry(mp,bno,entry)
#else
#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
(((bno) << (mp)->m_dircook_elog) | (entry)) (((bno) << (mp)->m_dircook_elog) | (entry))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_COOKIE)
xfs_off_t xfs_da_make_cookie(struct xfs_mount *mp, xfs_dablk_t bno, int entry,
xfs_dahash_t hash);
#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ #define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
xfs_da_make_cookie(mp,bno,entry,hash)
#else
#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
(((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash)) (((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash))
#endif #define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)cookie)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_HASH) #define XFS_DA_COOKIE_BNO(mp,cookie) \
xfs_dahash_t xfs_da_cookie_hash(struct xfs_mount *mp, xfs_off_t cookie); ((((xfs_off_t)(cookie) >> 31) == -1LL ? \
#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie)
#else
#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_BNO)
xfs_dablk_t xfs_da_cookie_bno(struct xfs_mount *mp, xfs_off_t cookie);
#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie)
#else
#define XFS_DA_COOKIE_BNO(mp,cookie) \
(((xfs_off_t)(cookie) >> 31) == -1LL ? \
(xfs_dablk_t)0 : \ (xfs_dablk_t)0 : \
(xfs_dablk_t)((xfs_off_t)(cookie) >> ((mp)->m_dircook_elog + 32))) (xfs_dablk_t)((xfs_off_t)(cookie) >> \
#endif ((mp)->m_dircook_elog + 32))))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_ENTRY) #define XFS_DA_COOKIE_ENTRY(mp,cookie) \
int xfs_da_cookie_entry(struct xfs_mount *mp, xfs_off_t cookie); ((((xfs_off_t)(cookie) >> 31) == -1LL ? \
#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie)
#else
#define XFS_DA_COOKIE_ENTRY(mp,cookie) \
(((xfs_off_t)(cookie) >> 31) == -1LL ? \
(xfs_dablk_t)0 : \ (xfs_dablk_t)0 : \
(xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \ (xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \
((1 << (mp)->m_dircook_elog) - 1))) ((1 << (mp)->m_dircook_elog) - 1))))
#endif
/*======================================================================== /*========================================================================
......
...@@ -29,30 +29,30 @@ ...@@ -29,30 +29,30 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_ag.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_dfrag.h" #include "xfs_dfrag.h"
......
...@@ -37,13 +37,8 @@ struct xfs_mount; ...@@ -37,13 +37,8 @@ struct xfs_mount;
#define XFS_DINODE_VERSION_1 1 #define XFS_DINODE_VERSION_1 1
#define XFS_DINODE_VERSION_2 2 #define XFS_DINODE_VERSION_2 2
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION) #define XFS_DINODE_GOOD_VERSION(v) \
int xfs_dinode_good_version(int v); (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2))
#define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v)
#else
#define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \
((v) == XFS_DINODE_VERSION_2))
#endif
#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ #define XFS_DINODE_MAGIC 0x494e /* 'IN' */
/* /*
...@@ -184,75 +179,30 @@ typedef enum xfs_dinode_fmt ...@@ -184,75 +179,30 @@ typedef enum xfs_dinode_fmt
/* /*
* Inode size for given fs. * Inode size for given fs.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO)
int xfs_litino(struct xfs_mount *mp);
#define XFS_LITINO(mp) xfs_litino(mp)
#else
#define XFS_LITINO(mp) ((mp)->m_litino) #define XFS_LITINO(mp) ((mp)->m_litino)
#endif
#define XFS_BROOT_SIZE_ADJ \ #define XFS_BROOT_SIZE_ADJ \
(sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t)) (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t))
/*
* Fork identifiers. Here so utilities can use them without including
* xfs_inode.h.
*/
#define XFS_DATA_FORK 0
#define XFS_ATTR_FORK 1
/* /*
* Inode data & attribute fork sizes, per inode. * Inode data & attribute fork sizes, per inode.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q)
int xfs_cfork_q_disk(xfs_dinode_core_t *dcp);
int xfs_cfork_q(xfs_dinode_core_t *dcp);
#define XFS_CFORK_Q_DISK(dcp) xfs_cfork_q_disk(dcp)
#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
#else
#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF)
int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp);
int xfs_cfork_boff(xfs_dinode_core_t *dcp);
#define XFS_CFORK_BOFF_DISK(dcp) xfs_cfork_boff_disk(dcp)
#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
#else
#define XFS_CFORK_BOFF_DISK(dcp) ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) #define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
#define XFS_CFORK_BOFF_DISK(dcp) \
((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE)
int xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
#define XFS_CFORK_DSIZE_DISK(dcp,mp) xfs_cfork_dsize_disk(dcp,mp)
#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
#else
#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ #define XFS_CFORK_DSIZE_DISK(dcp,mp) \
(XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
#define XFS_CFORK_DSIZE(dcp,mp) \ #define XFS_CFORK_DSIZE(dcp,mp) \
(XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE)
int xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
#define XFS_CFORK_ASIZE_DISK(dcp,mp) xfs_cfork_asize_disk(dcp,mp)
#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
#else
#define XFS_CFORK_ASIZE_DISK(dcp,mp) \ #define XFS_CFORK_ASIZE_DISK(dcp,mp) \
(XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0)
#define XFS_CFORK_ASIZE(dcp,mp) \ #define XFS_CFORK_ASIZE(dcp,mp) \
(XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE)
int xfs_cfork_size_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
#define XFS_CFORK_SIZE_DISK(dcp,mp,w) xfs_cfork_size_disk(dcp,mp,w)
#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
#else
#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ #define XFS_CFORK_SIZE_DISK(dcp,mp,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
XFS_CFORK_DSIZE_DISK(dcp, mp) : \ XFS_CFORK_DSIZE_DISK(dcp, mp) : \
...@@ -261,93 +211,26 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); ...@@ -261,93 +211,26 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp))
#endif #define XFS_DFORK_DSIZE(dip,mp) \
XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) #define XFS_DFORK_ASIZE(dip,mp) \
int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) #define XFS_DFORK_SIZE(dip,mp,w) \
#else XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
#define XFS_DFORK_DSIZE(dip,mp) XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE)
int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp);
#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
#else
#define XFS_DFORK_ASIZE(dip,mp) XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE)
int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w);
#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
#else
#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
#endif
/*
* Macros for accessing per-fork disk inode information.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q)
int xfs_dfork_q(xfs_dinode_t *dip);
#define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
#else
#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) #define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF)
int xfs_dfork_boff(xfs_dinode_t *dip);
#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
#else
#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) #define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR)
char *xfs_dfork_dptr(xfs_dinode_t *dip);
#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
#else
#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) #define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c)
#define XFS_DFORK_APTR(dip) \
#endif ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR)
char *xfs_dfork_aptr(xfs_dinode_t *dip);
#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
#else
#define XFS_DFORK_APTR(dip) ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR)
char *xfs_dfork_ptr(xfs_dinode_t *dip, int w);
#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
#else
#define XFS_DFORK_PTR(dip,w) \ #define XFS_DFORK_PTR(dip,w) \
((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
#define XFS_CFORK_FORMAT(dcp,w) \
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT)
int xfs_cfork_format(xfs_dinode_core_t *dcp, int w);
#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
#else
#define XFS_CFORK_FORMAT(dcp,w) \
((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET)
void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n);
#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
#else
#define XFS_CFORK_FMT_SET(dcp,w,n) \ #define XFS_CFORK_FMT_SET(dcp,w,n) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
((dcp)->di_format = (n)) : \ ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n)))
((dcp)->di_aformat = (n)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS)
int xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w);
int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
#define XFS_CFORK_NEXTENTS_DISK(dcp,w) xfs_cfork_nextents_disk(dcp,w)
#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
#else
#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ #define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \
...@@ -355,31 +238,13 @@ int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w); ...@@ -355,31 +238,13 @@ int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
#define XFS_CFORK_NEXTENTS(dcp,w) \ #define XFS_CFORK_NEXTENTS(dcp,w) \
((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET)
void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n);
#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
#else
#define XFS_CFORK_NEXT_SET(dcp,w,n) \ #define XFS_CFORK_NEXT_SET(dcp,w,n) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
((dcp)->di_nextents = (n)) : \ ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n)))
((dcp)->di_anextents = (n)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS)
int xfs_dfork_nextents(xfs_dinode_t *dip, int w);
#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
#else
#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) #define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp))
xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
#else
#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
#endif
/* /*
* Values for di_flags * Values for di_flags
......
...@@ -29,31 +29,29 @@ ...@@ -29,31 +29,29 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_error.h" #include "xfs_error.h"
......
...@@ -29,18 +29,12 @@ ...@@ -29,18 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* XFS v2 directory implmentation.
* Top-level and utility routines.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -48,16 +42,16 @@ ...@@ -48,16 +42,16 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h" #include "xfs_alloc_btree.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
...@@ -65,7 +59,6 @@ ...@@ -65,7 +59,6 @@
#include "xfs_dir2_node.h" #include "xfs_dir2_node.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
/* /*
* Declarations for interface routines. * Declarations for interface routines.
......
...@@ -29,33 +29,25 @@ ...@@ -29,33 +29,25 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_block.c
* XFS V2 directory implementation, single-block form.
* See xfs_dir2_block.h for the format.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_da_btree.h" #include "xfs_inode_item.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
......
...@@ -74,53 +74,37 @@ typedef struct xfs_dir2_block { ...@@ -74,53 +74,37 @@ typedef struct xfs_dir2_block {
/* /*
* Pointer to the leaf header embedded in a data block (1-block format) * Pointer to the leaf header embedded in a data block (1-block format)
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_TAIL_P)
xfs_dir2_block_tail_t *
xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block);
#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block) #define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block)
#else static inline xfs_dir2_block_tail_t *
#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \ xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block)
(((xfs_dir2_block_tail_t *)((char *)(block) + (mp)->m_dirblksize)) - 1) {
#endif return (((xfs_dir2_block_tail_t *)
((char *)(block) + (mp)->m_dirblksize)) - 1);
}
/* /*
* Pointer to the leaf entries embedded in a data block (1-block format) * Pointer to the leaf entries embedded in a data block (1-block format)
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_LEAF_P) #define XFS_DIR2_BLOCK_LEAF_P(btp) xfs_dir2_block_leaf_p(btp)
struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp); static inline struct xfs_dir2_leaf_entry *
#define XFS_DIR2_BLOCK_LEAF_P(btp) \ xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp)
xfs_dir2_block_leaf_p(btp) {
#else return (((struct xfs_dir2_leaf_entry *)
#define XFS_DIR2_BLOCK_LEAF_P(btp) \ (btp)) - INT_GET((btp)->count, ARCH_CONVERT));
(((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, ARCH_CONVERT)) }
#endif
/* /*
* Function declarations. * Function declarations.
*/ */
extern int xfs_dir2_block_addname(struct xfs_da_args *args);
extern int extern int xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dir2_block_addname(struct xfs_da_args *args); struct uio *uio, int *eofp,
struct xfs_dirent *dbp, xfs_dir2_put_t put);
extern int extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir2_block_removename(struct xfs_da_args *args);
struct uio *uio, int *eofp, struct xfs_dirent *dbp, extern int xfs_dir2_block_replace(struct xfs_da_args *args);
xfs_dir2_put_t put); extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
struct xfs_dabuf *lbp, struct xfs_dabuf *dbp);
extern int extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
xfs_dir2_block_lookup(struct xfs_da_args *args);
extern int
xfs_dir2_block_removename(struct xfs_da_args *args);
extern int
xfs_dir2_block_replace(struct xfs_da_args *args);
extern int
xfs_dir2_leaf_to_block(struct xfs_da_args *args, struct xfs_dabuf *lbp,
struct xfs_dabuf *dbp);
extern int
xfs_dir2_sf_to_block(struct xfs_da_args *args);
#endif /* __XFS_DIR2_BLOCK_H__ */ #endif /* __XFS_DIR2_BLOCK_H__ */
...@@ -29,32 +29,24 @@ ...@@ -29,32 +29,24 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_data.c
* Core data block handling routines for XFS V2 directories.
* See xfs_dir2_data.h for data structures.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
......
...@@ -137,88 +137,65 @@ typedef struct xfs_dir2_data { ...@@ -137,88 +137,65 @@ typedef struct xfs_dir2_data {
/* /*
* Size of a data entry. * Size of a data entry.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTSIZE)
int xfs_dir2_data_entsize(int n);
#define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n) #define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n)
#else static inline int xfs_dir2_data_entsize(int n)
#define XFS_DIR2_DATA_ENTSIZE(n) \ {
((int)(roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \ return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
(uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN))) (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN);
#endif }
/* /*
* Pointer to an entry's tag word. * Pointer to an entry's tag word.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTRY_TAG_P)
xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep);
#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) #define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
#else static inline xfs_dir2_data_off_t *
#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \ xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
((xfs_dir2_data_off_t *)\ {
((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ return (xfs_dir2_data_off_t *) \
(uint)sizeof(xfs_dir2_data_off_t))) ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \
#endif (uint)sizeof(xfs_dir2_data_off_t));
}
/* /*
* Pointer to a freespace's tag word. * Pointer to a freespace's tag word.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P)
xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup);
#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ #define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \
xfs_dir2_data_unused_tag_p(dup) xfs_dir2_data_unused_tag_p(dup)
#else static inline xfs_dir2_data_off_t *
#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup)
((xfs_dir2_data_off_t *)\ {
((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ return (xfs_dir2_data_off_t *) \
- (uint)sizeof(xfs_dir2_data_off_t))) ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \
#endif - (uint)sizeof(xfs_dir2_data_off_t));
}
/* /*
* Function declarations. * Function declarations.
*/ */
#ifdef DEBUG #ifdef DEBUG
extern void extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
#else #else
#define xfs_dir2_data_check(dp,bp) #define xfs_dir2_data_check(dp,bp)
#endif #endif
extern xfs_dir2_data_free_t *xfs_dir2_data_freefind(xfs_dir2_data_t *d,
extern xfs_dir2_data_free_t * xfs_dir2_data_unused_t *dup);
xfs_dir2_data_freefind(xfs_dir2_data_t *d, extern xfs_dir2_data_free_t *xfs_dir2_data_freeinsert(xfs_dir2_data_t *d,
xfs_dir2_data_unused_t *dup); xfs_dir2_data_unused_t *dup, int *loghead);
extern void xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,
extern xfs_dir2_data_free_t * int *loghead, char *aendp);
xfs_dir2_data_freeinsert(xfs_dir2_data_t *d, extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
xfs_dir2_data_unused_t *dup, int *loghead); struct xfs_dabuf **bpp);
extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp,
extern void
xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,
int *loghead, char *aendp);
extern int
xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
struct xfs_dabuf **bpp);
extern void
xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_entry_t *dep); xfs_dir2_data_entry_t *dep);
extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
extern void struct xfs_dabuf *bp);
xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_unused_t *dup);
extern void extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_unused_t *dup);
extern void
xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t offset,
xfs_dir2_data_aoff_t len, int *needlogp, xfs_dir2_data_aoff_t len, int *needlogp,
int *needscanp); int *needscanp);
extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
extern void
xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
xfs_dir2_data_unused_t *dup, xfs_dir2_data_unused_t *dup,
xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t offset,
xfs_dir2_data_aoff_t len, int *needlogp, xfs_dir2_data_aoff_t len, int *needlogp,
......
...@@ -29,21 +29,12 @@ ...@@ -29,21 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_leaf.c
* XFS directory version 2 implementation - single leaf form
* see xfs_dir2_leaf.h for data structures.
* These directories have multiple XFS_DIR2_DATA blocks and one
* XFS_DIR2_LEAF1 block containing the hash table and freespace map.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -51,6 +42,7 @@ ...@@ -51,6 +42,7 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
...@@ -58,14 +50,12 @@ ...@@ -58,14 +50,12 @@
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h" #include "xfs_dir2_block.h"
#include "xfs_dir2_node.h" #include "xfs_dir2_node.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
/* /*
* Local function declarations. * Local function declarations.
......
...@@ -43,10 +43,6 @@ struct xfs_inode; ...@@ -43,10 +43,6 @@ struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
/*
* Constants.
*/
/* /*
* Offset of the leaf/node space. First block in this space * Offset of the leaf/node space. First block in this space
* is the btree root. * is the btree root.
...@@ -56,10 +52,6 @@ struct xfs_trans; ...@@ -56,10 +52,6 @@ struct xfs_trans;
#define XFS_DIR2_LEAF_FIRSTDB(mp) \ #define XFS_DIR2_LEAF_FIRSTDB(mp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET)
/*
* Types.
*/
/* /*
* Offset in data space of a data entry. * Offset in data space of a data entry.
*/ */
...@@ -67,10 +59,6 @@ typedef __uint32_t xfs_dir2_dataptr_t; ...@@ -67,10 +59,6 @@ typedef __uint32_t xfs_dir2_dataptr_t;
#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0xffffffff) #define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0xffffffff)
#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) #define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0)
/*
* Structures.
*/
/* /*
* Leaf block header. * Leaf block header.
*/ */
...@@ -109,245 +97,193 @@ typedef struct xfs_dir2_leaf { ...@@ -109,245 +97,193 @@ typedef struct xfs_dir2_leaf {
} xfs_dir2_leaf_t; } xfs_dir2_leaf_t;
/* /*
* Macros. * DB blocks here are logical directory block numbers, not filesystem blocks.
* The DB blocks are logical directory block numbers, not filesystem blocks.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_MAX_LEAF_ENTS) #define XFS_DIR2_MAX_LEAF_ENTS(mp) xfs_dir2_max_leaf_ents(mp)
int static inline int xfs_dir2_max_leaf_ents(struct xfs_mount *mp)
xfs_dir2_max_leaf_ents(struct xfs_mount *mp); {
#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) /
xfs_dir2_max_leaf_ents(mp) (uint)sizeof(xfs_dir2_leaf_entry_t));
#else }
#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
((int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / \
(uint)sizeof(xfs_dir2_leaf_entry_t)))
#endif
/* /*
* Get address of the bestcount field in the single-leaf block. * Get address of the bestcount field in the single-leaf block.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_TAIL_P) #define XFS_DIR2_LEAF_TAIL_P(mp,lp) xfs_dir2_leaf_tail_p(mp, lp)
xfs_dir2_leaf_tail_t * static inline xfs_dir2_leaf_tail_t *
xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp)
#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ {
xfs_dir2_leaf_tail_p(mp, lp) return (xfs_dir2_leaf_tail_t *)
#else ((char *)(lp) + (mp)->m_dirblksize -
#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ (uint)sizeof(xfs_dir2_leaf_tail_t));
((xfs_dir2_leaf_tail_t *)\ }
((char *)(lp) + (mp)->m_dirblksize - \
(uint)sizeof(xfs_dir2_leaf_tail_t)))
#endif
/* /*
* Get address of the bests array in the single-leaf block. * Get address of the bests array in the single-leaf block.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P)
xfs_dir2_data_off_t *
xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp);
#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) #define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp)
#else static inline xfs_dir2_data_off_t *
#define XFS_DIR2_LEAF_BESTS_P(ltp) \ xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp)
((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT)) {
#endif return (xfs_dir2_data_off_t *)
(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT);
}
/* /*
* Convert dataptr to byte in file space * Convert dataptr to byte in file space
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_BYTE)
xfs_dir2_off_t
xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) #define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)
#else static inline xfs_dir2_off_t
#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \ xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
((xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG) {
#endif return (xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG;
}
/* /*
* Convert byte in file space to dataptr. It had better be aligned. * Convert byte in file space to dataptr. It had better be aligned.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DATAPTR)
xfs_dir2_dataptr_t
xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by);
#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) #define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by)
#else static inline xfs_dir2_dataptr_t
#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \ xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by)
((xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG)) {
#endif return (xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG);
}
/*
* Convert byte in space to (DB) block
*/
#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
static inline xfs_dir2_db_t
xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by)
{
return (xfs_dir2_db_t)((by) >> \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog));
}
/* /*
* Convert dataptr to a block number * Convert dataptr to a block number
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_DB)
xfs_dir2_db_t
xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) #define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
#else static inline xfs_dir2_db_t
#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \ xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) {
#endif return XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
}
/*
* Convert byte in space to offset in a block
*/
#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
static inline xfs_dir2_data_aoff_t
xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by)
{
return (xfs_dir2_data_aoff_t)((by) & \
((1 << ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) - 1));
}
/* /*
* Convert dataptr to a byte offset in a block * Convert dataptr to a byte offset in a block
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_OFF)
xfs_dir2_data_aoff_t
xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) #define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
#else static inline xfs_dir2_data_aoff_t
#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \ xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) {
#endif return XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
}
/* /*
* Convert block and offset to byte in space * Convert block and offset to byte in space
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_BYTE)
xfs_dir2_off_t
xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
xfs_dir2_data_aoff_t o);
#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ #define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
xfs_dir2_db_off_to_byte(mp, db, o) xfs_dir2_db_off_to_byte(mp, db, o)
#else static inline xfs_dir2_off_t
#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
(((xfs_dir2_off_t)(db) << \ xfs_dir2_data_aoff_t o)
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o)) {
#endif return ((xfs_dir2_off_t)(db) << \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o);
}
/* /*
* Convert byte in space to (DB) block * Convert block (DB) to block (dablk)
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB) #define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by); static inline xfs_dablk_t
#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
#else {
#define XFS_DIR2_BYTE_TO_DB(mp,by) \ return (xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog);
((xfs_dir2_db_t)((by) >> \ }
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)))
#endif
/* /*
* Convert byte in space to (DA) block * Convert byte in space to (DA) block
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA)
xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by);
#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) #define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
#else static inline xfs_dablk_t
#define XFS_DIR2_BYTE_TO_DA(mp,by) \ xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by)
XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)) {
#endif return XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by));
}
/*
* Convert byte in space to offset in a block
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_OFF)
xfs_dir2_data_aoff_t
xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by);
#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
#else
#define XFS_DIR2_BYTE_TO_OFF(mp,by) \
((xfs_dir2_data_aoff_t)((by) & \
((1 << ((mp)->m_sb.sb_blocklog + \
(mp)->m_sb.sb_dirblklog)) - 1)))
#endif
/* /*
* Convert block and offset to dataptr * Convert block and offset to dataptr
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_DATAPTR)
xfs_dir2_dataptr_t
xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
xfs_dir2_data_aoff_t o);
#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ #define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
xfs_dir2_db_off_to_dataptr(mp, db, o) xfs_dir2_db_off_to_dataptr(mp, db, o)
#else static inline xfs_dir2_dataptr_t
#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)) xfs_dir2_data_aoff_t o)
#endif {
return XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o));
/* }
* Convert block (DB) to block (dablk)
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_DA)
xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db);
#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
#else
#define XFS_DIR2_DB_TO_DA(mp,db) \
((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog))
#endif
/* /*
* Convert block (dablk) to block (DB) * Convert block (dablk) to block (DB)
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_DB)
xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da);
#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) #define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da)
#else static inline xfs_dir2_db_t
#define XFS_DIR2_DA_TO_DB(mp,da) \ xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da)
((xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog)) {
#endif return (xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog);
}
/* /*
* Convert block (dablk) to byte offset in space * Convert block (dablk) to byte offset in space
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_BYTE)
xfs_dir2_off_t xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da);
#define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da) #define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da)
#else static inline xfs_dir2_off_t
#define XFS_DIR2_DA_TO_BYTE(mp,da) \ xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da)
XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0) {
#endif return XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0);
}
/* /*
* Function declarations. * Function declarations.
*/ */
extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
extern int struct xfs_dabuf *dbp);
xfs_dir2_block_to_leaf(struct xfs_da_args *args, struct xfs_dabuf *dbp); extern int xfs_dir2_leaf_addname(struct xfs_da_args *args);
extern void xfs_dir2_leaf_compact(struct xfs_da_args *args,
extern int struct xfs_dabuf *bp);
xfs_dir2_leaf_addname(struct xfs_da_args *args); extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp,
int *lowstalep, int *highstalep,
extern void int *lowlogp, int *highlogp);
xfs_dir2_leaf_compact(struct xfs_da_args *args, struct xfs_dabuf *bp); extern int xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
struct uio *uio, int *eofp,
extern void struct xfs_dirent *dbp, xfs_dir2_put_t put);
xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno,
int *lowstalep, int *highstalep, int *lowlogp, struct xfs_dabuf **bpp, int magic);
int *highlogp); extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
int first, int last);
extern int extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp,
xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_dabuf *bp);
struct uio *uio, int *eofp, struct xfs_dirent *dbp, extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
xfs_dir2_put_t put); extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);
extern int xfs_dir2_leaf_replace(struct xfs_da_args *args);
extern int extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, struct xfs_dabuf *lbp);
struct xfs_dabuf **bpp, int magic); extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args,
struct xfs_dabuf *lbp, xfs_dir2_db_t db);
extern void extern int xfs_dir2_node_to_leaf(struct xfs_da_state *state);
xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
int first, int last);
extern void
xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp);
extern int
xfs_dir2_leaf_lookup(struct xfs_da_args *args);
extern int
xfs_dir2_leaf_removename(struct xfs_da_args *args);
extern int
xfs_dir2_leaf_replace(struct xfs_da_args *args);
extern int
xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
struct xfs_dabuf *lbp);
extern int
xfs_dir2_leaf_trim_data(struct xfs_da_args *args, struct xfs_dabuf *lbp, xfs_dir2_db_t db);
extern int
xfs_dir2_node_to_leaf(struct xfs_da_state *state);
#endif /* __XFS_DIR2_LEAF_H__ */ #endif /* __XFS_DIR2_LEAF_H__ */
...@@ -29,33 +29,25 @@ ...@@ -29,33 +29,25 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_node.c
* XFS directory implementation, version 2, node form files
* See data structures in xfs_dir2_node.h and xfs_da_btree.h.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h" #include "xfs_dir2_block.h"
......
...@@ -44,10 +44,6 @@ struct xfs_da_state_blk; ...@@ -44,10 +44,6 @@ struct xfs_da_state_blk;
struct xfs_inode; struct xfs_inode;
struct xfs_trans; struct xfs_trans;
/*
* Constants.
*/
/* /*
* Offset of the freespace index. * Offset of the freespace index.
*/ */
...@@ -58,9 +54,6 @@ struct xfs_trans; ...@@ -58,9 +54,6 @@ struct xfs_trans;
#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */ #define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
/*
* Structures.
*/
typedef struct xfs_dir2_free_hdr { typedef struct xfs_dir2_free_hdr {
__uint32_t magic; /* XFS_DIR2_FREE_MAGIC */ __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */
__int32_t firstdb; /* db of first entry */ __int32_t firstdb; /* db of first entry */
...@@ -73,87 +66,53 @@ typedef struct xfs_dir2_free { ...@@ -73,87 +66,53 @@ typedef struct xfs_dir2_free {
xfs_dir2_data_off_t bests[1]; /* best free counts */ xfs_dir2_data_off_t bests[1]; /* best free counts */
/* unused entries are -1 */ /* unused entries are -1 */
} xfs_dir2_free_t; } xfs_dir2_free_t;
#define XFS_DIR2_MAX_FREE_BESTS(mp) \ #define XFS_DIR2_MAX_FREE_BESTS(mp) \
(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \ (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \
(uint)sizeof(xfs_dir2_data_off_t)) (uint)sizeof(xfs_dir2_data_off_t))
/*
* Macros.
*/
/* /*
* Convert data space db to the corresponding free db. * Convert data space db to the corresponding free db.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDB)
xfs_dir2_db_t
xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db);
#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db) #define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
#else static inline xfs_dir2_db_t
#define XFS_DIR2_DB_TO_FDB(mp,db) \ xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
(XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp)) {
#endif return (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp));
}
/* /*
* Convert data space db to the corresponding index in a free db. * Convert data space db to the corresponding index in a free db.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDINDEX)
int
xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db);
#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db) #define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
#else static inline int
#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)) xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
#endif {
return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp));
/* }
* Functions.
*/ extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
int first, int last);
extern void extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, struct xfs_dabuf *lbp);
int first, int last); extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
extern int struct xfs_da_args *args, int *indexp,
xfs_dir2_leaf_to_node(struct xfs_da_args *args, struct xfs_dabuf *lbp); struct xfs_da_state *state);
extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
extern xfs_dahash_t struct xfs_dabuf *leaf2_bp);
xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count); extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk,
extern int struct xfs_da_state_blk *newblk);
xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
struct xfs_da_args *args, int *indexp, extern void xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
struct xfs_da_state *state); struct xfs_da_state_blk *drop_blk,
struct xfs_da_state_blk *save_blk);
extern int extern int xfs_dir2_node_addname(struct xfs_da_args *args);
xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, extern int xfs_dir2_node_lookup(struct xfs_da_args *args);
struct xfs_dabuf *leaf2_bp); extern int xfs_dir2_node_removename(struct xfs_da_args *args);
extern int xfs_dir2_node_replace(struct xfs_da_args *args);
extern int extern int xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
xfs_dir2_leafn_split(struct xfs_da_state *state, int *rvalp);
struct xfs_da_state_blk *oldblk,
struct xfs_da_state_blk *newblk);
extern int
xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
extern void
xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
struct xfs_da_state_blk *drop_blk,
struct xfs_da_state_blk *save_blk);
extern int
xfs_dir2_node_addname(struct xfs_da_args *args);
extern int
xfs_dir2_node_lookup(struct xfs_da_args *args);
extern int
xfs_dir2_node_removename(struct xfs_da_args *args);
extern int
xfs_dir2_node_replace(struct xfs_da_args *args);
extern int
xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
int *rvalp);
#endif /* __XFS_DIR2_NODE_H__ */ #endif /* __XFS_DIR2_NODE_H__ */
...@@ -29,32 +29,25 @@ ...@@ -29,32 +29,25 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_sf.c
* Shortform directory implementation for v2 directories.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_da_btree.h" #include "xfs_inode_item.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
......
...@@ -104,140 +104,106 @@ typedef struct xfs_dir2_sf { ...@@ -104,140 +104,106 @@ typedef struct xfs_dir2_sf {
xfs_dir2_sf_entry_t list[1]; /* shortform entries */ xfs_dir2_sf_entry_t list[1]; /* shortform entries */
} xfs_dir2_sf_t; } xfs_dir2_sf_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_HDR_SIZE)
int xfs_dir2_sf_hdr_size(int i8count);
#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) #define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count)
#else static inline int xfs_dir2_sf_hdr_size(int i8count)
#define XFS_DIR2_SF_HDR_SIZE(i8count) \ {
((uint)sizeof(xfs_dir2_sf_hdr_t) - \ return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \
((i8count) == 0) * \ ((i8count) == 0) * \
((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_INUMBERP)
xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep);
#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) #define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep)
#else static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep)
#define XFS_DIR2_SF_INUMBERP(sfep) \ {
((xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]) return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen];
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER)
xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from);
#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
xfs_dir2_sf_get_inumber(sfp, from)
#else #define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ xfs_dir2_sf_get_inumber(sfp, from)
((sfp)->hdr.i8count == 0 ? \ static inline xfs_intino_t
xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from)
{
return ((sfp)->hdr.i8count == 0 ? \
(xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \
(xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)) (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) #define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \
void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
xfs_dir2_inou_t *to);
#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \
xfs_dir2_sf_put_inumber(sfp,from,to) xfs_dir2_sf_put_inumber(sfp,from,to)
#else static inline void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ xfs_dir2_inou_t *to)
if ((sfp)->hdr.i8count == 0) { \ {
XFS_PUT_DIR_INO4(*(from), (to)->i4); \ if ((sfp)->hdr.i8count == 0)
} else { \ XFS_PUT_DIR_INO4(*(from), (to)->i4);
XFS_PUT_DIR_INO8(*(from), (to)->i8); \ else
} XFS_PUT_DIR_INO8(*(from), (to)->i8);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_OFFSET)
xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep);
#define XFS_DIR2_SF_GET_OFFSET(sfep) \ #define XFS_DIR2_SF_GET_OFFSET(sfep) \
xfs_dir2_sf_get_offset(sfep) xfs_dir2_sf_get_offset(sfep)
#else static inline xfs_dir2_data_aoff_t
#define XFS_DIR2_SF_GET_OFFSET(sfep) \ xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep)
INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i) {
#endif return INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i);
}
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET)
void xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep,
xfs_dir2_data_aoff_t off);
#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ #define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \
xfs_dir2_sf_put_offset(sfep,off) xfs_dir2_sf_put_offset(sfep,off)
#else static inline void
#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off)
INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i,off) {
#endif INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i, off);
}
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME)
int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len);
#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \ #define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \
xfs_dir2_sf_entsize_byname(sfp,len) xfs_dir2_sf_entsize_byname(sfp,len)
#else static inline int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len)
#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) /* space a name uses */ \ {
((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \ return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \
((sfp)->hdr.i8count == 0) * \ ((sfp)->hdr.i8count == 0) * \
((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYENTRY)
int xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep);
#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \ #define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \
xfs_dir2_sf_entsize_byentry(sfp,sfep) xfs_dir2_sf_entsize_byentry(sfp,sfep)
#else static inline int
#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) /* space an entry uses */ \ xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \ {
((sfp)->hdr.i8count == 0) * \ return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \
((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) ((sfp)->hdr.i8count == 0) * \
#endif ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
}
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_FIRSTENTRY)
xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp);
#define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp) #define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp)
#else static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp)
#define XFS_DIR2_SF_FIRSTENTRY(sfp) /* first entry in struct */ \ {
((xfs_dir2_sf_entry_t *) \ return ((xfs_dir2_sf_entry_t *) \
((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count))) ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count)));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_NEXTENTRY) #define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep)
xfs_dir2_sf_entry_t *xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, static inline xfs_dir2_sf_entry_t *
xfs_dir2_sf_entry_t *sfep); xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep) {
#else return ((xfs_dir2_sf_entry_t *) \
#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) /* next entry in struct */ \ ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep)));
((xfs_dir2_sf_entry_t *) \ }
((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep)))
#endif
/* /*
* Functions. * Functions.
*/ */
extern int xfs_dir2_block_sfsize(struct xfs_inode *dp,
extern int struct xfs_dir2_block *block,
xfs_dir2_block_sfsize(struct xfs_inode *dp, xfs_dir2_sf_hdr_t *sfhp);
struct xfs_dir2_block *block, extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp,
xfs_dir2_sf_hdr_t *sfhp); int size, xfs_dir2_sf_hdr_t *sfhp);
extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
extern int extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp, extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio,
int size, xfs_dir2_sf_hdr_t *sfhp); int *eofp, struct xfs_dirent *dbp,
xfs_dir2_put_t put);
extern int extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
xfs_dir2_sf_addname(struct xfs_da_args *args); extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
extern int
xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
extern int
xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp,
struct xfs_dirent *dbp, xfs_dir2_put_t put);
extern int
xfs_dir2_sf_lookup(struct xfs_da_args *args);
extern int
xfs_dir2_sf_removename(struct xfs_da_args *args);
extern int
xfs_dir2_sf_replace(struct xfs_da_args *args);
#endif /* __XFS_DIR2_SF_H__ */ #endif /* __XFS_DIR2_SF_H__ */
...@@ -29,24 +29,19 @@ ...@@ -29,24 +29,19 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir2_trace.c
* Tracing for xfs v2 directories.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_da_btree.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#ifdef XFS_DIR2_TRACE #ifdef XFS_DIR2_TRACE
......
...@@ -29,38 +29,30 @@ ...@@ -29,38 +29,30 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* xfs_dir_leaf.c
*
* GROT: figure out how to recover gracefully when bmap returns ENOSPC.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_alloc.h"
#include "xfs_btree.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"
#include "xfs_error.h" #include "xfs_error.h"
......
...@@ -152,30 +152,26 @@ typedef struct xfs_dir_put_args ...@@ -152,30 +152,26 @@ typedef struct xfs_dir_put_args
struct uio *uio; /* uio control structure */ struct uio *uio; /* uio control structure */
} xfs_dir_put_args_t; } xfs_dir_put_args_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_ENTSIZE_BYNAME)
int xfs_dir_leaf_entsize_byname(int len);
#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len) #define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len)
#else static inline int xfs_dir_leaf_entsize_byname(int len)
#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) /* space a name will use */ \ {
((uint)sizeof(xfs_dir_leaf_name_t)-1 + len) return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_ENTSIZE_BYENTRY)
int xfs_dir_leaf_entsize_byentry(xfs_dir_leaf_entry_t *entry);
#define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) \ #define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) \
xfs_dir_leaf_entsize_byentry(entry) xfs_dir_leaf_entsize_byentry(entry)
#else static inline int xfs_dir_leaf_entsize_byentry(xfs_dir_leaf_entry_t *entry)
#define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) /* space an entry will use */ \ {
((uint)sizeof(xfs_dir_leaf_name_t)-1 + (entry)->namelen) return (uint)sizeof(xfs_dir_leaf_name_t)-1 + (entry)->namelen;
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_NAMESTRUCT)
xfs_dir_leaf_name_t *
xfs_dir_leaf_namestruct(xfs_dir_leafblock_t *leafp, int offset);
#define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) \ #define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) \
xfs_dir_leaf_namestruct(leafp,offset) xfs_dir_leaf_namestruct(leafp,offset)
#else static inline xfs_dir_leaf_name_t *
#define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) /* point to name struct */ \ xfs_dir_leaf_namestruct(xfs_dir_leafblock_t *leafp, int offset)
((xfs_dir_leaf_name_t *)&((char *)(leafp))[offset]) {
#endif return (xfs_dir_leaf_name_t *)&((char *)(leafp))[offset];
}
/*======================================================================== /*========================================================================
* Function prototypes for the kernel. * Function prototypes for the kernel.
...@@ -190,7 +186,7 @@ int xfs_dir_shortform_lookup(struct xfs_da_args *args); ...@@ -190,7 +186,7 @@ int xfs_dir_shortform_lookup(struct xfs_da_args *args);
int xfs_dir_shortform_to_leaf(struct xfs_da_args *args); int xfs_dir_shortform_to_leaf(struct xfs_da_args *args);
int xfs_dir_shortform_removename(struct xfs_da_args *args); int xfs_dir_shortform_removename(struct xfs_da_args *args);
int xfs_dir_shortform_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp, int xfs_dir_shortform_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp,
struct xfs_dirent *dbp, xfs_dir_put_t put); struct xfs_dirent *dbp, xfs_dir_put_t put);
int xfs_dir_shortform_replace(struct xfs_da_args *args); int xfs_dir_shortform_replace(struct xfs_da_args *args);
/* /*
...@@ -237,7 +233,6 @@ int xfs_dir_put_dirent64_direct(xfs_dir_put_args_t *pa); ...@@ -237,7 +233,6 @@ int xfs_dir_put_dirent64_direct(xfs_dir_put_args_t *pa);
int xfs_dir_put_dirent64_uio(xfs_dir_put_args_t *pa); int xfs_dir_put_dirent64_uio(xfs_dir_put_args_t *pa);
int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino); int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
/* /*
* Global data. * Global data.
*/ */
......
...@@ -76,49 +76,44 @@ typedef struct xfs_dir_sf_sort { ...@@ -76,49 +76,44 @@ typedef struct xfs_dir_sf_sort {
char *name; /* name value, pointer into buffer */ char *name; /* name value, pointer into buffer */
} xfs_dir_sf_sort_t; } xfs_dir_sf_sort_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) #define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); static inline void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to)
#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) {
#else *(to) = XFS_GET_DIR_INO8(*from);
#define XFS_DIR_SF_GET_DIRINO(from,to) (*(to) = XFS_GET_DIR_INO8(*from)) }
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO) #define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); static inline void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to)
#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) {
#else XFS_PUT_DIR_INO8(*(from), *(to));
#define XFS_DIR_SF_PUT_DIRINO(from,to) XFS_PUT_DIR_INO8(*(from), *(to)) }
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME) #define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len)
int xfs_dir_sf_entsize_byname(int len); static inline int xfs_dir_sf_entsize_byname(int len)
#define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len) {
#else return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (len);
#define XFS_DIR_SF_ENTSIZE_BYNAME(len) /* space a name uses */ \ }
((uint)sizeof(xfs_dir_sf_entry_t)-1 + (len))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYENTRY)
int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep);
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep) #define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep)
#else static inline int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep)
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) /* space an entry uses */ \ {
((uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen) return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen;
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_NEXTENTRY)
xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep);
#define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep) #define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep)
#else static inline xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep)
#define XFS_DIR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ {
((xfs_dir_sf_entry_t *) \ return (xfs_dir_sf_entry_t *) \
((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep))) ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ALLFIT)
int xfs_dir_sf_allfit(int count, int totallen);
#define XFS_DIR_SF_ALLFIT(count,totallen) \ #define XFS_DIR_SF_ALLFIT(count,totallen) \
xfs_dir_sf_allfit(count,totallen) xfs_dir_sf_allfit(count,totallen)
#else static inline int xfs_dir_sf_allfit(int count, int totallen)
#define XFS_DIR_SF_ALLFIT(count,totallen) /* will all entries fit? */ \ {
((uint)sizeof(xfs_dir_sf_hdr_t) + \ return ((uint)sizeof(xfs_dir_sf_hdr_t) + \
((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen)) ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen));
#endif }
#if defined(XFS_DIR_TRACE) #if defined(XFS_DIR_TRACE)
......
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
......
...@@ -29,23 +29,21 @@ ...@@ -29,23 +29,21 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_sb.h" #include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_utils.h" #include "xfs_utils.h"
......
...@@ -54,24 +54,10 @@ extern int xfs_error_trap(int); ...@@ -54,24 +54,10 @@ extern int xfs_error_trap(int);
struct xfs_mount; struct xfs_mount;
extern void extern void xfs_error_report(char *tag, int level, struct xfs_mount *mp,
xfs_error_report( char *fname, int linenum, inst_t *ra);
char *tag, extern void xfs_corruption_error(char *tag, int level, struct xfs_mount *mp,
int level, void *p, char *fname, int linenum, inst_t *ra);
struct xfs_mount *mp,
char *fname,
int linenum,
inst_t *ra);
extern void
xfs_corruption_error(
char *tag,
int level,
struct xfs_mount *mp,
void *p,
char *fname,
int linenum,
inst_t *ra);
#define XFS_ERROR_REPORT(e, lvl, mp) \ #define XFS_ERROR_REPORT(e, lvl, mp) \
xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address)
...@@ -83,6 +69,32 @@ xfs_corruption_error( ...@@ -83,6 +69,32 @@ xfs_corruption_error(
#define XFS_ERRLEVEL_LOW 1 #define XFS_ERRLEVEL_LOW 1
#define XFS_ERRLEVEL_HIGH 5 #define XFS_ERRLEVEL_HIGH 5
/*
* Macros to set EFSCORRUPTED & return/branch.
*/
#define XFS_WANT_CORRUPTED_GOTO(x,l) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
if (unlikely(!fs_is_ok)) { \
XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
XFS_ERRLEVEL_LOW, NULL); \
error = XFS_ERROR(EFSCORRUPTED); \
goto l; \
} \
}
#define XFS_WANT_CORRUPTED_RETURN(x) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
if (unlikely(!fs_is_ok)) { \
XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
XFS_ERRLEVEL_LOW, NULL); \
return XFS_ERROR(EFSCORRUPTED); \
} \
}
/* /*
* error injection tags - the labels can be anything you want * error injection tags - the labels can be anything you want
* but each tag should have its own unique number * but each tag should have its own unique number
...@@ -139,8 +151,8 @@ xfs_corruption_error( ...@@ -139,8 +151,8 @@ xfs_corruption_error(
#define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT #define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT
#if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) #if (defined(DEBUG) || defined(INDUCE_IO_ERROR))
extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
void xfs_error_test_init(void); extern void xfs_error_test_init(void);
#define XFS_NUM_INJECT_ERROR 10 #define XFS_NUM_INJECT_ERROR 10
...@@ -156,12 +168,10 @@ void xfs_error_test_init(void); ...@@ -156,12 +168,10 @@ void xfs_error_test_init(void);
(rf))) (rf)))
#endif /* __ANSI_CPP__ */ #endif /* __ANSI_CPP__ */
int xfs_errortag_add(int error_tag, xfs_mount_t *mp); extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp);
int xfs_errortag_clear(int error_tag, xfs_mount_t *mp); extern int xfs_errortag_clear(int error_tag, xfs_mount_t *mp);
extern int xfs_errortag_clearall(xfs_mount_t *mp);
int xfs_errortag_clearall(xfs_mount_t *mp); extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud);
int xfs_errortag_clearall_umount(int64_t fsid, char *fsname,
int loud);
#else #else
#define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr)
#define xfs_errortag_add(tag, mp) (ENOSYS) #define xfs_errortag_add(tag, mp) (ENOSYS)
...@@ -185,9 +195,9 @@ int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, ...@@ -185,9 +195,9 @@ int xfs_errortag_clearall_umount(int64_t fsid, char *fsname,
struct xfs_mount; struct xfs_mount;
/* PRINTFLIKE4 */ /* PRINTFLIKE4 */
void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp, extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,
char *fmt, ...); char *fmt, ...);
/* PRINTFLIKE3 */ /* PRINTFLIKE3 */
void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);
#endif /* __XFS_ERROR_H__ */ #endif /* __XFS_ERROR_H__ */
...@@ -29,18 +29,11 @@ ...@@ -29,18 +29,11 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* This file contains the implementation of the xfs_efi_log_item
* and xfs_efd_log_item items.
*/
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_sb.h" #include "xfs_sb.h"
......
...@@ -29,38 +29,37 @@ ...@@ -29,38 +29,37 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_bit.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_ag.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_fsops.h" #include "xfs_fsops.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_rw.h"
#include "xfs_refcache.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_dir2.h" #include "xfs_rw.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_inode_item.h"
/* /*
* File system operations * File system operations
......
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -43,18 +42,17 @@ ...@@ -43,18 +42,17 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
......
...@@ -40,18 +40,8 @@ struct xfs_trans; ...@@ -40,18 +40,8 @@ struct xfs_trans;
/* /*
* Allocation parameters for inode allocation. * Allocation parameters for inode allocation.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_INODES) #define XFS_IALLOC_INODES(mp) (mp)->m_ialloc_inos
int xfs_ialloc_inodes(struct xfs_mount *mp); #define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks
#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp)
#else
#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_BLOCKS)
xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp)
#else
#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks)
#endif
/* /*
* For small block file systems, move inodes in clusters of this size. * For small block file systems, move inodes in clusters of this size.
...@@ -67,31 +57,25 @@ xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp); ...@@ -67,31 +57,25 @@ xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
/* /*
* Make an inode pointer out of the buffer/offset. * Make an inode pointer out of the buffer/offset.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MAKE_IPTR)
struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o);
#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o) #define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
#else static inline struct xfs_dinode *
#define XFS_MAKE_IPTR(mp,b,o) \ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
((xfs_dinode_t *)(xfs_buf_offset(b, (o) << (mp)->m_sb.sb_inodelog))) {
#endif return (xfs_dinode_t *)
(xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog));
}
/* /*
* Find a free (set) bit in the inode bitmask. * Find a free (set) bit in the inode bitmask.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_FIND_FREE)
int xfs_ialloc_find_free(xfs_inofree_t *fp);
#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp) #define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
#else static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp)) {
#endif return xfs_lowbit64(*fp);
}
#ifdef __KERNEL__ #ifdef __KERNEL__
/*
* Prototypes for visible xfs_ialloc.c routines.
*/
/* /*
* Allocate an inode on disk. * Allocate an inode on disk.
* Mode is used to tell whether the new inode will need space, and whether * Mode is used to tell whether the new inode will need space, and whether
......
...@@ -29,22 +29,27 @@ ...@@ -29,22 +29,27 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h" #include "xfs_dir.h"
#include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
......
...@@ -51,14 +51,12 @@ typedef __uint64_t xfs_inofree_t; ...@@ -51,14 +51,12 @@ typedef __uint64_t xfs_inofree_t;
#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) #define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) #define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASKN)
xfs_inofree_t xfs_inobt_maskn(int i, int n);
#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n) #define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
#else static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
#define XFS_INOBT_MASKN(i,n) \ {
((((n) >= XFS_INODES_PER_CHUNK ? \ return (((n) >= XFS_INODES_PER_CHUNK ? \
(xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i)) (xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i);
#endif }
/* /*
* Data record structure * Data record structure
...@@ -82,237 +80,110 @@ typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */ ...@@ -82,237 +80,110 @@ typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */
/* btree block header type */ /* btree block header type */
typedef struct xfs_btree_sblock xfs_inobt_block_t; typedef struct xfs_btree_sblock xfs_inobt_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_INOBT_BLOCK) #define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)XFS_BUF_PTR(bp))
xfs_inobt_block_t *xfs_buf_to_inobt_block(struct xfs_buf *bp);
#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp)
#else
#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp)))
#endif
/* /*
* Bit manipulations for ir_free. * Bit manipulations for ir_free.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASK)
xfs_inofree_t xfs_inobt_mask(int i);
#define XFS_INOBT_MASK(i) xfs_inobt_mask(i)
#else
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) #define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
#endif #define XFS_INOBT_IS_FREE(rp,i) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); #define XFS_INOBT_IS_FREE_DISK(rp,i) \
#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) ((INT_GET((rp)->ir_free,ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
#define XFS_INOBT_IS_FREE_DISK(rp,i) xfs_inobt_is_free_disk(rp,i)
#else
#define XFS_INOBT_IS_FREE(rp,i) \
(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
#define XFS_INOBT_IS_FREE_DISK(rp,i) \
((INT_GET((rp)->ir_free, ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE)
void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i);
#define XFS_INOBT_SET_FREE(rp,i) xfs_inobt_set_free(rp,i)
#else
#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i)) #define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_CLR_FREE)
void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i);
#define XFS_INOBT_CLR_FREE(rp,i) xfs_inobt_clr_free(rp,i)
#else
#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) #define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i))
#endif
/* /*
* Real block structures have a size equal to the disk block size. * Real block structures have a size equal to the disk block size.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_SIZE)
int xfs_inobt_block_size(int lev, struct xfs_btree_cur *cur);
#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur)
#else
#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) #define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif #define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0])
#define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0])
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MAXRECS)
int xfs_inobt_block_maxrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur)
#else
#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \
((cur)->bc_mp->m_inobt_mxr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MINRECS)
int xfs_inobt_block_minrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur)
#else
#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \
((cur)->bc_mp->m_inobt_mnr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_LAST_REC)
int xfs_inobt_is_last_rec(struct xfs_btree_cur *cur);
#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur)
#else
#define XFS_INOBT_IS_LAST_REC(cur) \ #define XFS_INOBT_IS_LAST_REC(cur) \
((cur)->bc_ptrs[0] == \ ((cur)->bc_ptrs[0] == INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
#endif
/* /*
* Maximum number of inode btree levels. * Maximum number of inode btree levels.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IN_MAXLEVELS)
int xfs_in_maxlevels(struct xfs_mount *mp);
#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp)
#else
#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) #define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
#endif
/* /*
* block numbers in the AG. * block numbers in the AG.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IBT_BLOCK) #define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
xfs_agblock_t xfs_ibt_block(struct xfs_mount *mp); #define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp)
#else
#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_PREALLOC_BLOCKS)
xfs_agblock_t xfs_prealloc_blocks(struct xfs_mount *mp);
#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp)
#else
#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
#endif
/* /*
* Record, key, and pointer address macros for btree blocks. * Record, key, and pointer address macros for btree blocks.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_REC_ADDR) #define XFS_INOBT_REC_ADDR(bb,i,cur) \
xfs_inobt_rec_t * (XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, \
xfs_inobt_rec_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); i, XFS_INOBT_BLOCK_MAXRECS(0, cur)))
#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur) #define XFS_INOBT_KEY_ADDR(bb,i,cur) \
#else (XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \
#define XFS_INOBT_REC_ADDR(bb,i,cur) \ i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(0, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_KEY_ADDR)
xfs_inobt_key_t *
xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur);
#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur)
#else
#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(1, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_PTR_ADDR) #define XFS_INOBT_PTR_ADDR(bb,i,cur) \
xfs_inobt_ptr_t * (XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \
xfs_inobt_ptr_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur)
#else
#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(1, cur))
#endif
/*
* Prototypes for externally visible routines.
*/
/* /*
* Decrement cursor by one record at the level. * Decrement cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched. * For nonzero levels the leaf-ward information is untouched.
*/ */
int /* error */ extern int xfs_inobt_decrement(struct xfs_btree_cur *cur, int level, int *stat);
xfs_inobt_decrement(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
int *stat); /* success/failure */
/* /*
* Delete the record pointed to by cur. * Delete the record pointed to by cur.
* The cursor refers to the place where the record was (could be inserted) * The cursor refers to the place where the record was (could be inserted)
* when the operation returns. * when the operation returns.
*/ */
int /* error */ extern int xfs_inobt_delete(struct xfs_btree_cur *cur, int *stat);
xfs_inobt_delete(
struct xfs_btree_cur *cur, /* btree cursor */
int *stat); /* success/failure */
/* /*
* Get the data from the pointed-to record. * Get the data from the pointed-to record.
*/ */
int /* error */ extern int xfs_inobt_get_rec(struct xfs_btree_cur *cur, xfs_agino_t *ino,
xfs_inobt_get_rec( __int32_t *fcnt, xfs_inofree_t *free, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agino_t *ino, /* output: starting inode of chunk */
__int32_t *fcnt, /* output: number of free inodes */
xfs_inofree_t *free, /* output: free inode mask */
int *stat); /* output: success/failure */
/* /*
* Increment cursor by one record at the level. * Increment cursor by one record at the level.
* For nonzero levels the leaf-ward information is untouched. * For nonzero levels the leaf-ward information is untouched.
*/ */
int /* error */ extern int xfs_inobt_increment(struct xfs_btree_cur *cur, int level, int *stat);
xfs_inobt_increment(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
int *stat); /* success/failure */
/* /*
* Insert the current record at the point referenced by cur. * Insert the current record at the point referenced by cur.
* The cursor may be inconsistent on return if splits have been done. * The cursor may be inconsistent on return if splits have been done.
*/ */
int /* error */ extern int xfs_inobt_insert(struct xfs_btree_cur *cur, int *stat);
xfs_inobt_insert(
struct xfs_btree_cur *cur, /* btree cursor */
int *stat); /* success/failure */
/* /*
* Lookup the record equal to ino in the btree given by cur. * Lookup the record equal to ino in the btree given by cur.
*/ */
int /* error */ extern int xfs_inobt_lookup_eq(struct xfs_btree_cur *cur, xfs_agino_t ino,
xfs_inobt_lookup_eq( __int32_t fcnt, xfs_inofree_t free, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
int *stat); /* success/failure */
/* /*
* Lookup the first record greater than or equal to ino * Lookup the first record greater than or equal to ino
* in the btree given by cur. * in the btree given by cur.
*/ */
int /* error */ extern int xfs_inobt_lookup_ge(struct xfs_btree_cur *cur, xfs_agino_t ino,
xfs_inobt_lookup_ge( __int32_t fcnt, xfs_inofree_t free, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
int *stat); /* success/failure */
/* /*
* Lookup the first record less than or equal to ino * Lookup the first record less than or equal to ino
* in the btree given by cur. * in the btree given by cur.
*/ */
int /* error */ extern int xfs_inobt_lookup_le(struct xfs_btree_cur *cur, xfs_agino_t ino,
xfs_inobt_lookup_le( __int32_t fcnt, xfs_inofree_t free, int *stat);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
int *stat); /* success/failure */
/* /*
* Update the record referred to by cur, to the value given * Update the record referred to by cur, to the value given
* by [ino, fcnt, free]. * by [ino, fcnt, free].
* This either works (return 0) or gets an EFSCORRUPTED error. * This either works (return 0) or gets an EFSCORRUPTED error.
*/ */
int /* error */ extern int xfs_inobt_update(struct xfs_btree_cur *cur, xfs_agino_t ino,
xfs_inobt_update( __int32_t fcnt, xfs_inofree_t free);
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free); /* free inode mask */
#endif /* __XFS_IALLOC_BTREE_H__ */ #endif /* __XFS_IALLOC_BTREE_H__ */
...@@ -29,15 +29,12 @@ ...@@ -29,15 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <linux/delay.h>
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
...@@ -45,19 +42,18 @@ ...@@ -45,19 +42,18 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_bit.h"
/* /*
* Initialize the inode hash table for the newly mounted file system. * Initialize the inode hash table for the newly mounted file system.
......
...@@ -29,12 +29,13 @@ ...@@ -29,12 +29,13 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_imap.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_sb.h" #include "xfs_sb.h"
...@@ -43,24 +44,22 @@ ...@@ -43,24 +44,22 @@
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_alloc_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_btree.h"
#include "xfs_imap.h"
#include "xfs_alloc.h"
#include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h" #include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_bmap.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_inode_item.h"
#include "xfs_btree.h"
#include "xfs_alloc.h"
#include "xfs_ialloc.h"
#include "xfs_bmap.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#include "xfs_quota.h" #include "xfs_quota.h"
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h"
#include "xfs_macros.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_macros.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h" #include "xfs_dir.h"
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册