[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: Nathan Scott <nathans@sgi.com>
This commit is contained in:
Nathan Scott 2005-11-02 14:38:42 +11:00
parent 61c1e689fb
commit a844f4510d
93 changed files with 1568 additions and 3094 deletions

View File

@ -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 @@
#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"

View File

@ -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"

View File

@ -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"

View File

@ -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 @@
#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"

View File

@ -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 @@
#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"

View 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__ */

View File

@ -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"

View File

@ -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(
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[] = {
{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[] = {
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[] = {
{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 */

View File

@ -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"

View File

@ -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 @@
#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"

View File

@ -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 @@
#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 @@
#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"

View File

@ -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 @@
#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 @@
#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"
/* /*

View File

@ -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) */

View File

@ -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"

View File

@ -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 @@
#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

View File

@ -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 @@
#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"

View File

@ -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__ */

View File

@ -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"

View File

@ -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
/* 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
/* 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
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_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp)
#else
#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
#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_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) \
XFS_MIN_FREELIST_RAW((uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp)
#endif
#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) \ #define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
(MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + \ (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
MIN(cl + 1, XFS_AG_MAXLEVELS(mp))) #define XFS_MIN_FREELIST(a,mp) \
#endif (XFS_MIN_FREELIST_RAW( \
INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \
INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp))
#define XFS_MIN_FREELIST_PAG(pag,mp) \
(XFS_MIN_FREELIST_RAW( \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
#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__ */

View File

@ -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"

View File

@ -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"

View File

@ -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);
* 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__ */

View File

@ -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 @@
#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

View File

@ -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 @@
#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

View File

@ -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 }
/*======================================================================== /*========================================================================

View File

@ -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)
/* /*

View File

@ -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);

View File

@ -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"

View File

@ -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);
#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.

View File

@ -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 @@
#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_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_alloc.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h"
#include "xfs_alloc.h"
#include "xfs_bit.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"

View File

@ -114,31 +114,31 @@ typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
#define DSTARTBLOCKMASK \ #define DSTARTBLOCKMASK \
(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLSTARTBLOCK)
int isnullstartblock(xfs_fsblock_t x);
#define ISNULLSTARTBLOCK(x) isnullstartblock(x) #define ISNULLSTARTBLOCK(x) isnullstartblock(x)
#else static inline int isnullstartblock(xfs_fsblock_t x)
#define ISNULLSTARTBLOCK(x) (((x) & STARTBLOCKMASK) == STARTBLOCKMASK) {
#endif return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLDSTARTBLOCK) }
int isnulldstartblock(xfs_dfsbno_t x);
#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x) #define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
#else static inline int isnulldstartblock(xfs_dfsbno_t x)
#define ISNULLDSTARTBLOCK(x) (((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK) {
#endif return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_NULLSTARTBLOCK) }
xfs_fsblock_t nullstartblock(int k);
#define NULLSTARTBLOCK(k) nullstartblock(k) #define NULLSTARTBLOCK(k) nullstartblock(k)
#else static inline xfs_fsblock_t nullstartblock(int k)
#define NULLSTARTBLOCK(k) \ {
((ASSERT(k < (1 << STARTBLOCKVALBITS))), (STARTBLOCKMASK | (k))) ASSERT(k < (1 << STARTBLOCKVALBITS));
#endif return STARTBLOCKMASK | (k);
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_STARTBLOCKVAL) }
xfs_filblks_t startblockval(xfs_fsblock_t x);
#define STARTBLOCKVAL(x) startblockval(x) #define STARTBLOCKVAL(x) startblockval(x)
#else static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
#define STARTBLOCKVAL(x) ((xfs_filblks_t)((x) & ~STARTBLOCKMASK)) {
#endif return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
}
/* /*
* Possible extent formats. * Possible extent formats.
@ -159,14 +159,9 @@ typedef enum {
/* /*
* Extent state and extent format macros. * Extent state and extent format macros.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTFMT_INODE ) #define XFS_EXTFMT_INODE(x) \
xfs_exntfmt_t xfs_extfmt_inode(struct xfs_inode *ip); (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
#define XFS_EXTFMT_INODE(x) xfs_extfmt_inode(x) XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
#else
#define XFS_EXTFMT_INODE(x) \
(XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
#endif
#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
/* /*
@ -192,248 +187,111 @@ typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */
/* btree block header type */ /* btree block header type */
typedef struct xfs_btree_lblock xfs_bmbt_block_t; typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BMBT_BLOCK) #define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp))
xfs_bmbt_block_t *xfs_buf_to_bmbt_block(struct xfs_buf *bp);
#define XFS_BUF_TO_BMBT_BLOCK(bp) xfs_buf_to_bmbt_block(bp)
#else
#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_DSIZE) #define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
int xfs_bmap_rblock_dsize(int lev, struct xfs_btree_cur *cur); #define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) xfs_bmap_rblock_dsize(lev,cur) #define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
#else
#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_ISIZE)
int xfs_bmap_rblock_isize(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) xfs_bmap_rblock_isize(lev,cur)
#else
#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
(cur)->bc_private.b.whichfork)->if_broot_bytes) (cur)->bc_private.b.whichfork)->if_broot_bytes)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_IBLOCK_SIZE)
int xfs_bmap_iblock_size(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_IBLOCK_SIZE(lev,cur) xfs_bmap_iblock_size(lev,cur)
#else
#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DSIZE) #define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
int xfs_bmap_block_dsize(int lev, struct xfs_btree_cur *cur); (((lev) == (cur)->bc_nlevels - 1 ? \
#define XFS_BMAP_BLOCK_DSIZE(lev,cur) xfs_bmap_block_dsize(lev,cur) XFS_BMAP_RBLOCK_DSIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
#else #define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \ (((lev) == (cur)->bc_nlevels - 1 ? \
((lev) == (cur)->bc_nlevels - 1 ? \ XFS_BMAP_RBLOCK_ISIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
XFS_BMAP_RBLOCK_DSIZE(lev,cur) : \
XFS_BMAP_IBLOCK_SIZE(lev,cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_ISIZE)
int xfs_bmap_block_isize(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_BLOCK_ISIZE(lev,cur) xfs_bmap_block_isize(lev,cur)
#else
#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BMAP_RBLOCK_ISIZE(lev,cur) : \
XFS_BMAP_IBLOCK_SIZE(lev,cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMAXRECS)
int xfs_bmap_block_dmaxrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) xfs_bmap_block_dmaxrecs(lev,cur)
#else
#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \ (((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
xfs_bmdr, (lev) == 0) : \ xfs_bmdr, (lev) == 0) : \
((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMAXRECS)
int xfs_bmap_block_imaxrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) xfs_bmap_block_imaxrecs(lev,cur)
#else
#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \ #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \ (((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
xfs_bmbt, (lev) == 0) : \ xfs_bmbt, (lev) == 0) : \
((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMINRECS)
int xfs_bmap_block_dminrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) xfs_bmap_block_dminrecs(lev,cur)
#else
#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \ #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \ (((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur),\
xfs_bmdr, (lev) == 0) : \ xfs_bmdr, (lev) == 0) : \
((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMINRECS)
int xfs_bmap_block_iminrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) xfs_bmap_block_iminrecs(lev,cur)
#else
#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \ #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \ (((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
xfs_bmbt, (lev) == 0) : \ xfs_bmbt, (lev) == 0) : \
((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_DADDR) #define XFS_BMAP_REC_DADDR(bb,i,cur) \
xfs_bmbt_rec_t * (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \
xfs_bmap_rec_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
#define XFS_BMAP_REC_DADDR(bb,i,cur) xfs_bmap_rec_daddr(bb,i,cur) xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#else INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#define XFS_BMAP_REC_DADDR(bb,i,cur) \ #define XFS_BMAP_REC_IADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_IADDR)
xfs_bmbt_rec_t *
xfs_bmap_rec_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
#define XFS_BMAP_REC_IADDR(bb,i,cur) xfs_bmap_rec_iaddr(bb,i,cur)
#else
#define XFS_BMAP_REC_IADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_DADDR) #define XFS_BMAP_KEY_DADDR(bb,i,cur) \
xfs_bmbt_key_t * (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \
xfs_bmap_key_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
#define XFS_BMAP_KEY_DADDR(bb,i,cur) xfs_bmap_key_daddr(bb,i,cur) xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#else INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#define XFS_BMAP_KEY_DADDR(bb,i,cur) \ #define XFS_BMAP_KEY_IADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_IADDR)
xfs_bmbt_key_t *
xfs_bmap_key_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
#define XFS_BMAP_KEY_IADDR(bb,i,cur) xfs_bmap_key_iaddr(bb,i,cur)
#else
#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_DADDR) #define XFS_BMAP_PTR_DADDR(bb,i,cur) \
xfs_bmbt_ptr_t * (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \
xfs_bmap_ptr_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
#define XFS_BMAP_PTR_DADDR(bb,i,cur) xfs_bmap_ptr_daddr(bb,i,cur) xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#else INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#define XFS_BMAP_PTR_DADDR(bb,i,cur) \ #define XFS_BMAP_PTR_IADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \ (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_IADDR)
xfs_bmbt_ptr_t *
xfs_bmap_ptr_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
#define XFS_BMAP_PTR_IADDR(bb,i,cur) xfs_bmap_ptr_iaddr(bb,i,cur)
#else
#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
#endif
/* /*
* These are to be used when we know the size of the block and * These are to be used when we know the size of the block and
* we don't have a cursor. * we don't have a cursor.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_REC_ADDR)
xfs_bmbt_rec_t *xfs_bmap_broot_rec_addr(xfs_bmbt_block_t *bb, int i, int sz);
#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) xfs_bmap_broot_rec_addr(bb,i,sz)
#else
#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ #define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) (XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_KEY_ADDR)
xfs_bmbt_key_t *xfs_bmap_broot_key_addr(xfs_bmbt_block_t *bb, int i, int sz);
#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) xfs_bmap_broot_key_addr(bb,i,sz)
#else
#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) (XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_PTR_ADDR)
xfs_bmbt_ptr_t *xfs_bmap_broot_ptr_addr(xfs_bmbt_block_t *bb, int i, int sz);
#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) xfs_bmap_broot_ptr_addr(bb,i,sz)
#else
#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
#endif
#define XFS_BMAP_BROOT_NUMRECS(bb) INT_GET((bb)->bb_numrecs, ARCH_CONVERT)
#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_NUMRECS)
int xfs_bmap_broot_numrecs(xfs_bmdr_block_t *bb);
#define XFS_BMAP_BROOT_NUMRECS(bb) xfs_bmap_broot_numrecs(bb)
#else
#define XFS_BMAP_BROOT_NUMRECS(bb) (INT_GET((bb)->bb_numrecs, ARCH_CONVERT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_MAXRECS)
int xfs_bmap_broot_maxrecs(int sz);
#define XFS_BMAP_BROOT_MAXRECS(sz) xfs_bmap_broot_maxrecs(sz)
#else
#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE_CALC)
int xfs_bmap_broot_space_calc(int nrecs);
#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) xfs_bmap_broot_space_calc(nrecs)
#else
#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
((int)(sizeof(xfs_bmbt_block_t) + \ (int)(sizeof(xfs_bmbt_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))) ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE)
int xfs_bmap_broot_space(xfs_bmdr_block_t *bb);
#define XFS_BMAP_BROOT_SPACE(bb) xfs_bmap_broot_space(bb)
#else
#define XFS_BMAP_BROOT_SPACE(bb) \ #define XFS_BMAP_BROOT_SPACE(bb) \
XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)) (XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)))
#endif #define XFS_BMDR_SPACE_CALC(nrecs) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMDR_SPACE_CALC) (int)(sizeof(xfs_bmdr_block_t) + \
int xfs_bmdr_space_calc(int nrecs); ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
#define XFS_BMDR_SPACE_CALC(nrecs) xfs_bmdr_space_calc(nrecs)
#else
#define XFS_BMDR_SPACE_CALC(nrecs) \
((int)(sizeof(xfs_bmdr_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))))
#endif
/* /*
* Maximum number of bmap btree levels. * Maximum number of bmap btree levels.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BM_MAXLEVELS) #define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
int xfs_bm_maxlevels(struct xfs_mount *mp, int w);
#define XFS_BM_MAXLEVELS(mp,w) xfs_bm_maxlevels(mp,w)
#else
#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[w])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_SANITY_CHECK) #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
int level);
#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
xfs_bmap_sanity_check(mp,bb,level)
#else
#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
(INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \ (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \
INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \ INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \ INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0]) INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= \
#endif (mp)->m_bmap_dmxr[(level) != 0])
#ifdef __KERNEL__ #ifdef __KERNEL__
@ -459,234 +317,84 @@ extern ktrace_t *xfs_bmbt_trace_buf;
/* /*
* Prototypes for xfs_bmap.c to call. * Prototypes for xfs_bmap.c to call.
*/ */
extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
void extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *);
xfs_bmdr_to_bmbt( extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *);
xfs_bmdr_block_t *, extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
int, extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur,
xfs_bmbt_block_t *, int, struct xfs_buf **bpp);
int); extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r);
extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r);
int extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r);
xfs_bmbt_decrement( extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r);
struct xfs_btree_cur *,
int,
int *);
int
xfs_bmbt_delete(
struct xfs_btree_cur *,
int *);
void
xfs_bmbt_get_all(
xfs_bmbt_rec_t *r,
xfs_bmbt_irec_t *s);
xfs_bmbt_block_t *
xfs_bmbt_get_block(
struct xfs_btree_cur *cur,
int level,
struct xfs_buf **bpp);
xfs_filblks_t
xfs_bmbt_get_blockcount(
xfs_bmbt_rec_t *r);
xfs_fsblock_t
xfs_bmbt_get_startblock(
xfs_bmbt_rec_t *r);
xfs_fileoff_t
xfs_bmbt_get_startoff(
xfs_bmbt_rec_t *r);
xfs_exntst_t
xfs_bmbt_get_state(
xfs_bmbt_rec_t *r);
#ifndef XFS_NATIVE_HOST #ifndef XFS_NATIVE_HOST
void extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
xfs_bmbt_disk_get_all( extern xfs_exntst_t xfs_bmbt_disk_get_state(xfs_bmbt_rec_t *r);
xfs_bmbt_rec_t *r, extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
xfs_bmbt_irec_t *s); extern xfs_fsblock_t xfs_bmbt_disk_get_startblock(xfs_bmbt_rec_t *r);
extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
xfs_exntst_t
xfs_bmbt_disk_get_state(
xfs_bmbt_rec_t *r);
xfs_filblks_t
xfs_bmbt_disk_get_blockcount(
xfs_bmbt_rec_t *r);
xfs_fsblock_t
xfs_bmbt_disk_get_startblock(
xfs_bmbt_rec_t *r);
xfs_fileoff_t
xfs_bmbt_disk_get_startoff(
xfs_bmbt_rec_t *r);
#else #else
#define xfs_bmbt_disk_get_all(r, s) \ #define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s)
xfs_bmbt_get_all(r, s) #define xfs_bmbt_disk_get_state(r) xfs_bmbt_get_state(r)
#define xfs_bmbt_disk_get_state(r) \ #define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r)
xfs_bmbt_get_state(r) #define xfs_bmbt_disk_get_startblock(r) xfs_bmbt_get_blockcount(r)
#define xfs_bmbt_disk_get_blockcount(r) \ #define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r)
xfs_bmbt_get_blockcount(r)
#define xfs_bmbt_disk_get_startblock(r) \
xfs_bmbt_get_blockcount(r)
#define xfs_bmbt_disk_get_startoff(r) \
xfs_bmbt_get_startoff(r)
#endif /* XFS_NATIVE_HOST */ #endif /* XFS_NATIVE_HOST */
int extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *);
xfs_bmbt_increment( extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *);
struct xfs_btree_cur *, extern void xfs_bmbt_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
int, extern void xfs_bmbt_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int,
int *); int);
extern int xfs_bmbt_lookup_eq(struct xfs_btree_cur *, xfs_fileoff_t,
int xfs_fsblock_t, xfs_filblks_t, int *);
xfs_bmbt_insert( extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t,
struct xfs_btree_cur *, xfs_fsblock_t, xfs_filblks_t, int *);
int *);
void
xfs_bmbt_log_block(
struct xfs_btree_cur *,
struct xfs_buf *,
int);
void
xfs_bmbt_log_recs(
struct xfs_btree_cur *,
struct xfs_buf *,
int,
int);
int
xfs_bmbt_lookup_eq(
struct xfs_btree_cur *,
xfs_fileoff_t,
xfs_fsblock_t,
xfs_filblks_t,
int *);
int
xfs_bmbt_lookup_ge(
struct xfs_btree_cur *,
xfs_fileoff_t,
xfs_fsblock_t,
xfs_filblks_t,
int *);
/* /*
* Give the bmap btree a new root block. Copy the old broot contents * Give the bmap btree a new root block. Copy the old broot contents
* down into a real block and make the broot point to it. * down into a real block and make the broot point to it.
*/ */
int /* error */ extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat);
xfs_bmbt_newroot(
struct xfs_btree_cur *cur, /* btree cursor */
int *logflags, /* logging flags for inode */
int *stat); /* return status - 0 fail */
void extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
xfs_bmbt_set_all( extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
xfs_bmbt_rec_t *r, xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
xfs_bmbt_irec_t *s); extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v);
extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v);
void extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v);
xfs_bmbt_set_allf( extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v);
xfs_bmbt_rec_t *r,
xfs_fileoff_t o,
xfs_fsblock_t b,
xfs_filblks_t c,
xfs_exntst_t v);
void
xfs_bmbt_set_blockcount(
xfs_bmbt_rec_t *r,
xfs_filblks_t v);
void
xfs_bmbt_set_startblock(
xfs_bmbt_rec_t *r,
xfs_fsblock_t v);
void
xfs_bmbt_set_startoff(
xfs_bmbt_rec_t *r,
xfs_fileoff_t v);
void
xfs_bmbt_set_state(
xfs_bmbt_rec_t *r,
xfs_exntst_t v);
#ifndef XFS_NATIVE_HOST #ifndef XFS_NATIVE_HOST
void extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
xfs_bmbt_disk_set_all( extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
xfs_bmbt_rec_t *r, xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
xfs_bmbt_irec_t *s);
void
xfs_bmbt_disk_set_allf(
xfs_bmbt_rec_t *r,
xfs_fileoff_t o,
xfs_fsblock_t b,
xfs_filblks_t c,
xfs_exntst_t v);
#else #else
#define xfs_bmbt_disk_set_all(r, s) \ #define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s)
xfs_bmbt_set_all(r, s) #define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v)
#define xfs_bmbt_disk_set_allf(r, o, b, c, v) \
xfs_bmbt_set_allf(r, o, b, c, v)
#endif /* XFS_NATIVE_HOST */ #endif /* XFS_NATIVE_HOST */
void extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
xfs_bmbt_to_bmdr( extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
xfs_bmbt_block_t *, xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t);
int,
xfs_bmdr_block_t *,
int);
int
xfs_bmbt_update(
struct xfs_btree_cur *,
xfs_fileoff_t,
xfs_fsblock_t,
xfs_filblks_t,
xfs_exntst_t);
#ifdef DEBUG #ifdef DEBUG
/* /*
* Get the data from the pointed-to record. * Get the data from the pointed-to record.
*/ */
int extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *,
xfs_bmbt_get_rec( xfs_fsblock_t *, xfs_filblks_t *,
struct xfs_btree_cur *, xfs_exntst_t *, int *);
xfs_fileoff_t *,
xfs_fsblock_t *,
xfs_filblks_t *,
xfs_exntst_t *,
int *);
#endif #endif
/* /*
* Search an extent list for the extent which includes block * Search an extent list for the extent which includes block
* bno. * bno.
*/ */
xfs_bmbt_rec_t * xfs_bmbt_rec_t *xfs_bmap_do_search_extents(xfs_bmbt_rec_t *,
xfs_bmap_do_search_extents( xfs_extnum_t, xfs_extnum_t, xfs_fileoff_t, int *,
xfs_bmbt_rec_t *, xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
xfs_extnum_t,
xfs_extnum_t,
xfs_fileoff_t,
int *,
xfs_extnum_t *,
xfs_bmbt_irec_t *,
xfs_bmbt_irec_t *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */

View File

@ -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 @@
#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"
/* /*

View File

@ -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
/* /*
* 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(
/* /*
* 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__ */

View File

@ -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"

View File

@ -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 @@
#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 @@
#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

View File

@ -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
/*======================================================================== /*========================================================================

View File

@ -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"

View File

@ -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
/* /*
* 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);
((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)
#define XFS_DFORK_ASIZE(dip,mp) \
XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
#define XFS_DFORK_SIZE(dip,mp,w) \
XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE)
int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp);
#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp)
#else
#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);
#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

View File

@ -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"

View File

@ -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 @@
#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 @@
#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.

View File

@ -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"

View File

@ -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__ */

View File

@ -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"

View File

@ -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,

View File

@ -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 @@
#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 @@
#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.

View File

@ -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;
#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;
#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 {
} 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 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)
#else
#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp))
#endif
/*
* 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)
#else
#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \
XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp))
#endif
/*
* 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) \
xfs_dir2_db_off_to_byte(mp, db, o)
#else
#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
(((xfs_dir2_off_t)(db) << \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o))
#endif
/* /*
* Convert byte in space to (DB) block * Convert byte in space to (DB) block
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB)
xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by);
#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) #define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
#else static inline xfs_dir2_db_t
#define XFS_DIR2_BYTE_TO_DB(mp,by) \ xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by)
((xfs_dir2_db_t)((by) >> \ {
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog))) return (xfs_dir2_db_t)((by) >> \
#endif ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog));
}
/* /*
* Convert byte in space to (DA) block * Convert dataptr to a block number
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA) #define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by); static inline xfs_dir2_db_t
#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
#else {
#define XFS_DIR2_BYTE_TO_DA(mp,by) \ return XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)) }
#endif
/* /*
* Convert byte in space to offset in a block * 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) #define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
#else static inline xfs_dir2_data_aoff_t
#define XFS_DIR2_BYTE_TO_OFF(mp,by) \ xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by)
((xfs_dir2_data_aoff_t)((by) & \ {
((1 << ((mp)->m_sb.sb_blocklog + \ return (xfs_dir2_data_aoff_t)((by) & \
(mp)->m_sb.sb_dirblklog)) - 1))) ((1 << ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) - 1));
#endif }
/* /*
* Convert block and offset to dataptr * Convert dataptr to a byte offset in a block
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_DATAPTR) #define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
xfs_dir2_dataptr_t static inline xfs_dir2_data_aoff_t
xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
xfs_dir2_data_aoff_t o); {
#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ return XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
xfs_dir2_db_off_to_dataptr(mp, db, o) }
#else
#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ /*
XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)) * Convert block and offset to byte in space
#endif */
#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
xfs_dir2_db_off_to_byte(mp, db, o)
static inline 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)
{
return ((xfs_dir2_off_t)(db) << \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o);
}
/* /*
* Convert block (DB) to block (dablk) * 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) #define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
#else static inline xfs_dablk_t
#define XFS_DIR2_DB_TO_DA(mp,db) \ xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog)) {
#endif return (xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog);
}
/*
* Convert byte in space to (DA) block
*/
#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
static inline xfs_dablk_t
xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by)
{
return XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by));
}
/*
* Convert block and offset to dataptr
*/
#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
xfs_dir2_db_off_to_dataptr(mp, db, o)
static inline 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)
{
return XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o));
}
/* /*
* 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__ */

View File

@ -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"

View File

@ -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;
#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 {
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));
}
/* extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
* Functions. int first, int last);
*/ extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
struct xfs_dabuf *lbp);
extern void extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
int first, int last); struct xfs_da_args *args, int *indexp,
struct xfs_da_state *state);
extern int extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
xfs_dir2_leaf_to_node(struct xfs_da_args *args, struct xfs_dabuf *lbp); struct xfs_dabuf *leaf2_bp);
extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
extern xfs_dahash_t struct xfs_da_state_blk *oldblk,
xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count); struct xfs_da_state_blk *newblk);
extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
extern int extern void xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, struct xfs_da_state_blk *drop_blk,
struct xfs_da_args *args, int *indexp, struct xfs_da_state_blk *save_blk);
struct xfs_da_state *state); extern int xfs_dir2_node_addname(struct xfs_da_args *args);
extern int xfs_dir2_node_lookup(struct xfs_da_args *args);
extern int extern int xfs_dir2_node_removename(struct xfs_da_args *args);
xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, extern int xfs_dir2_node_replace(struct xfs_da_args *args);
struct xfs_dabuf *leaf2_bp); extern int xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
int *rvalp);
extern int
xfs_dir2_leafn_split(struct xfs_da_state *state,
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__ */

View File

@ -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"

View File

@ -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) #define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
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) xfs_dir2_sf_get_inumber(sfp, from)
static inline xfs_intino_t
#else xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from)
#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ {
((sfp)->hdr.i8count == 0 ? \ 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__ */

View File

@ -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

View File

@ -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"

View File

@ -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);
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);
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.
*/ */

View File

@ -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)

View File

@ -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"

View File

@ -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"

View File

@ -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(
#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(
#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);
(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,
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__ */

View File

@ -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"

View File

@ -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

View File

@ -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 @@
#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"

View File

@ -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);
/* /*
* 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

View File

@ -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"

View File

@ -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 */
/* 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) #define XFS_INOBT_PTR_ADDR(bb,i,cur) \
xfs_inobt_key_t * (XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \
xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); i, XFS_INOBT_BLOCK_MAXRECS(1, 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)
xfs_inobt_ptr_t *
xfs_inobt_ptr_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *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__ */

View File

@ -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 @@
#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.

View File

@ -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 @@
#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"

View File

@ -32,6 +32,12 @@
#ifndef __XFS_INODE_H__ #ifndef __XFS_INODE_H__
#define __XFS_INODE_H__ #define __XFS_INODE_H__
/*
* Fork identifiers.
*/
#define XFS_DATA_FORK 0
#define XFS_ATTR_FORK 1
/* /*
* File incore extent information, present for each of data & attr forks. * File incore extent information, present for each of data & attr forks.
*/ */
@ -311,60 +317,16 @@ typedef struct xfs_inode {
/* /*
* Fork handling. * Fork handling.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR) #define XFS_IFORK_PTR(ip,w) \
xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w); ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
#else
#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q)
int xfs_ifork_q(xfs_inode_t *ip);
#define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
#else
#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE)
int xfs_ifork_dsize(xfs_inode_t *ip);
#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
#else
#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE)
int xfs_ifork_asize(xfs_inode_t *ip);
#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
#else
#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE)
int xfs_ifork_size(xfs_inode_t *ip, int w);
#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
#else
#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT)
int xfs_ifork_format(xfs_inode_t *ip, int w);
#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
#else
#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET)
void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n);
#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
#else
#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS)
int xfs_ifork_nextents(xfs_inode_t *ip, int w);
#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
#else
#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET)
void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
#else
#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
#endif
#ifdef __KERNEL__ #ifdef __KERNEL__
@ -418,28 +380,11 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
#define XFS_ITRUNC_DEFINITE 0x1 #define XFS_ITRUNC_DEFINITE 0x1
#define XFS_ITRUNC_MAYBE 0x2 #define XFS_ITRUNC_MAYBE 0x2
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
struct vnode *xfs_itov(xfs_inode_t *ip);
#define XFS_ITOV(ip) xfs_itov(ip)
#else
#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) #define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
#endif
#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) #define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV)
struct bhv_desc *xfs_itobhv(xfs_inode_t *ip);
#define XFS_ITOBHV(ip) xfs_itobhv(ip)
#else
#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) #define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
#endif #define XFS_BHVTOI(bhvp) ((xfs_inode_t *)((char *)(bhvp) - \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI) (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
#else
#define XFS_BHVTOI(bhvp) \
((xfs_inode_t *)((char *)(bhvp) - \
(char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
#endif
#define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops) #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
/* /*

View File

@ -29,38 +29,32 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* This file contains the implementation of the xfs_inode_log_item.
* It contains the item operations used to manipulate the inode log
* items as well as utility routines used by the inode specific
* transaction routines.
*/
#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_buf_item.h" #include "xfs_buf_item.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_trans_priv.h" #include "xfs_trans_priv.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_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_inode_item.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rw.h" #include "xfs_rw.h"

View File

@ -159,38 +159,33 @@ typedef struct xfs_inode_log_item {
} xfs_inode_log_item_t; } xfs_inode_log_item_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
int xfs_ilog_fdata(int w);
#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w) #define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
#else static inline int xfs_ilog_fdata(int w)
#define XFS_ILOG_FDATA(w) \ {
((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA) return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
#endif }
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
int xfs_ilog_fbroot(int w);
#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w) #define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
#else static inline int xfs_ilog_fbroot(int w)
#define XFS_ILOG_FBROOT(w) \ {
((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT) return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT)
int xfs_ilog_fext(int w);
#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w) #define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
#else static inline int xfs_ilog_fext(int w)
#define XFS_ILOG_FEXT(w) \ {
((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT) return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
#endif }
#ifdef __KERNEL__ #ifdef __KERNEL__
void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
void xfs_inode_item_destroy(struct xfs_inode *); extern void xfs_inode_item_destroy(struct xfs_inode *);
void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *); extern void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *);
void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *); extern void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *);
void xfs_iflush_abort(struct xfs_inode *); extern void xfs_iflush_abort(struct xfs_inode *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */

View File

@ -58,109 +58,31 @@ typedef __uint32_t xfs_intino_t;
struct xfs_mount; struct xfs_mount;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK) #define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)
__uint32_t xfs_ino_mask(int k); #define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog
#define XFS_INO_MASK(k) xfs_ino_mask(k) #define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog
#else #define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log
#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1)) #define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log
#endif #define XFS_INO_BITS(mp) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS) XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
int xfs_ino_offset_bits(struct xfs_mount *mp); #define XFS_INO_TO_AGNO(mp,i) \
#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp)
#else
#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS)
int xfs_ino_agbno_bits(struct xfs_mount *mp);
#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp)
#else
#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS)
int xfs_ino_agino_bits(struct xfs_mount *mp);
#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp)
#else
#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS)
int xfs_ino_agno_bits(struct xfs_mount *mp);
#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp)
#else
#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS)
int xfs_ino_bits(struct xfs_mount *mp);
#define XFS_INO_BITS(mp) xfs_ino_bits(mp)
#else
#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO)
xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i)
#else
#define XFS_INO_TO_AGNO(mp,i) \
((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
#endif #define XFS_INO_TO_AGINO(mp,i) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO)
xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i)
#else
#define XFS_INO_TO_AGINO(mp,i) \
((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
#endif #define XFS_INO_TO_AGBNO(mp,i) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO)
xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i)
#else
#define XFS_INO_TO_AGBNO(mp,i) \
(((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp))) XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
#endif #define XFS_INO_TO_OFFSET(mp,i) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET)
int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i)
#else
#define XFS_INO_TO_OFFSET(mp,i) \
((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif #define XFS_INO_TO_FSB(mp,i) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB)
xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i)
#else
#define XFS_INO_TO_FSB(mp,i) \
XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO)
xfs_ino_t
xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i);
#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i)
#else
#define XFS_AGINO_TO_INO(mp,a,i) \ #define XFS_AGINO_TO_INO(mp,a,i) \
(((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO)
xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i);
#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i)
#else
#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) #define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET)
int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i);
#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i)
#else
#define XFS_AGINO_TO_OFFSET(mp,i) \ #define XFS_AGINO_TO_OFFSET(mp,i) \
((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO)
xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o)
#else
#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ #define XFS_OFFBNO_TO_AGINO(mp,b,o) \
((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
#endif
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -42,22 +42,21 @@
#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_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_itable.h" #include "xfs_itable.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_error.h" #include "xfs_error.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"

View File

@ -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_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"
@ -44,16 +43,16 @@
#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_btree.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h" #include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"

View File

@ -29,31 +29,31 @@
* *
* 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.h" #include "xfs_inode.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_btree.h"
#ifndef HAVE_USERACC #ifndef HAVE_USERACC
#define useracc(ubuffer, size, flags, foo) (0) #define useracc(ubuffer, size, flags, foo) (0)

View File

@ -29,30 +29,33 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* High level interface routines for log manager
*/
#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_ag.h"
#include "xfs_sb.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_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_error.h" #include "xfs_error.h"
#include "xfs_log_priv.h" #include "xfs_log_priv.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h"
#include "xfs_log_recover.h" #include "xfs_log_recover.h"
#include "xfs_bit.h"
#include "xfs_rw.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.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_rw.h"
#define xlog_write_adv_cnt(ptr, len, off, bytes) \ #define xlog_write_adv_cnt(ptr, len, off, bytes) \

View File

@ -35,6 +35,7 @@
struct xfs_buf; struct xfs_buf;
struct ktrace; struct ktrace;
struct log; struct log;
struct xlog_ticket;
struct xfs_buf_cancel; struct xfs_buf_cancel;
struct xfs_mount; struct xfs_mount;
@ -120,77 +121,6 @@ struct xfs_mount;
((i) >> 24) ((i) >> 24)
#endif #endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_SUB_SPACE)
void xlog_grant_sub_space(struct log *log, int bytes, int type);
#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
xlog_grant_sub_space(log,bytes,type)
#else
#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
{ \
if (type == 'w') { \
(log)->l_grant_write_bytes -= (bytes); \
if ((log)->l_grant_write_bytes < 0) { \
(log)->l_grant_write_bytes += (log)->l_logsize; \
(log)->l_grant_write_cycle--; \
} \
} else { \
(log)->l_grant_reserve_bytes -= (bytes); \
if ((log)->l_grant_reserve_bytes < 0) { \
(log)->l_grant_reserve_bytes += (log)->l_logsize;\
(log)->l_grant_reserve_cycle--; \
} \
} \
}
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_ADD_SPACE)
void xlog_grant_add_space(struct log *log, int bytes, int type);
#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
xlog_grant_add_space(log,bytes,type)
#else
#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
{ \
if (type == 'w') { \
(log)->l_grant_write_bytes += (bytes); \
if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
(log)->l_grant_write_bytes -= (log)->l_logsize; \
(log)->l_grant_write_cycle++; \
} \
} else { \
(log)->l_grant_reserve_bytes += (bytes); \
if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
(log)->l_grant_reserve_bytes -= (log)->l_logsize;\
(log)->l_grant_reserve_cycle++; \
} \
} \
}
#endif
#define XLOG_INS_TICKETQ(q,tic) \
{ \
if (q) { \
(tic)->t_next = (q); \
(tic)->t_prev = (q)->t_prev; \
(q)->t_prev->t_next = (tic); \
(q)->t_prev = (tic); \
} else { \
(tic)->t_prev = (tic)->t_next = (tic); \
(q) = (tic); \
} \
(tic)->t_flags |= XLOG_TIC_IN_Q; \
}
#define XLOG_DEL_TICKETQ(q,tic) \
{ \
if ((tic) == (tic)->t_next) { \
(q) = NULL; \
} else { \
(q) = (tic)->t_next; \
(tic)->t_next->t_prev = (tic)->t_prev; \
(tic)->t_prev->t_next = (tic)->t_next; \
} \
(tic)->t_next = (tic)->t_prev = NULL; \
(tic)->t_flags &= ~XLOG_TIC_IN_Q; \
}
#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock) #define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock)
#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s) #define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s)
#define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock) #define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock)
@ -576,6 +506,75 @@ typedef struct log {
* alignment mask */ * alignment mask */
} xlog_t; } xlog_t;
#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
xlog_grant_sub_space(log,bytes,type)
static inline void xlog_grant_sub_space(struct log *log, int bytes, int type)
{
if (type == 'w') { \
(log)->l_grant_write_bytes -= (bytes); \
if ((log)->l_grant_write_bytes < 0) { \
(log)->l_grant_write_bytes += (log)->l_logsize; \
(log)->l_grant_write_cycle--; \
} \
} else { \
(log)->l_grant_reserve_bytes -= (bytes); \
if ((log)->l_grant_reserve_bytes < 0) { \
(log)->l_grant_reserve_bytes += (log)->l_logsize;\
(log)->l_grant_reserve_cycle--; \
} \
} \
}
#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
xlog_grant_add_space(log,bytes,type)
static inline void
xlog_grant_add_space(struct log *log, int bytes, int type)
{
if (type == 'w') { \
(log)->l_grant_write_bytes += (bytes); \
if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
(log)->l_grant_write_bytes -= (log)->l_logsize; \
(log)->l_grant_write_cycle++; \
} \
} else { \
(log)->l_grant_reserve_bytes += (bytes); \
if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
(log)->l_grant_reserve_bytes -= (log)->l_logsize;\
(log)->l_grant_reserve_cycle++; \
} \
} \
}
#define XLOG_INS_TICKETQ(q, tic) xlog_ins_ticketq(q, tic)
static inline void
xlog_ins_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
{ \
if (q) { \
(tic)->t_next = (q); \
(tic)->t_prev = (q)->t_prev; \
(q)->t_prev->t_next = (tic); \
(q)->t_prev = (tic); \
} else { \
(tic)->t_prev = (tic)->t_next = (tic); \
(q) = (tic); \
} \
(tic)->t_flags |= XLOG_TIC_IN_Q; \
}
#define XLOG_DEL_TICKETQ(q, tic) xlog_del_ticketq(q, tic)
static inline void
xlog_del_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
{ \
if ((tic) == (tic)->t_next) { \
(q) = NULL; \
} else { \
(q) = (tic)->t_next; \
(tic)->t_next->t_prev = (tic)->t_prev; \
(tic)->t_prev->t_next = (tic)->t_next; \
} \
(tic)->t_next = (tic)->t_prev = NULL; \
(tic)->t_flags &= ~XLOG_TIC_IN_Q; \
}
/* common routines */ /* common routines */
extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);

View File

@ -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_inum.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_ag.h" #include "xfs_inum.h"
#include "xfs_sb.h"
#include "xfs_trans.h" #include "xfs_trans.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_error.h" #include "xfs_error.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc_btree.h"
#include "xfs_attr_sf.h" #include "xfs_ialloc_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_imap.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_ialloc_btree.h" #include "xfs_inode_item.h"
#include "xfs_imap.h"
#include "xfs_alloc.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_log_priv.h" #include "xfs_log_priv.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_alloc_btree.h"
#include "xfs_log_recover.h" #include "xfs_log_recover.h"
#include "xfs_extfree_item.h" #include "xfs_extfree_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_bit.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_rw.h" #include "xfs_rw.h"

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -42,21 +42,20 @@
#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_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_fsops.h" #include "xfs_fsops.h"

View File

@ -80,6 +80,9 @@ struct xfs_iocore;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct xfs_bmap_free; struct xfs_bmap_free;
extern struct vfsops xfs_vfsops;
extern struct vnodeops xfs_vnodeops;
#define AIL_LOCK_T lock_t #define AIL_LOCK_T lock_t
#define AIL_LOCKINIT(x,y) spinlock_init(x,y) #define AIL_LOCKINIT(x,y) spinlock_init(x,y)
#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) #define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
@ -503,57 +506,41 @@ xfs_preferred_iosize(xfs_mount_t *mp)
/* /*
* Macros for getting from mount to vfs and back. * Macros for getting from mount to vfs and back.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS)
struct vfs *xfs_mtovfs(xfs_mount_t *mp);
#define XFS_MTOVFS(mp) xfs_mtovfs(mp) #define XFS_MTOVFS(mp) xfs_mtovfs(mp)
#else static inline struct vfs *xfs_mtovfs(xfs_mount_t *mp)
#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv)) {
#endif return bhvtovfs(&mp->m_bhv);
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM) }
xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp);
#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp) #define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
#else static inline xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp)
#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp)) {
#endif return (xfs_mount_t *)BHV_PDATA(bdp);
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_VFSTOM) }
xfs_mount_t *xfs_vfstom(vfs_t *vfs);
#define XFS_VFSTOM(vfs) xfs_vfstom(vfs) #define XFS_VFSTOM(vfs) xfs_vfstom(vfs)
#else static inline xfs_mount_t *xfs_vfstom(vfs_t *vfs)
#define XFS_VFSTOM(vfs) \ {
(XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops))) return XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops));
#endif }
/*
* Moved here from xfs_ag.h to avoid reordering header files
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO)
xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d);
#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) #define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
#else static inline xfs_agnumber_t
xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d)
{ {
d = XFS_BB_TO_FSBT(mp, d); xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
do_div(d, mp->m_sb.sb_agblocks); do_div(ld, mp->m_sb.sb_agblocks);
return (xfs_agnumber_t) d; return (xfs_agnumber_t) ld;
} }
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO)
xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d);
#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d) #define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
#else static inline xfs_agblock_t
xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d)
{ {
d = XFS_BB_TO_FSBT(mp, d); xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks); return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
} }
#endif
/* /*
* This structure is for use by the xfs_mod_incore_sb_batch() routine. * This structure is for use by the xfs_mod_incore_sb_batch() routine.
*/ */
@ -589,9 +576,6 @@ extern int xfs_sync_inodes(xfs_mount_t *, int, int, int *);
extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t); extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t);
extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t); extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t);
extern struct vfsops xfs_vfsops;
extern struct vnodeops xfs_vnodeops;
extern struct xfs_dmops xfs_dmcore_stub; extern struct xfs_dmops xfs_dmcore_stub;
extern struct xfs_qmops xfs_qmcore_stub; extern struct xfs_qmops xfs_qmcore_stub;
extern struct xfs_ioops xfs_iocore_xfs; extern struct xfs_ioops xfs_iocore_xfs;

View File

@ -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"

View File

@ -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_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"
#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_inode_item.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"
#include "xfs_refcache.h" #include "xfs_refcache.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_da_btree.h"
#include "xfs_dir_leaf.h" #include "xfs_dir_leaf.h"

View File

@ -29,16 +29,12 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
/*
* Free realtime 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"
@ -46,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_alloc.h" #include "xfs_alloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_fsops.h" #include "xfs_fsops.h"
#include "xfs_error.h" #include "xfs_error.h"

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -42,20 +42,20 @@
#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_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_itable.h" #include "xfs_itable.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_mac.h" #include "xfs_mac.h"

View File

@ -68,87 +68,44 @@ struct xfs_mount;
* file is a real time file or not, because the bmap code * file is a real time file or not, because the bmap code
* does. * does.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DB)
xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb) #define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb)
#else static inline xfs_daddr_t
#define XFS_FSB_TO_DB(ip,fsb) \ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
(((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \ {
return (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \
(xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \ (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
XFS_FSB_TO_DADDR((ip)->i_mount, (fsb))) XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
#endif }
#define XFS_FSB_TO_DB_IO(io,fsb) xfs_fsb_to_db_io(io,fsb)
#define XFS_FSB_TO_DB_IO(io,fsb) \ static inline xfs_daddr_t
(((io)->io_flags & XFS_IOCORE_RT) ? \ xfs_fsb_to_db_io(struct xfs_iocore *io, xfs_fsblock_t fsb)
{
return (((io)->io_flags & XFS_IOCORE_RT) ? \
XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \ XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
XFS_FSB_TO_DADDR((io)->io_mount, (fsb))) XFS_FSB_TO_DADDR((io)->io_mount, (fsb)));
}
/* /*
* Prototypes for functions in xfs_rw.c. * Prototypes for functions in xfs_rw.c.
*/ */
extern int xfs_write_clear_setuid(struct xfs_inode *ip);
int extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp);
xfs_write_clear_setuid( extern int xfs_bioerror(struct xfs_buf *bp);
struct xfs_inode *ip); extern int xfs_bioerror_relse(struct xfs_buf *bp);
extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp,
int xfs_daddr_t blkno, int len, uint flags,
xfs_bwrite( struct xfs_buf **bpp);
struct xfs_mount *mp, extern void xfs_ioerror_alert(char *func, struct xfs_mount *mp,
struct xfs_buf *bp); xfs_buf_t *bp, xfs_daddr_t blkno);
int
xfs_bioerror(
struct xfs_buf *b);
int
xfs_bioerror_relse(
struct xfs_buf *b);
int
xfs_read_buf(
struct xfs_mount *mp,
xfs_buftarg_t *target,
xfs_daddr_t blkno,
int len,
uint flags,
struct xfs_buf **bpp);
void
xfs_ioerror_alert(
char *func,
struct xfs_mount *mp,
xfs_buf_t *bp,
xfs_daddr_t blkno);
/* /*
* Prototypes for functions in xfs_vnodeops.c. * Prototypes for functions in xfs_vnodeops.c.
*/ */
extern int xfs_rwlock(bhv_desc_t *bdp, vrwlock_t write_lock);
int extern void xfs_rwunlock(bhv_desc_t *bdp, vrwlock_t write_lock);
xfs_rwlock( extern int xfs_change_file_space(bhv_desc_t *bdp, int cmd, xfs_flock64_t *bf,
bhv_desc_t *bdp, xfs_off_t offset, cred_t *credp, int flags);
vrwlock_t write_lock); extern int xfs_set_dmattrs(bhv_desc_t *bdp, u_int evmask, u_int16_t state,
cred_t *credp);
void
xfs_rwunlock(
bhv_desc_t *bdp,
vrwlock_t write_lock);
int
xfs_change_file_space(
bhv_desc_t *bdp,
int cmd,
xfs_flock64_t *bf,
xfs_off_t offset,
cred_t *credp,
int flags);
int
xfs_set_dmattrs(
bhv_desc_t *bdp,
u_int evmask,
u_int16_t state,
cred_t *credp);
#endif /* __XFS_RW_H__ */ #endif /* __XFS_RW_H__ */

View File

@ -241,42 +241,33 @@ typedef enum {
*/ */
#define XFS_SB_MAX_SHARED_VN 0 #define XFS_SB_MAX_SHARED_VN 0
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM)
int xfs_sb_version_num(xfs_sb_t *sbp);
#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
#else
#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) #define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION)
int xfs_sb_good_version(xfs_sb_t *sbp);
#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) #define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
#else
#define XFS_SB_GOOD_VERSION_INT(sbp) \
((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!(((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
(((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
((sbp)->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
#ifdef __KERNEL__ #ifdef __KERNEL__
#define XFS_SB_GOOD_VERSION(sbp) \ static inline int xfs_sb_good_version(xfs_sb_t *sbp)
(XFS_SB_GOOD_VERSION_INT(sbp) && \ {
(sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) )) return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
(sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
(sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)));
}
#else #else
/* static inline int xfs_sb_good_version(xfs_sb_t *sbp)
* extra 2 paren's here (( to unconfuse paren-matching editors {
* like vi because XFS_SB_GOOD_VERSION_INT is a partial expression return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
* and the two XFS_SB_GOOD_VERSION's each 2 more close paren's to (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
* complete the expression. ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
*/ !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
#define XFS_SB_GOOD_VERSION(sbp) \ ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
(XFS_SB_GOOD_VERSION_INT(sbp) && \ (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
(!((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \ (!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
(sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)) )) (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
}
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif
#define XFS_SB_GOOD_SASH_VERSION(sbp) \ #define XFS_SB_GOOD_SASH_VERSION(sbp) \
((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
@ -284,224 +275,178 @@ int xfs_sb_good_version(xfs_sb_t *sbp);
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS))) !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS)))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW)
unsigned xfs_sb_version_tonew(unsigned v);
#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) #define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
#else static inline unsigned xfs_sb_version_tonew(unsigned v)
#define XFS_SB_VERSION_TONEW(v) \ {
((((v) == XFS_SB_VERSION_1) ? \ return ((((v) == XFS_SB_VERSION_1) ? \
0 : \ 0 : \
(((v) == XFS_SB_VERSION_2) ? \ (((v) == XFS_SB_VERSION_2) ? \
XFS_SB_VERSION_ATTRBIT : \ XFS_SB_VERSION_ATTRBIT : \
(XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \ (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \
XFS_SB_VERSION_4) XFS_SB_VERSION_4);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD)
unsigned xfs_sb_version_toold(unsigned v);
#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) #define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
#else static inline unsigned xfs_sb_version_toold(unsigned v)
#define XFS_SB_VERSION_TOOLD(v) \ {
(((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
0 : \ 0 : \
(((v) & XFS_SB_VERSION_NLINKBIT) ? \ (((v) & XFS_SB_VERSION_NLINKBIT) ? \
XFS_SB_VERSION_3 : \ XFS_SB_VERSION_3 : \
(((v) & XFS_SB_VERSION_ATTRBIT) ? \ (((v) & XFS_SB_VERSION_ATTRBIT) ? \
XFS_SB_VERSION_2 : \ XFS_SB_VERSION_2 : \
XFS_SB_VERSION_1))) XFS_SB_VERSION_1)));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR)
int xfs_sb_version_hasattr(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) #define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
#else static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASATTR(sbp) \ {
(((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT))) ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR)
void xfs_sb_version_addattr(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) #define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
#else static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDATTR(sbp) \ {
((sbp)->sb_versionnum = \ (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
(((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
XFS_SB_VERSION_2 : \ XFS_SB_VERSION_2 : \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \
((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \ ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \
(XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)))) (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK)
int xfs_sb_version_hasnlink(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) #define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
#else static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASNLINK(sbp) \ {
(((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT))) ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK)
void xfs_sb_version_addnlink(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) #define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
#else static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDNLINK(sbp) \ {
((sbp)->sb_versionnum = \ (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
XFS_SB_VERSION_3 : \ XFS_SB_VERSION_3 : \
((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT))) ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA)
int xfs_sb_version_hasquota(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) #define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
#else static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASQUOTA(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA)
void xfs_sb_version_addquota(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) #define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
#else static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDQUOTA(sbp) \ {
((sbp)->sb_versionnum = \ (sbp)->sb_versionnum = \
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
(XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \ (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \
XFS_SB_VERSION_QUOTABIT))) XFS_SB_VERSION_QUOTABIT));
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN)
int xfs_sb_version_hasalign(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) #define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
#else static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASALIGN(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN)
void xfs_sb_version_subalign(xfs_sb_t *sbp);
#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) #define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
#else static inline void xfs_sb_version_subalign(xfs_sb_t *sbp)
#define XFS_SB_VERSION_SUBALIGN(sbp) \ {
((sbp)->sb_versionnum = \ (sbp)->sb_versionnum = \
XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT)) XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDALIGN)
int xfs_sb_version_hasdalign(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp) #define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp)
#else static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASDALIGN(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDDALIGN)
int xfs_sb_version_adddalign(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp) #define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
#else static inline int xfs_sb_version_adddalign(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDDALIGN(sbp) \ {
((sbp)->sb_versionnum = \ return (sbp)->sb_versionnum = \
((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT)) ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSHARED)
int xfs_sb_version_hasshared(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp) #define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
#else static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASSHARED(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDSHARED)
int xfs_sb_version_addshared(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp) #define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
#else static inline int xfs_sb_version_addshared(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDSHARED(sbp) \ {
((sbp)->sb_versionnum = \ return (sbp)->sb_versionnum = \
((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT)) ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBSHARED)
int xfs_sb_version_subshared(xfs_sb_t *sbp);
#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp) #define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
#else static inline int xfs_sb_version_subshared(xfs_sb_t *sbp)
#define XFS_SB_VERSION_SUBSHARED(sbp) \ {
((sbp)->sb_versionnum = \ return (sbp)->sb_versionnum = \
((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT)) ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDIRV2)
int xfs_sb_version_hasdirv2(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp) #define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
#else static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASDIRV2(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASLOGV2)
int xfs_sb_version_haslogv2(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp) #define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp)
#else static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASLOGV2(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASEXTFLGBIT)
int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp) #define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
#else static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDEXTFLGBIT)
int xfs_sb_version_addextflgbit(xfs_sb_t *sbp);
#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp) #define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
#else static inline int xfs_sb_version_addextflgbit(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) \ {
((sbp)->sb_versionnum = \ return (sbp)->sb_versionnum = \
((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT)) ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBEXTFLGBIT)
int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp) #define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
#else static inline int xfs_sb_version_subextflgbit(xfs_sb_t *sbp)
#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) \ {
((sbp)->sb_versionnum = \ return (sbp)->sb_versionnum = \
((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT)) ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSECTOR)
int xfs_sb_version_hassector(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp) #define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
#else static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASSECTOR(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASMOREBITSBIT)
int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp) #define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp)
#else static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
#define XFS_SB_VERSION_HASMOREBITS(sbp) \ {
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)) ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
#endif }
/* /*
* sb_features2 bit version macros. * sb_features2 bit version macros.
@ -512,65 +457,36 @@ int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
* ((XFS_SB_VERSION_HASMOREBITS(sbp) && * ((XFS_SB_VERSION_HASMOREBITS(sbp) &&
* ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR2)
int xfs_sb_version_hasattr2(xfs_sb_t *sbp);
#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
#else
#define XFS_SB_VERSION_HASATTR2(sbp) \
((XFS_SB_VERSION_HASMOREBITS(sbp)) && \
((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR2) #define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
void xfs_sb_version_addattr2(xfs_sb_t *sbp); static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_HASMOREBITS(sbp)) && \
((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
}
#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp) #define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp)
#else static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
#define XFS_SB_VERSION_ADDATTR2(sbp) \ {
((sbp)->sb_versionnum = \ ((sbp)->sb_versionnum = \
((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \ ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \
((sbp)->sb_features2 = \ ((sbp)->sb_features2 = \
((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT))) ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
#endif }
/* /*
* end of superblock version macros * end of superblock version macros
*/ */
#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
#else
#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK)
xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d);
#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
#else
#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB)
xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d);
#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
#else
#define XFS_DADDR_TO_FSB(mp,d) \
XFS_AGB_TO_FSB(mp, XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR)
xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
#else
#define XFS_FSB_TO_DADDR(mp,fsbno) \
XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \
XFS_FSB_TO_AGBNO(mp,fsbno))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
#else
#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
#endif
#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
/* /*
* File system sector to basic block conversions. * File system sector to basic block conversions.

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -43,21 +43,21 @@
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_trans_priv.h" #include "xfs_da_btree.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_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_trans_priv.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"

View File

@ -234,68 +234,67 @@ typedef struct xfs_log_item_chunk {
* lic_unused to the right value (0 matches all free). The * lic_unused to the right value (0 matches all free). The
* lic_descs.lid_index values are set up as each desc is allocated. * lic_descs.lid_index values are set up as each desc is allocated.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT)
void xfs_lic_init(xfs_log_item_chunk_t *cp);
#define XFS_LIC_INIT(cp) xfs_lic_init(cp) #define XFS_LIC_INIT(cp) xfs_lic_init(cp)
#else static inline void xfs_lic_init(xfs_log_item_chunk_t *cp)
#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) {
#endif cp->lic_free = XFS_LIC_FREEMASK;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT) }
void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot);
#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) #define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot)
#else static inline void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot)
#define XFS_LIC_INIT_SLOT(cp,slot) \ {
((cp)->lic_descs[slot].lid_index = (unsigned char)(slot)) cp->lic_descs[slot].lid_index = (unsigned char)(slot);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY)
int xfs_lic_vacancy(xfs_log_item_chunk_t *cp);
#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) #define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp)
#else static inline int xfs_lic_vacancy(xfs_log_item_chunk_t *cp)
#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK) {
#endif return cp->lic_free & XFS_LIC_FREEMASK;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE) }
void xfs_lic_all_free(xfs_log_item_chunk_t *cp);
#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) #define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp)
#else static inline void xfs_lic_all_free(xfs_log_item_chunk_t *cp)
#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) {
#endif cp->lic_free = XFS_LIC_FREEMASK;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE) }
int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp);
#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) #define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp)
#else static inline int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp)
#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\ {
XFS_LIC_FREEMASK) return ((cp->lic_free & XFS_LIC_FREEMASK) == XFS_LIC_FREEMASK);
#endif }
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE)
int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot);
#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) #define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot)
#else static inline int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot)
#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot))) {
#endif return (cp->lic_free & (1 << slot));
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM) }
void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot);
#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) #define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot)
#else static inline void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot)
#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot))) {
#endif cp->lic_free &= ~(1 << slot);
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE) }
void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot);
#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) #define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot)
#else static inline void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot)
#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot)) {
#endif cp->lic_free |= 1 << slot;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT) }
xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot);
#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) #define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot)
#else static inline xfs_log_item_desc_t *
#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot])) xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot)
#endif {
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT) return &(cp->lic_descs[slot]);
int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); }
#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) #define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp)
#else static inline int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp)
#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index)) {
#endif return (uint)dp->lid_index;
}
/* /*
* Calculate the address of a chunk given a descriptor pointer: * Calculate the address of a chunk given a descriptor pointer:
* dp - dp->lid_index give the address of the start of the lic_descs array. * dp - dp->lid_index give the address of the start of the lic_descs array.
@ -303,15 +302,14 @@ int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp);
* All of this yields the address of the chunk, which is * All of this yields the address of the chunk, which is
* cast to a chunk pointer. * cast to a chunk pointer.
*/ */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK)
xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp);
#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) #define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp)
#else static inline xfs_log_item_chunk_t *
#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
(((xfs_caddr_t)((dp) - (dp)->lid_index)) -\ {
(xfs_caddr_t)(((xfs_log_item_chunk_t*) \ return (xfs_log_item_chunk_t*) \
0)->lic_descs))) (((xfs_caddr_t)((dp) - (dp)->lid_index)) - \
#endif (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs));
}
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
@ -328,7 +326,7 @@ typedef struct xfs_log_busy_slot {
#define XFS_LBC_NUM_SLOTS 31 #define XFS_LBC_NUM_SLOTS 31
typedef struct xfs_log_busy_chunk { typedef struct xfs_log_busy_chunk {
struct xfs_log_busy_chunk *lbc_next; struct xfs_log_busy_chunk *lbc_next;
uint lbc_free; /* bitmask of free slots */ uint lbc_free; /* free slots bitmask */
ushort lbc_unused; /* first unused */ ushort lbc_unused; /* first unused */
xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS]; xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
} xfs_log_busy_chunk_t; } xfs_log_busy_chunk_t;

View File

@ -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"

View File

@ -29,19 +29,28 @@
* *
* 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_buf_item.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_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_buf_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"

View File

@ -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"

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -42,18 +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_trans_priv.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_ialloc.h"
#include "xfs_trans_priv.h"
#include "xfs_inode_item.h"
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
STATIC void STATIC void

View File

@ -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"
STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *, STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *,

View File

@ -29,25 +29,26 @@
* *
* 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_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_inode_item.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"

View File

@ -1,6 +1,4 @@
/* /*
* XFS filesystem operations.
*
* Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -31,44 +29,44 @@
* *
* 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_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_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_alloc.h" #include "xfs_alloc.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_attr_sf.h" #include "xfs_quota.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h"
#include "xfs_ag.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_refcache.h" #include "xfs_refcache.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_extfree_item.h" #include "xfs_log_priv.h"
#include "xfs_quota.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#include "xfs_extfree_item.h"
#include "xfs_acl.h" #include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_clnt.h" #include "xfs_clnt.h"
#include "xfs_log_priv.h"
STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);

View File

@ -29,12 +29,12 @@
* *
* 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_ag.h"
@ -42,33 +42,32 @@
#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_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_dir_leaf.h"
#include "xfs_itable.h" #include "xfs_itable.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_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode_item.h"
#include "xfs_inode.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_refcache.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h"
#include "xfs_rtalloc.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_rtalloc.h"
#include "xfs_refcache.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_dir_leaf.h"
#include "xfs_mac.h"
#include "xfs_log_priv.h" #include "xfs_log_priv.h"
#include "xfs_mac.h"
/* /*