http://oss.sgi.com:8090/xfs-linux-2.6 nathans@sgi.com|ChangeSet|20050316031653|16568 nathans # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/16 12:26:59+11:00 nathans@sgi.com # [XFS] Provide a mechanism for reporting ihashsize defaults via # /proc/mounts. # # SGI-PV: 931940 # SGI-Modid: xfs-linux-melb:xfs-kern:21841a # Signed-off-by: Nathan Scott # # fs/xfs/xfs_vfsops.c # 2005/03/16 12:26:25+11:00 nathans@sgi.com +9 -6 # [XFS] Provide a mechanism for reporting ihashsize defaults via # /proc/mounts. # # fs/xfs/xfs_mount.h # 2005/03/16 12:26:25+11:00 nathans@sgi.com +2 -1 # [XFS] Provide a mechanism for reporting ihashsize defaults via # /proc/mounts. # # fs/xfs/xfs_clnt.h # 2005/03/16 12:26:25+11:00 nathans@sgi.com +2 -1 # [XFS] Provide a mechanism for reporting ihashsize defaults via # /proc/mounts. # # ChangeSet # 2005/03/16 12:17:21+11:00 nathans@sgi.com # [XFS] Further improvements to the default XFS inode hash table sizing # algorithms, resolving regressions reported with the previous change. # # SGI-PV: 931940 # SGI-Modid: xfs-linux-melb:xfs-kern:21839a # Signed-off-by: Nathan Scott # # fs/xfs/xfs_iget.c # 2005/03/16 12:16:49+11:00 nathans@sgi.com +7 -4 # [XFS] Further improvements to the default XFS inode hash table sizing # algorithms, resolving regressions reported with the previous change. # # ChangeSet # 2005/03/10 12:43:32+11:00 nathans@sgi.com # [XFS] reinstate missed copyright date updates. # # Signed-off-by: Nathan Scott # # fs/xfs/xfs_vnodeops.c # 2005/03/10 12:43:00+11:00 nathans@sgi.com +1 -1 # [XFS] reinstate missed copyright date updates. # # fs/xfs/linux-2.6/xfs_vfs.h # 2005/03/10 12:43:00+11:00 nathans@sgi.com +1 -1 # [XFS] reinstate missed copyright date updates. # # fs/xfs/linux-2.6/xfs_vfs.c # 2005/03/10 12:43:00+11:00 nathans@sgi.com +1 -1 # [XFS] reinstate missed copyright date updates. # # ChangeSet # 2005/03/10 12:37:19+11:00 nathans@sgi.com # [XFS] reinstate a missed xfs_iget check on is_bad_inode. # # Signed-off-by: Nathan Scott # # fs/xfs/xfs_iget.c # 2005/03/10 12:36:48+11:00 nathans@sgi.com +5 -0 # [XFS] reinstate a missed xfs_iget check on is_bad_inode. # # ChangeSet # 2005/03/10 12:19:57+11:00 nathans@sgi.com # [XFS] Steve noticed we were duplicating some work the block layer can do # for us; switch to SYNC_READ/WRITE for some metadata buffers. # # SGI-PV: 931924 # SGI-Modid: xfs-linux-melb:xfs-kern:21771a # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_buf.c # 2005/03/10 12:19:26+11:00 nathans@sgi.com +9 -8 # [XFS] Steve noticed we were duplicating some work the block layer can do # for us; switch to SYNC_READ/WRITE for some metadata buffers. # # ChangeSet # 2005/03/10 12:16:11+11:00 nathans@sgi.com # [XFS] remove non-helpful inode shakers # # SGI-PV: 931920 # SGI-Modid: xfs-linux-melb:xfs-kern:189108a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_super.c # 2005/03/10 12:15:39+11:00 nathans@sgi.com +0 -23 # [XFS] remove non-helpful inode shakers # # fs/xfs/linux-2.6/kmem.h # 2005/03/10 12:15:39+11:00 nathans@sgi.com +0 -6 # [XFS] remove non-helpful inode shakers # # ChangeSet # 2005/03/10 11:25:28+11:00 nathans@sgi.com # Merge sgi.com:/source2/linux-2.6 into sgi.com:/source2/xfs-linux-2.6 # # fs/xfs/xfs_da_btree.c # 2005/03/10 11:25:07+11:00 nathans@sgi.com +0 -0 # Auto merged # # ChangeSet # 2005/03/07 12:55:26+11:00 roehrich@sgi.com # [XFS] fix DMAPI & NOSPACE data corruption # # SGI-PV: 931297 # SGI-Modid: xfs-linux:xfs-kern:188833a # Signed-off-by: Dean Roehrich # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_lrw.c # 2005/03/07 12:54:58+11:00 roehrich@sgi.com +1 -0 # [XFS] fix DMAPI & NOSPACE data corruption # # ChangeSet # 2005/03/07 12:54:09+11:00 gnb@sgi.com # [XFS] Make XFS provide encoding and decoding callbacks from knfsd which # encode the fileid portion of the NFS filehandle differently than the # default functions. The new fileid formats allow filesystems mounted with # "inode64" to be exported over NFSv3 (and NFSv2 if you also use the # "no_subtree_check" export option). # # SGI-PV: 902621 # SGI-Modid: xfs-linux:xfs-kern:21686a # Signed-off-by: Greg Banks # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_export.h # 2005/03/07 12:53:36+11:00 gnb@sgi.com +122 -0 # # fs/xfs/linux-2.6/xfs_export.h # 2005/03/07 12:53:36+11:00 gnb@sgi.com +0 -0 # BitKeeper file /source2/xfs-linux-2.6/fs/xfs/linux-2.6/xfs_export.h # # fs/xfs/linux-2.6/xfs_export.c # 2005/03/07 12:53:36+11:00 gnb@sgi.com +97 -22 # [XFS] Make XFS provide encoding and decoding callbacks from knfsd which # encode the fileid portion of the NFS filehandle differently than the # default functions. The new fileid formats allow filesystems mounted with # "inode64" to be exported over NFSv3 (and NFSv2 if you also use the # "no_subtree_check" export option). For filesystems without "inode64", the # file handles are binary compatible with the old ones, so it should be # possible to upgrade a server without unmounting clients. # # ChangeSet # 2005/03/07 12:52:40+11:00 tes@sgi.com # [XFS] Revokes revision 1.37 of xfs_acl.c. It caused CAPP evaluation to # break as it always requires exec permission for directories when the aim # was really meant for non-dir executables. See pv#930290. # # SGI-PV: 930290 # SGI-Modid: xfs-linux:xfs-kern:21668a # Signed-off-by: Tim Shimmin # Signed-off-by: Nathan Scott # # fs/xfs/xfs_acl.c # 2005/03/07 12:52:09+11:00 tes@sgi.com +4 -41 # [XFS] Revokes revision 1.37 of xfs_acl.c. It caused CAPP evaluation to # break as it always requires exec permission for directories when the aim # was really meant for non-dir executables. See pv#930290. # # ChangeSet # 2005/03/07 12:51:26+11:00 hch@sgi.com # [XFS] Fix and streamline directory inode number handling # # SGI-PV: 930401 # SGI-Modid: xfs-linux:xfs-kern:187996a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/xfs_dir_sf.h # 2005/03/07 12:50:57+11:00 hch@sgi.com +2 -2 # [XFS] Fix and streamline directory inode number handling # # fs/xfs/xfs_dir_leaf.h # 2005/03/07 12:50:57+11:00 hch@sgi.com +0 -3 # [XFS] Fix and streamline directory inode number handling # # fs/xfs/xfs_dir_leaf.c # 2005/03/07 12:50:57+11:00 hch@sgi.com +3 -3 # [XFS] Fix and streamline directory inode number handling # # fs/xfs/xfs_dir2_sf.h # 2005/03/07 12:50:57+11:00 hch@sgi.com +4 -9 # [XFS] Fix and streamline directory inode number handling # # fs/xfs/xfs_dir.c # 2005/03/07 12:50:57+11:00 hch@sgi.com +2 -2 # [XFS] Fix and streamline directory inode number handling # # fs/xfs/xfs_arch.h # 2005/03/07 12:50:57+11:00 hch@sgi.com +46 -78 # [XFS] Fix and streamline directory inode number handling # # ChangeSet # 2005/03/07 12:47:06+11:00 roehrich@sgi.com # [XFS] Update copyright to 2005 # # SGI-PV: 929263 # SGI-Modid: xfs-linux:xfs-kern:187126a # Signed-off-by: Dean Roehrich # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_file.c # 2005/03/07 12:46:35+11:00 roehrich@sgi.com +1 -1 # [XFS] Update copyright to 2005 # # ChangeSet # 2005/03/07 12:44:25+11:00 roehrich@sgi.com # [XFS] dmapi - Execution of an offline script or binary fails. If a user # thread is trying to execute the file that is offline then the HSM won't # get write access when it attempts invisible I/O to bring it online because # the user thread has already denied write access...but that thread is # waiting for us to write the file.... So add a callout from open_exec() to # give DMAPI an early notice that the file must be online. # # SGI-PV: 929263 # SGI-Modid: xfs-linux:xfs-kern:186543a # Signed-off-by: Dean Roehrich # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_file.c # 2005/03/07 12:43:54+11:00 roehrich@sgi.com +35 -0 # [XFS] dmapi - Execution of an offline script or binary fails. If a user # thread is trying to execute the file that is offline then the HSM won't # get write access when it attempts invisible I/O to bring it online because # the user thread has already denied write access...but that thread is # waiting for us to write the file.... So add a callout from open_exec() to # give DMAPI an early notice that the file must be online. # # ChangeSet # 2005/03/07 12:38:16+11:00 hch@sgi.com # [XFS] pagebuf_lock_value is also needed for trace builds # # SGI-PV: 928101 # SGI-Modid: xfs-linux:xfs-kern:185972a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_buf.c # 2005/03/07 12:37:45+11:00 hch@sgi.com +1 -1 # [XFS] pagebuf_lock_value is also needed for trace builds # # ChangeSet # 2005/03/07 12:37:01+11:00 hch@sgi.com # [XFS] Remove INT_ZERO and INT_ISZERO # # SGI-PV: 928382 # SGI-Modid: xfs-linux:xfs-kern:185768a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/xfs_log_recover.c # 2005/03/07 12:36:32+11:00 hch@sgi.com +6 -6 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_log.c # 2005/03/07 12:36:32+11:00 hch@sgi.com +5 -5 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_inode.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +8 -8 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_ialloc.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +2 -2 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_fsops.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +8 -8 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir_leaf.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +20 -20 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir2_node.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +10 -10 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir2_leaf.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +11 -11 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir2_data.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +18 -18 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir2_block.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +4 -4 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dir2.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +1 -1 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_dinode.h # 2005/03/07 12:36:31+11:00 hch@sgi.com +1 -1 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_da_btree.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +11 -11 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_btree.c # 2005/03/07 12:36:31+11:00 hch@sgi.com +6 -6 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_bmap.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +1 -1 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_attr_leaf.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +30 -30 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_attr.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +1 -1 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_arch.h # 2005/03/07 12:36:30+11:00 hch@sgi.com +0 -6 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_alloc_btree.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +1 -1 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/xfs_alloc.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +3 -3 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/quota/xfs_trans_dquot.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +5 -5 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/quota/xfs_quota_priv.h # 2005/03/07 12:36:30+11:00 hch@sgi.com +10 -10 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/quota/xfs_qm_syscalls.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +2 -4 # [XFS] Remove INT_ZERO and INT_ISZERO # # fs/xfs/quota/xfs_dquot.c # 2005/03/07 12:36:30+11:00 hch@sgi.com +25 -27 # [XFS] Remove INT_ZERO and INT_ISZERO # # ChangeSet # 2005/03/07 12:35:06+11:00 hch@sgi.com # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # SGI-PV: 928382 # SGI-Modid: xfs-linux:xfs-kern:185644a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/xfs_vnodeops.c # 2005/03/07 12:34:34+11:00 hch@sgi.com +1 -1 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_mount.h # 2005/03/07 12:34:34+11:00 hch@sgi.com +1 -2 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_mount.c # 2005/03/07 12:34:34+11:00 hch@sgi.com +6 -13 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_macros.c # 2005/03/07 12:34:34+11:00 hch@sgi.com +32 -141 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_log_recover.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +14 -14 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_log_priv.h # 2005/03/07 12:34:33+11:00 hch@sgi.com +9 -9 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_log.h # 2005/03/07 12:34:33+11:00 hch@sgi.com +9 -20 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_log.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +28 -30 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_itable.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +164 -112 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_inode_item.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +2 -2 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_inode.h # 2005/03/07 12:34:33+11:00 hch@sgi.com +3 -2 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_inode.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +41 -40 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_ialloc_btree.h # 2005/03/07 12:34:33+11:00 hch@sgi.com +10 -12 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_ialloc_btree.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +4 -12 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_ialloc.c # 2005/03/07 12:34:33+11:00 hch@sgi.com +16 -17 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_fsops.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +1 -1 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir_sf.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +3 -9 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir_leaf.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +1 -3 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir_leaf.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +15 -15 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_sf.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +27 -34 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_sf.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +47 -49 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_node.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +1 -1 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_leaf.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +4 -4 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_leaf.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +9 -9 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_data.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +5 -6 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_data.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +17 -17 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_block.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +5 -6 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir2_block.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +15 -15 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dir.c # 2005/03/07 12:34:32+11:00 hch@sgi.com +4 -4 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_dinode.h # 2005/03/07 12:34:32+11:00 hch@sgi.com +47 -109 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_bmap_btree.h # 2005/03/07 12:34:31+11:00 hch@sgi.com +2 -2 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_bmap_btree.c # 2005/03/07 12:34:31+11:00 hch@sgi.com +2 -2 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/xfs_arch.h # 2005/03/07 12:34:31+11:00 hch@sgi.com +0 -25 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # fs/xfs/linux-2.6/xfs_ioctl.c # 2005/03/07 12:34:31+11:00 hch@sgi.com +1 -1 # [XFS] Stop passing ARCH_CONVERT/ARCH_NOCONVERT around everywhere # # ChangeSet # 2005/03/07 11:53:40+11:00 hch@sgi.com # [XFS] Don't dereference user pointers in xattr by handle ioctls # # SGI-PV: 930402 # SGI-Modid: xfs-linux:xfs-kern:187995a # Signed-off-by: Christoph Hellwig # Signed-off-by: Nathan Scott # # fs/xfs/linux-2.6/xfs_ioctl.c # 2005/03/07 11:52:57+11:00 hch@sgi.com +164 -70 # [XFS] Don't dereference user pointers in xattr by handle ioctls # diff -Nru a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h --- a/fs/xfs/linux-2.6/kmem.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/kmem.h 2005-03-20 16:43:29 -08:00 @@ -125,12 +125,6 @@ BUG(); } -static __inline int -kmem_zone_shrink(kmem_zone_t *zone) -{ - return kmem_cache_shrink(zone); -} - extern void *kmem_zone_zalloc(kmem_zone_t *, int); extern void *kmem_zone_alloc(kmem_zone_t *, int); diff -Nru a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c --- a/fs/xfs/linux-2.6/xfs_buf.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_buf.c 2005-03-20 16:43:29 -08:00 @@ -966,7 +966,7 @@ return(locked ? 0 : -EBUSY); } -#ifdef DEBUG +#if defined(DEBUG) || defined(XFS_BLI_TRACE) /* * pagebuf_lock_value * @@ -1283,7 +1283,7 @@ _pagebuf_ioapply( xfs_buf_t *pb) { - int i, map_i, total_nr_pages, nr_pages; + int i, rw, map_i, total_nr_pages, nr_pages; struct bio *bio; int offset = pb->pb_offset; int size = pb->pb_count_desired; @@ -1294,6 +1294,13 @@ total_nr_pages = pb->pb_page_count; map_i = 0; + if (pb->pb_flags & _PBF_RUN_QUEUES) { + pb->pb_flags &= ~_PBF_RUN_QUEUES; + rw = (pb->pb_flags & PBF_READ) ? READ_SYNC : WRITE_SYNC; + } else { + rw = (pb->pb_flags & PBF_READ) ? READ : WRITE; + } + /* Special code path for reading a sub page size pagebuf in -- * we populate up the whole page, and hence the other metadata * in the same page. This optimization is only valid when the @@ -1365,18 +1372,12 @@ submit_io: if (likely(bio->bi_size)) { - submit_bio((pb->pb_flags & PBF_READ) ? READ : WRITE, bio); + submit_bio(rw, bio); if (size) goto next_chunk; } else { bio_put(bio); pagebuf_ioerror(pb, EIO); - } - - if (pb->pb_flags & _PBF_RUN_QUEUES) { - pb->pb_flags &= ~_PBF_RUN_QUEUES; - if (atomic_read(&pb->pb_io_remaining) > 1) - blk_run_address_space(pb->pb_target->pbr_mapping); } } diff -Nru a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c --- a/fs/xfs/linux-2.6/xfs_export.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_export.c 2005-03-20 16:43:29 -08:00 @@ -31,6 +31,25 @@ */ #include "xfs.h" +#include "xfs_types.h" +#include "xfs_dmapi.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_mount.h" +#include "xfs_export.h" + +/* + * XFS encode and decodes the fileid portion of NFS filehandles + * itself instead of letting the generic NFS code do it. This + * allows filesystems with 64 bit inode numbers to be exported. + * + * Note that a side effect is that xfs_vget() won't be passed a + * zero inode/generation pair under normal circumstances. As + * however a malicious client could send us such data, the check + * remains in that code. + */ STATIC struct dentry * @@ -44,26 +63,87 @@ struct dentry *de), void *context) { - __u32 parent[2]; - parent[0] = parent[1] = 0; - - if (fh_len < 2 || fileid_type > 2) + xfs_fid2_t ifid; + xfs_fid2_t pfid; + void *parent = NULL; + int is64 = 0; + __u32 *p = fh; + +#if XFS_BIG_INUMS + is64 = (fileid_type & XFS_FILEID_TYPE_64FLAG); + fileid_type &= ~XFS_FILEID_TYPE_64FLAG; +#endif + + /* + * Note that we only accept fileids which are long enough + * rather than allow the parent generation number to default + * to zero. XFS considers zero a valid generation number not + * an invalid/wildcard value. There's little point printk'ing + * a warning here as we don't have the client information + * which would make such a warning useful. + */ + if (fileid_type > 2 || + fh_len < xfs_fileid_length((fileid_type == 2), is64)) return NULL; - - if (fileid_type == 2 && fh_len > 2) { - if (fh_len == 3) { - printk(KERN_WARNING - "XFS: detected filehandle without " - "parent inode generation information."); - return ERR_PTR(-ESTALE); - } - - parent[0] = fh[2]; - parent[1] = fh[3]; + + p = xfs_fileid_decode_fid2(p, &ifid, is64); + + if (fileid_type == 2) { + p = xfs_fileid_decode_fid2(p, &pfid, is64); + parent = &pfid; } + fh = (__u32 *)&ifid; return find_exported_dentry(sb, fh, parent, acceptable, context); +} + +STATIC int +linvfs_encode_fh( + struct dentry *dentry, + __u32 *fh, + int *max_len, + int connectable) +{ + struct inode *inode = dentry->d_inode; + int type = 1; + __u32 *p = fh; + int len; + int is64 = 0; +#if XFS_BIG_INUMS + vfs_t *vfs = LINVFS_GET_VFS(inode->i_sb); + xfs_mount_t *mp = XFS_VFSTOM(vfs); + + if (!(mp->m_flags & XFS_MOUNT_32BITINOOPT)) { + /* filesystem may contain 64bit inode numbers */ + is64 = XFS_FILEID_TYPE_64FLAG; + } +#endif + + /* Directories don't need their parent encoded, they have ".." */ + if (S_ISDIR(inode->i_mode)) + connectable = 0; + + /* + * Only encode if there is enough space given. In practice + * this means we can't export a filesystem with 64bit inodes + * over NFSv2 with the subtree_check export option; the other + * seven combinations work. The real answer is "don't use v2". + */ + len = xfs_fileid_length(connectable, is64); + if (*max_len < len) + return 255; + *max_len = len; + + p = xfs_fileid_encode_inode(p, inode, is64); + if (connectable) { + spin_lock(&dentry->d_lock); + p = xfs_fileid_encode_inode(p, dentry->d_parent->d_inode, is64); + spin_unlock(&dentry->d_lock); + type = 2; + } + BUG_ON((p - fh) != len); + return type | is64; } STATIC struct dentry * @@ -74,16 +154,10 @@ vnode_t *vp; struct inode *inode; struct dentry *result; - xfs_fid2_t xfid; vfs_t *vfsp = LINVFS_GET_VFS(sb); int error; - xfid.fid_len = sizeof(xfs_fid2_t) - sizeof(xfid.fid_len); - xfid.fid_pad = 0; - xfid.fid_gen = ((__u32 *)data)[1]; - xfid.fid_ino = ((__u32 *)data)[0]; - - VFS_VGET(vfsp, &vp, (fid_t *)&xfid, error); + VFS_VGET(vfsp, &vp, (fid_t *)data, error); if (error || vp == NULL) return ERR_PTR(-ESTALE) ; @@ -125,6 +199,7 @@ struct export_operations linvfs_export_ops = { .decode_fh = linvfs_decode_fh, + .encode_fh = linvfs_encode_fh, .get_parent = linvfs_get_parent, .get_dentry = linvfs_get_dentry, }; diff -Nru a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/linux-2.6/xfs_export.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/fs/xfs/linux-2.6/xfs_export.h 2005-03-20 16:43:29 -08:00 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ +#ifndef __XFS_EXPORT_H__ +#define __XFS_EXPORT_H__ + +/* + * Common defines for code related to exporting XFS filesystems over NFS. + * + * The NFS fileid goes out on the wire as an array of + * 32bit unsigned ints in host order. There are 5 possible + * formats. + * + * (1) fileid_type=0x00 + * (no fileid data; handled by the generic code) + * + * (2) fileid_type=0x01 + * inode-num + * generation + * + * (3) fileid_type=0x02 + * inode-num + * generation + * parent-inode-num + * parent-generation + * + * (4) fileid_type=0x81 + * inode-num-lo32 + * inode-num-hi32 + * generation + * + * (5) fileid_type=0x82 + * inode-num-lo32 + * inode-num-hi32 + * generation + * parent-inode-num-lo32 + * parent-inode-num-hi32 + * parent-generation + * + * Note, the NFS filehandle also includes an fsid portion which + * may have an inode number in it. That number is hardcoded to + * 32bits and there is no way for XFS to intercept it. In + * practice this means when exporting an XFS filesytem with 64bit + * inodes you should either export the mountpoint (rather than + * a subdirectory) or use the "fsid" export option. + */ + +/* This flag goes on the wire. Don't play with it. */ +#define XFS_FILEID_TYPE_64FLAG 0x80 /* NFS fileid has 64bit inodes */ + +/* Calculate the length in u32 units of the fileid data */ +static inline int +xfs_fileid_length(int hasparent, int is64) +{ + return hasparent ? (is64 ? 6 : 4) : (is64 ? 3 : 2); +} + +/* + * Decode encoded inode information (either for the inode itself + * or the parent) into an xfs_fid2_t structure. Advances and + * returns the new data pointer + */ +static inline __u32 * +xfs_fileid_decode_fid2(__u32 *p, xfs_fid2_t *fid, int is64) +{ + fid->fid_len = sizeof(xfs_fid2_t) - sizeof(fid->fid_len); + fid->fid_pad = 0; + fid->fid_ino = *p++; +#if XFS_BIG_INUMS + if (is64) + fid->fid_ino |= (((__u64)(*p++)) << 32); +#endif + fid->fid_gen = *p++; + return p; +} + +/* + * Encode inode information (either for the inode itself or the + * parent) into a fileid buffer. Advances and returns the new + * data pointer. + */ +static inline __u32 * +xfs_fileid_encode_inode(__u32 *p, struct inode *inode, int is64) +{ + *p++ = (__u32)inode->i_ino; +#if XFS_BIG_INUMS + if (is64) + *p++ = (__u32)(inode->i_ino >> 32); +#endif + *p++ = inode->i_generation; + return p; +} + +#endif /* __XFS_EXPORT_H__ */ diff -Nru a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c --- a/fs/xfs/linux-2.6/xfs_file.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_file.c 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 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 * under the terms of version 2 of the GNU General Public License as @@ -482,6 +482,38 @@ } #endif /* HAVE_VMOP_MPROTECT */ +#ifdef HAVE_FOP_OPEN_EXEC +/* If the user is attempting to execute a file that is offline then + * we have to trigger a DMAPI READ event before the file is marked as busy + * otherwise the invisible I/O will not be able to write to the file to bring + * it back online. + */ +STATIC int +linvfs_open_exec( + struct inode *inode) +{ + vnode_t *vp = LINVFS_GET_VP(inode); + xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); + int error = 0; + bhv_desc_t *bdp; + xfs_inode_t *ip; + + if (vp->v_vfsp->vfs_flag & VFS_DMI) { + bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops); + if (!bdp) { + error = -EINVAL; + goto open_exec_out; + } + ip = XFS_BHVTOI(bdp); + if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) { + error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, + 0, 0, 0, NULL); + } + } +open_exec_out: + return error; +} +#endif /* HAVE_FOP_OPEN_EXEC */ struct file_operations linvfs_file_operations = { .llseek = generic_file_llseek, @@ -500,6 +532,9 @@ .open = linvfs_open, .release = linvfs_release, .fsync = linvfs_fsync, +#ifdef HAVE_FOP_OPEN_EXEC + .open_exec = linvfs_open_exec, +#endif }; struct file_operations linvfs_invis_file_operations = { diff -Nru a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c --- a/fs/xfs/linux-2.6/xfs_ioctl.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_ioctl.c 2005-03-20 16:43:29 -08:00 @@ -202,10 +202,6 @@ xfs_vget_fsop_handlereq( xfs_mount_t *mp, struct inode *parinode, /* parent inode pointer */ - int cap, /* capability level for op */ - void __user *arg, /* userspace data pointer */ - unsigned long size, /* size of expected struct */ - /* output arguments */ xfs_fsop_handlereq_t *hreq, vnode_t **vp, struct inode **inode) @@ -222,22 +218,12 @@ __u32 igen; int error; - if (!capable(cap)) - return XFS_ERROR(EPERM); - /* * Only allow handle opens under a directory. */ if (!S_ISDIR(parinode->i_mode)) return XFS_ERROR(ENOTDIR); - /* - * Copy the handle down from the user and validate - * that it looks to be in the correct format. - */ - if (copy_from_user(hreq, arg, size)) - return XFS_ERROR(EFAULT); - hanp = hreq->ihandle; hlen = hreq->ihandlen; handlep = &handle; @@ -305,9 +291,12 @@ vnode_t *vp; xfs_fsop_handlereq_t hreq; - error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg, - sizeof(xfs_fsop_handlereq_t), - &hreq, &vp, &inode); + if (!capable(CAP_SYS_ADMIN)) + return -XFS_ERROR(EPERM); + if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) + return -XFS_ERROR(EFAULT); + + error = xfs_vget_fsop_handlereq(mp, parinode, &hreq, &vp, &inode); if (error) return -error; @@ -387,9 +376,12 @@ vnode_t *vp; __u32 olen; - error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg, - sizeof(xfs_fsop_handlereq_t), - &hreq, &vp, &inode); + if (!capable(CAP_SYS_ADMIN)) + return -XFS_ERROR(EPERM); + if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) + return -XFS_ERROR(EFAULT); + + error = xfs_vget_fsop_handlereq(mp, parinode, &hreq, &vp, &inode); if (error) return -error; @@ -432,10 +424,12 @@ bhv_desc_t *bdp; vnode_t *vp; - error = xfs_vget_fsop_handlereq(mp, parinode, CAP_MKNOD, arg, - sizeof(xfs_fsop_setdm_handlereq_t), - (xfs_fsop_handlereq_t *)&dmhreq, - &vp, &inode); + if (!capable(CAP_MKNOD)) + return -XFS_ERROR(EPERM); + if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t))) + return -XFS_ERROR(EFAULT); + + error = xfs_vget_fsop_handlereq(mp, parinode, &dmhreq.hreq, &vp, &inode); if (error) return -error; @@ -470,21 +464,113 @@ xfs_fsop_attrlist_handlereq_t al_hreq; struct inode *inode; vnode_t *vp; + char *kbuf; + + if (!capable(CAP_SYS_ADMIN)) + return -XFS_ERROR(EPERM); + if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t))) + return -XFS_ERROR(EFAULT); + if (al_hreq.buflen > XATTR_LIST_MAX) + return -XFS_ERROR(EINVAL); - error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg, - sizeof(xfs_fsop_attrlist_handlereq_t), - (xfs_fsop_handlereq_t *)&al_hreq, - &vp, &inode); + error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, + &vp, &inode); if (error) - return -error; + goto out; + + kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL); + if (!kbuf) + goto out_vn_rele; cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; - VOP_ATTR_LIST(vp, al_hreq.buffer, al_hreq.buflen, al_hreq.flags, + VOP_ATTR_LIST(vp, kbuf, al_hreq.buflen, al_hreq.flags, cursor, NULL, error); + if (error) + goto out_kfree; + + if (copy_to_user(al_hreq.buffer, kbuf, al_hreq.buflen)) + error = -EFAULT; + + out_kfree: + kfree(kbuf); + out_vn_rele: VN_RELE(vp); + out: + return -error; +} + +STATIC int +xfs_attrmulti_attr_get( + struct vnode *vp, + char *name, + char __user *ubuf, + __uint32_t *len, + __uint32_t flags) +{ + char *kbuf; + int error = EFAULT; + + if (*len > XATTR_SIZE_MAX) + return EINVAL; + kbuf = kmalloc(*len, GFP_KERNEL); + if (!kbuf) + return ENOMEM; + + VOP_ATTR_GET(vp, name, kbuf, len, flags, NULL, error); if (error) - return -error; - return 0; + goto out_kfree; + + if (copy_to_user(ubuf, kbuf, *len)) + error = EFAULT; + + out_kfree: + kfree(kbuf); + return error; +} + +STATIC int +xfs_attrmulti_attr_set( + struct vnode *vp, + char *name, + const char __user *ubuf, + __uint32_t len, + __uint32_t flags) +{ + char *kbuf; + int error = EFAULT; + + if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) + return EPERM; + if (len > XATTR_SIZE_MAX) + return EINVAL; + + kbuf = kmalloc(len, GFP_KERNEL); + if (!kbuf) + return ENOMEM; + + if (copy_from_user(kbuf, ubuf, len)) + goto out_kfree; + + VOP_ATTR_SET(vp, name, kbuf, len, flags, NULL, error); + + out_kfree: + kfree(kbuf); + return error; +} + +STATIC int +xfs_attrmulti_attr_remove( + struct vnode *vp, + char *name, + __uint32_t flags) +{ + int error; + + if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) + return EPERM; + + VOP_ATTR_REMOVE(vp, name, flags, NULL, error); + return error; } STATIC int @@ -500,55 +586,59 @@ struct inode *inode; vnode_t *vp; unsigned int i, size; + char *attr_name; - error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg, - sizeof(xfs_fsop_attrmulti_handlereq_t), - (xfs_fsop_handlereq_t *)&am_hreq, - &vp, &inode); + if (!capable(CAP_SYS_ADMIN)) + return -XFS_ERROR(EPERM); + if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t))) + return -XFS_ERROR(EFAULT); + + error = xfs_vget_fsop_handlereq(mp, parinode, &am_hreq.hreq, &vp, &inode); if (error) - return -error; + goto out; + error = E2BIG; size = am_hreq.opcount * sizeof(attr_multiop_t); - if (!size || size > 16 * PAGE_SIZE) { - VN_RELE(vp); - return -XFS_ERROR(E2BIG); - } + if (!size || size > 16 * PAGE_SIZE) + goto out_vn_rele; - ops = (xfs_attr_multiop_t *)kmalloc(size, GFP_KERNEL); - if (!ops) { - VN_RELE(vp); - return -XFS_ERROR(ENOMEM); - } + error = ENOMEM; + ops = kmalloc(size, GFP_KERNEL); + if (!ops) + goto out_vn_rele; + + error = EFAULT; + if (copy_from_user(ops, am_hreq.ops, size)) + goto out_kfree_ops; + + attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); + if (!attr_name) + goto out_kfree_ops; - if (copy_from_user(ops, am_hreq.ops, size)) { - kfree(ops); - VN_RELE(vp); - return -XFS_ERROR(EFAULT); - } + error = 0; for (i = 0; i < am_hreq.opcount; i++) { - switch(ops[i].am_opcode) { + ops[i].am_error = strncpy_from_user(attr_name, + ops[i].am_attrname, MAXNAMELEN); + if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) + error = -ERANGE; + if (ops[i].am_error < 0) + break; + + switch (ops[i].am_opcode) { case ATTR_OP_GET: - VOP_ATTR_GET(vp,ops[i].am_attrname, ops[i].am_attrvalue, - &ops[i].am_length, ops[i].am_flags, - NULL, ops[i].am_error); + ops[i].am_error = xfs_attrmulti_attr_get(vp, + attr_name, ops[i].am_attrvalue, + &ops[i].am_length, ops[i].am_flags); break; case ATTR_OP_SET: - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { - ops[i].am_error = EPERM; - break; - } - VOP_ATTR_SET(vp,ops[i].am_attrname, ops[i].am_attrvalue, - ops[i].am_length, ops[i].am_flags, - NULL, ops[i].am_error); + ops[i].am_error = xfs_attrmulti_attr_set(vp, + attr_name, ops[i].am_attrvalue, + ops[i].am_length, ops[i].am_flags); break; case ATTR_OP_REMOVE: - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { - ops[i].am_error = EPERM; - break; - } - VOP_ATTR_REMOVE(vp, ops[i].am_attrname, ops[i].am_flags, - NULL, ops[i].am_error); + ops[i].am_error = xfs_attrmulti_attr_remove(vp, + attr_name, ops[i].am_flags); break; default: ops[i].am_error = EINVAL; @@ -556,11 +646,15 @@ } if (copy_to_user(am_hreq.ops, ops, size)) - error = -XFS_ERROR(EFAULT); + error = XFS_ERROR(EFAULT); + kfree(attr_name); + out_kfree_ops: kfree(ops); + out_vn_rele: VN_RELE(vp); - return error; + out: + return -error; } /* prototypes for a few of the stack-hungry cases that have @@ -1149,7 +1243,7 @@ va.va_mask = XFS_AT_XFLAGS; va.va_xflags = xfs_merge_ioc_xflags(flags, - xfs_dic2xflags(&ip->i_d, ARCH_NOCONVERT)); + xfs_ip2xflags(ip)); VOP_SETATTR(vp, &va, attr_flags, NULL, error); if (!error) diff -Nru a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c --- a/fs/xfs/linux-2.6/xfs_lrw.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_lrw.c 2005-03-20 16:43:29 -08:00 @@ -871,6 +871,7 @@ goto out_unlock_isem; xfs_rwlock(bdp, locktype); pos = xip->i_d.di_size; + ret = 0; goto retry; } diff -Nru a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c --- a/fs/xfs/linux-2.6/xfs_super.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_super.c 2005-03-20 16:43:29 -08:00 @@ -76,7 +76,6 @@ STATIC struct quotactl_ops linvfs_qops; STATIC struct super_operations linvfs_sops; STATIC kmem_zone_t *linvfs_inode_zone; -STATIC kmem_shaker_t xfs_inode_shaker; STATIC struct xfs_mount_args * xfs_args_allocate( @@ -286,18 +285,6 @@ kmem_cache_free(linvfs_inode_zone, LINVFS_GET_VP(inode)); } -STATIC int -xfs_inode_shake( - int priority, - unsigned int gfp_mask) -{ - int pages; - - pages = kmem_zone_shrink(linvfs_inode_zone); - pages += kmem_zone_shrink(xfs_inode_zone); - return pages; -} - STATIC void init_once( void *data, @@ -885,12 +872,6 @@ uuid_init(); vfs_initquota(); - xfs_inode_shaker = kmem_shake_register(xfs_inode_shake); - if (!xfs_inode_shaker) { - error = -ENOMEM; - goto undo_shaker; - } - error = register_filesystem(&xfs_fs_type); if (error) goto undo_register; @@ -898,9 +879,6 @@ return 0; undo_register: - kmem_shake_deregister(xfs_inode_shaker); - -undo_shaker: pagebuf_terminate(); undo_pagebuf: @@ -916,7 +894,6 @@ vfs_exitquota(); XFS_DM_EXIT(&xfs_fs_type); unregister_filesystem(&xfs_fs_type); - kmem_shake_deregister(xfs_inode_shaker); xfs_cleanup(); pagebuf_terminate(); destroy_inodecache(); diff -Nru a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c --- a/fs/xfs/linux-2.6/xfs_vfs.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_vfs.c 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff -Nru a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h --- a/fs/xfs/linux-2.6/xfs_vfs.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/linux-2.6/xfs_vfs.h 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff -Nru a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c --- a/fs/xfs/quota/xfs_dquot.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/quota/xfs_dquot.c 2005-03-20 16:43:29 -08:00 @@ -261,21 +261,19 @@ { xfs_quotainfo_t *q = mp->m_quotainfo; - ASSERT(!INT_ISZERO(d->d_id, ARCH_CONVERT)); + ASSERT(d->d_id); - if (q->qi_bsoftlimit && INT_ISZERO(d->d_blk_softlimit, ARCH_CONVERT)) + if (q->qi_bsoftlimit && !d->d_blk_softlimit) INT_SET(d->d_blk_softlimit, ARCH_CONVERT, q->qi_bsoftlimit); - if (q->qi_bhardlimit && INT_ISZERO(d->d_blk_hardlimit, ARCH_CONVERT)) + if (q->qi_bhardlimit && !d->d_blk_hardlimit) INT_SET(d->d_blk_hardlimit, ARCH_CONVERT, q->qi_bhardlimit); - if (q->qi_isoftlimit && INT_ISZERO(d->d_ino_softlimit, ARCH_CONVERT)) + if (q->qi_isoftlimit && !d->d_ino_softlimit) INT_SET(d->d_ino_softlimit, ARCH_CONVERT, q->qi_isoftlimit); - if (q->qi_ihardlimit && INT_ISZERO(d->d_ino_hardlimit, ARCH_CONVERT)) + if (q->qi_ihardlimit && !d->d_ino_hardlimit) INT_SET(d->d_ino_hardlimit, ARCH_CONVERT, q->qi_ihardlimit); - if (q->qi_rtbsoftlimit && - INT_ISZERO(d->d_rtb_softlimit, ARCH_CONVERT)) + if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit) INT_SET(d->d_rtb_softlimit, ARCH_CONVERT, q->qi_rtbsoftlimit); - if (q->qi_rtbhardlimit && - INT_ISZERO(d->d_rtb_hardlimit, ARCH_CONVERT)) + if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit) INT_SET(d->d_rtb_hardlimit, ARCH_CONVERT, q->qi_rtbhardlimit); } @@ -295,7 +293,7 @@ xfs_mount_t *mp, xfs_disk_dquot_t *d) { - ASSERT(!INT_ISZERO(d->d_id, ARCH_CONVERT)); + ASSERT(d->d_id); #ifdef QUOTADEBUG if (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)) @@ -308,7 +306,7 @@ ASSERT(INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) <= INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)); #endif - if (INT_ISZERO(d->d_btimer, ARCH_CONVERT)) { + if (!d->d_btimer) { if ((INT_GET(d->d_blk_softlimit, ARCH_CONVERT) && (INT_GET(d->d_bcount, ARCH_CONVERT) >= INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) || @@ -319,17 +317,17 @@ get_seconds() + XFS_QI_BTIMELIMIT(mp)); } } else { - if ((INT_ISZERO(d->d_blk_softlimit, ARCH_CONVERT) || + if ((!d->d_blk_softlimit || (INT_GET(d->d_bcount, ARCH_CONVERT) < INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) && - (INT_ISZERO(d->d_blk_hardlimit, ARCH_CONVERT) || + (!d->d_blk_hardlimit || (INT_GET(d->d_bcount, ARCH_CONVERT) < INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { - INT_ZERO(d->d_btimer, ARCH_CONVERT); + d->d_btimer = 0; } } - if (INT_ISZERO(d->d_itimer, ARCH_CONVERT)) { + if (!d->d_itimer) { if ((INT_GET(d->d_ino_softlimit, ARCH_CONVERT) && (INT_GET(d->d_icount, ARCH_CONVERT) >= INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) || @@ -340,17 +338,17 @@ get_seconds() + XFS_QI_ITIMELIMIT(mp)); } } else { - if ((INT_ISZERO(d->d_ino_softlimit, ARCH_CONVERT) || + if ((!d->d_ino_softlimit || (INT_GET(d->d_icount, ARCH_CONVERT) < INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) && - (INT_ISZERO(d->d_ino_hardlimit, ARCH_CONVERT) || + (!d->d_ino_hardlimit || (INT_GET(d->d_icount, ARCH_CONVERT) < INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { - INT_ZERO(d->d_itimer, ARCH_CONVERT); + d->d_itimer = 0; } } - if (INT_ISZERO(d->d_rtbtimer, ARCH_CONVERT)) { + if (!d->d_rtbtimer) { if ((INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) && (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) || @@ -361,13 +359,13 @@ get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); } } else { - if ((INT_ISZERO(d->d_rtb_softlimit, ARCH_CONVERT) || + if ((!d->d_rtb_softlimit || (INT_GET(d->d_rtbcount, ARCH_CONVERT) < INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) && - (INT_ISZERO(d->d_rtb_hardlimit, ARCH_CONVERT) || + (!d->d_rtb_hardlimit || (INT_GET(d->d_rtbcount, ARCH_CONVERT) < INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { - INT_ZERO(d->d_rtbtimer, ARCH_CONVERT); + d->d_rtbtimer = 0; } } } @@ -385,7 +383,7 @@ /* * root's limits are not real limits. */ - if (INT_ISZERO(d->d_id, ARCH_CONVERT)) + if (!d->d_id) return (0); warned = 0; @@ -397,10 +395,10 @@ warned++; } } else { - if (INT_ISZERO(d->d_blk_softlimit, ARCH_CONVERT) || + if (!d->d_blk_softlimit || (INT_GET(d->d_bcount, ARCH_CONVERT) < INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) { - INT_ZERO(d->d_bwarns, ARCH_CONVERT); + d->d_bwarns = 0; } } @@ -412,10 +410,10 @@ warned++; } } else { - if ((INT_ISZERO(d->d_ino_softlimit, ARCH_CONVERT)) || + if (!d->d_ino_softlimit || (INT_GET(d->d_icount, ARCH_CONVERT) < INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) { - INT_ZERO(d->d_iwarns, ARCH_CONVERT); + d->d_iwarns = 0; } } #ifdef QUOTADEBUG diff -Nru a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c --- a/fs/xfs/quota/xfs_qm_syscalls.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/quota/xfs_qm_syscalls.c 2005-03-20 16:43:29 -08:00 @@ -1211,8 +1211,7 @@ if (INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) && INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) >= INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)) { - if (INT_ISZERO(dqp->q_core.d_btimer, ARCH_CONVERT) && - !INT_ISZERO(dqp->q_core.d_id, ARCH_CONVERT)) { + if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { cmn_err(CE_DEBUG, "%d [%s] [0x%p] BLK TIMER NOT STARTED", d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); @@ -1222,8 +1221,7 @@ if (INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) && INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)) { - if (INT_ISZERO(dqp->q_core.d_itimer, ARCH_CONVERT) && - !INT_ISZERO(dqp->q_core.d_id, ARCH_CONVERT)) { + if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { cmn_err(CE_DEBUG, "%d [%s] [0x%p] INO TIMER NOT STARTED", d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); diff -Nru a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h --- a/fs/xfs/quota/xfs_quota_priv.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/quota/xfs_quota_priv.h 2005-03-20 16:43:29 -08:00 @@ -104,15 +104,15 @@ #define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \ XFS_IS_UQUOTA_ON(mp):XFS_IS_GQUOTA_ON(mp)) #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ - INT_ISZERO(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_bcount, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_rtbcount, ARCH_CONVERT) && \ - INT_ISZERO(dqp->q_core.d_icount, ARCH_CONVERT)) + !dqp->q_core.d_blk_hardlimit && \ + !dqp->q_core.d_blk_softlimit && \ + !dqp->q_core.d_rtb_hardlimit && \ + !dqp->q_core.d_rtb_softlimit && \ + !dqp->q_core.d_ino_hardlimit && \ + !dqp->q_core.d_ino_softlimit && \ + !dqp->q_core.d_bcount && \ + !dqp->q_core.d_rtbcount && \ + !dqp->q_core.d_icount) #define HL_PREVP dq_hashlist.ql_prevp #define HL_NEXT dq_hashlist.ql_next @@ -174,7 +174,7 @@ (tp)->t_dqinfo->dqa_usrdquots : \ (tp)->t_dqinfo->dqa_grpdquots) #define XFS_IS_SUSER_DQUOT(dqp) \ - (INT_ISZERO((dqp)->q_core.d_id, ARCH_CONVERT)) + (!((dqp)->q_core.d_id)) #define XFS_PURGE_INODE(ip) \ { \ diff -Nru a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c --- a/fs/xfs/quota/xfs_trans_dquot.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/quota/xfs_trans_dquot.c 2005-03-20 16:43:29 -08:00 @@ -455,7 +455,7 @@ * Get any default limits in use. * Start/reset the timer(s) if needed. */ - if (!INT_ISZERO(d->d_id, ARCH_CONVERT)) { + if (d->d_id) { xfs_qm_adjust_dqlimits(tp->t_mountp, d); xfs_qm_adjust_dqtimers(tp->t_mountp, d); } @@ -669,7 +669,7 @@ error = 0; if ((flags & XFS_QMOPT_FORCE_RES) == 0 && - !INT_ISZERO(dqp->q_core.d_id, ARCH_CONVERT) && + dqp->q_core.d_id && XFS_IS_QUOTA_ENFORCED(dqp->q_mount)) { #ifdef QUOTADEBUG cmn_err(CE_DEBUG, "BLK Res: nblks=%ld + resbcount=%Ld" @@ -694,7 +694,7 @@ * return EDQUOT */ if ((btimer != 0 && get_seconds() > btimer) || - (!INT_ISZERO(dqp->q_core.d_bwarns, ARCH_CONVERT) && + (dqp->q_core.d_bwarns && INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT) >= XFS_QI_BWARNLIMIT(dqp->q_mount))) { error = EDQUOT; @@ -719,9 +719,9 @@ * If timer or warnings has expired, * return EDQUOT */ - if ((!INT_ISZERO(dqp->q_core.d_itimer, ARCH_CONVERT) && + if ((dqp->q_core.d_itimer && get_seconds() > INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)) || - (!INT_ISZERO(dqp->q_core.d_iwarns, ARCH_CONVERT) && + (dqp->q_core.d_iwarns && INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT) >= XFS_QI_IWARNLIMIT(dqp->q_mount))) { error = EDQUOT; diff -Nru a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c --- a/fs/xfs/xfs_acl.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_acl.c 2005-03-20 16:43:29 -08:00 @@ -403,38 +403,6 @@ } /* - * Look for any effective exec access, to allow CAP_DAC_OVERRIDE for exec. - * Ignore checking for exec in USER_OBJ when there is no mask, because - * in this "minimal acl" case we don't have any actual acls, and we - * won't even be here. - */ -STATIC int -xfs_acl_find_any_exec( - xfs_acl_t *fap) -{ - int i; - int masked_aces = 0; - int mask = 0; - - for (i = 0; i < fap->acl_cnt; i++) { - if (fap->acl_entry[i].ae_perm & ACL_EXECUTE) { - if (fap->acl_entry[i].ae_tag & (ACL_USER_OBJ|ACL_OTHER)) - return 1; - - if (fap->acl_entry[i].ae_tag == ACL_MASK) - mask = fap->acl_entry[i].ae_perm; - else - masked_aces |= fap->acl_entry[i].ae_perm; - - if ((mask & masked_aces) & ACL_EXECUTE) - return 1; - } - } - - return 0; -} - -/* * The access control process to determine the access permission: * if uid == file owner id, use the file owner bits. * if gid == file owner group id, use the file group bits. @@ -443,24 +411,19 @@ * until all acl entries are exhausted. The final permission produced * by matching acl entry or entries needs to be & with group permission. * if not owner, owning group, or matching entry in ACL, use file - * other bits. Don't allow CAP_DAC_OVERRIDE on exec access unless - * there is some effective exec access somewhere. + * other bits. */ STATIC int xfs_acl_capability_check( mode_t mode, - cred_t *cr, - xfs_acl_t *fap) + cred_t *cr) { if ((mode & ACL_READ) && !capable_cred(cr, CAP_DAC_READ_SEARCH)) return EACCES; if ((mode & ACL_WRITE) && !capable_cred(cr, CAP_DAC_OVERRIDE)) return EACCES; - if ((mode & ACL_EXECUTE) && - (!capable_cred(cr, CAP_DAC_OVERRIDE) || - !xfs_acl_find_any_exec(fap))) { + if ((mode & ACL_EXECUTE) && !capable_cred(cr, CAP_DAC_OVERRIDE)) return EACCES; - } return 0; } @@ -567,7 +530,7 @@ break; } - return xfs_acl_capability_check(md, cr, fap); + return xfs_acl_capability_check(md, cr); } /* diff -Nru a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c --- a/fs/xfs/xfs_alloc.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_alloc.c 2005-03-20 16:43:29 -08:00 @@ -2009,7 +2009,7 @@ /* * Freelist is empty, give up. */ - if (INT_ISZERO(agf->agf_flcount, ARCH_CONVERT)) { + if (!agf->agf_flcount) { *bnop = NULLAGBLOCK; return 0; } @@ -2028,7 +2028,7 @@ INT_MOD(agf->agf_flfirst, ARCH_CONVERT, 1); xfs_trans_brelse(tp, agflbp); if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) == XFS_AGFL_SIZE(mp)) - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)]; INT_MOD(agf->agf_flcount, ARCH_CONVERT, -1); xfs_trans_agflist_delta(tp, -1); @@ -2128,7 +2128,7 @@ agfl = XFS_BUF_TO_AGFL(agflbp); INT_MOD(agf->agf_fllast, ARCH_CONVERT, 1); if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE(mp)) - INT_ZERO(agf->agf_fllast, ARCH_CONVERT); + agf->agf_fllast = 0; pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)]; INT_MOD(agf->agf_flcount, ARCH_CONVERT, 1); xfs_trans_agflist_delta(tp, 1); diff -Nru a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c --- a/fs/xfs/xfs_alloc_btree.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_alloc_btree.c 2005-03-20 16:43:29 -08:00 @@ -209,7 +209,7 @@ * No free extents left. */ else - INT_ZERO(agf->agf_longest, ARCH_CONVERT); + agf->agf_longest = 0; mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)].pagf_longest = INT_GET(agf->agf_longest, ARCH_CONVERT); xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, diff -Nru a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h --- a/fs/xfs/xfs_arch.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_arch.h 2005-03-20 16:43:29 -08:00 @@ -72,69 +72,18 @@ ((sizeof(type) == 2) ? INT_SWAP16(type,var) : \ (var)))) -#define INT_SWAP_UNALIGNED_32(from,to) \ - { \ - ((__u8*)(to))[0] = ((__u8*)(from))[3]; \ - ((__u8*)(to))[1] = ((__u8*)(from))[2]; \ - ((__u8*)(to))[2] = ((__u8*)(from))[1]; \ - ((__u8*)(to))[3] = ((__u8*)(from))[0]; \ - } - -#define INT_SWAP_UNALIGNED_64(from,to) \ - { \ - INT_SWAP_UNALIGNED_32( ((__u8*)(from)) + 4, ((__u8*)(to))); \ - INT_SWAP_UNALIGNED_32( ((__u8*)(from)), ((__u8*)(to)) + 4); \ - } - /* * get and set integers from potentially unaligned locations */ -#define INT_GET_UNALIGNED_16_LE(pointer) \ - ((__u16)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ))) #define INT_GET_UNALIGNED_16_BE(pointer) \ ((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1]))) -#define INT_SET_UNALIGNED_16_LE(pointer,value) \ - { \ - ((__u8*)(pointer))[0] = (((value) ) & 0xff); \ - ((__u8*)(pointer))[1] = (((value) >> 8) & 0xff); \ - } #define INT_SET_UNALIGNED_16_BE(pointer,value) \ { \ ((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \ ((__u8*)(pointer))[1] = (((value) ) & 0xff); \ } -#define INT_GET_UNALIGNED_32_LE(pointer) \ - ((__u32)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ) \ - |(((__u8*)(pointer))[2] << 16) | (((__u8*)(pointer))[3] << 24))) -#define INT_GET_UNALIGNED_32_BE(pointer) \ - ((__u32)((((__u8*)(pointer))[0] << 24) | (((__u8*)(pointer))[1] << 16) \ - |(((__u8*)(pointer))[2] << 8) | (((__u8*)(pointer))[3] ))) - -#define INT_GET_UNALIGNED_64_LE(pointer) \ - (((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer))+4)) << 32 ) \ - |((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer)) )) )) -#define INT_GET_UNALIGNED_64_BE(pointer) \ - (((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer)) )) << 32 ) \ - |((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer))+4)) )) - -/* - * now pick the right ones for our MACHINE ARCHITECTURE - */ - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_LE(pointer) -#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_LE(pointer,value) -#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_LE(pointer) -#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_LE(pointer) -#else -#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_BE(pointer) -#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_BE(pointer,value) -#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_BE(pointer) -#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_BE(pointer) -#endif - /* define generic INT_ macros */ #define INT_GET(reference,arch) \ @@ -213,64 +162,52 @@ } \ } -#define INT_ISZERO(reference,arch) \ - ((reference) == 0) - -#define INT_ZERO(reference,arch) \ - ((reference) = 0) - -#define INT_GET_UNALIGNED_16_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_16(pointer)) \ - : \ - (INT_GET_UNALIGNED_16_BE(pointer)) \ - ) -#define INT_SET_UNALIGNED_16_ARCH(pointer,value,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - INT_SET_UNALIGNED_16(pointer,value); \ - } else { \ - INT_SET_UNALIGNED_16_BE(pointer,value); \ - } - -#define DIRINO4_GET_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_32(pointer)) \ - : \ - (INT_GET_UNALIGNED_32_BE(pointer)) \ - ) +/* + * In directories inode numbers are stored as unaligned arrays of unsigned + * 8bit integers on disk. + * + * For v1 directories or v2 directories that contain inode numbers that + * do not fit into 32bit the array has eight members, but the first member + * is always zero: + * + * |unused|48-55|40-47|32-39|24-31|16-23| 8-15| 0- 7| + * + * For v2 directories that only contain entries with inode numbers that fit + * into 32bits a four-member array is used: + * + * |24-31|16-23| 8-15| 0- 7| + */ -#if XFS_BIG_INUMS -#define DIRINO_GET_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_64(pointer)) \ - : \ - (INT_GET_UNALIGNED_64_BE(pointer)) \ - ) -#else -/* MACHINE ARCHITECTURE dependent */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define DIRINO_GET_ARCH(pointer,arch) \ - DIRINO4_GET_ARCH((((__u8*)pointer)+4),arch) -#else -#define DIRINO_GET_ARCH(pointer,arch) \ - DIRINO4_GET_ARCH(pointer,arch) -#endif -#endif - -#define DIRINO_COPY_ARCH(from,to,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - memcpy(to,from,sizeof(xfs_ino_t)); \ - } else { \ - INT_SWAP_UNALIGNED_64(from,to); \ - } -#define DIRINO4_COPY_ARCH(from,to,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - memcpy(to,(((__u8*)from+4)),sizeof(xfs_dir2_ino4_t)); \ - } else { \ - INT_SWAP_UNALIGNED_32(from,to); \ - } +#define XFS_GET_DIR_INO4(di) \ + (((u32)(di).i[0] << 24) | ((di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3])) +#define XFS_PUT_DIR_INO4(from, di) \ +do { \ + (di).i[0] = (((from) & 0xff000000ULL) >> 24); \ + (di).i[1] = (((from) & 0x00ff0000ULL) >> 16); \ + (di).i[2] = (((from) & 0x0000ff00ULL) >> 8); \ + (di).i[3] = ((from) & 0x000000ffULL); \ +} while (0) + +#define XFS_DI_HI(di) \ + (((u32)(di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3])) +#define XFS_DI_LO(di) \ + (((u32)(di).i[4] << 24) | ((di).i[5] << 16) | ((di).i[6] << 8) | ((di).i[7])) + +#define XFS_GET_DIR_INO8(di) \ + (((xfs_ino_t)XFS_DI_LO(di) & 0xffffffffULL) | \ + ((xfs_ino_t)XFS_DI_HI(di) << 32)) + +#define XFS_PUT_DIR_INO8(from, di) \ +do { \ + (di).i[0] = 0; \ + (di).i[1] = (((from) & 0x00ff000000000000ULL) >> 48); \ + (di).i[2] = (((from) & 0x0000ff0000000000ULL) >> 40); \ + (di).i[3] = (((from) & 0x000000ff00000000ULL) >> 32); \ + (di).i[4] = (((from) & 0x00000000ff000000ULL) >> 24); \ + (di).i[5] = (((from) & 0x0000000000ff0000ULL) >> 16); \ + (di).i[6] = (((from) & 0x000000000000ff00ULL) >> 8); \ + (di).i[7] = ((from) & 0x00000000000000ffULL); \ +} while (0) + #endif /* __XFS_ARCH_H__ */ diff -Nru a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c --- a/fs/xfs/xfs_attr.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_attr.c 2005-03-20 16:43:29 -08:00 @@ -1884,7 +1884,7 @@ return(XFS_ERROR(EFSCORRUPTED)); } error = xfs_attr_leaf_list_int(bp, context); - if (error || (INT_ISZERO(leaf->hdr.info.forw, ARCH_CONVERT))) + if (error || !leaf->hdr.info.forw) break; /* not really an error, buffer full or EOF */ cursor->blkno = INT_GET(leaf->hdr.info.forw, ARCH_CONVERT); xfs_da_brelse(NULL, bp); diff -Nru a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c --- a/fs/xfs/xfs_attr_leaf.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_attr_leaf.c 2005-03-20 16:43:29 -08:00 @@ -129,7 +129,7 @@ } xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; - INT_ZERO(hdr->count, ARCH_CONVERT); + hdr->count = 0; INT_SET(hdr->totsize, ARCH_CONVERT, sizeof(*hdr)); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); return(0); @@ -443,7 +443,7 @@ ASSERT(dp->i_afp != NULL); sf = (xfs_attr_shortform_t *)dp->i_afp->if_u1.if_data; ASSERT(sf != NULL); - if (INT_ISZERO(sf->hdr.count, ARCH_CONVERT)) + if (!sf->hdr.count) return(0); cursor = context->cursor; ASSERT(cursor != NULL); @@ -686,7 +686,7 @@ for (i = 0; i < INT_GET(leaf->hdr.count, ARCH_CONVERT); entry++, i++) { if (entry->flags & XFS_ATTR_INCOMPLETE) continue; /* don't copy partial entries */ - if (INT_ISZERO(entry->nameidx, ARCH_CONVERT)) + if (!entry->nameidx) continue; ASSERT(entry->flags & XFS_ATTR_LOCAL); name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); @@ -795,7 +795,7 @@ hdr = &leaf->hdr; INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_ATTR_LEAF_MAGIC); INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); - if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) { + if (!hdr->firstused) { INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount) - XFS_ATTR_LEAF_NAME_ALIGN); } @@ -898,7 +898,7 @@ sum += INT_GET(map->size, ARCH_CONVERT); continue; } - if (INT_ISZERO(map->size, ARCH_CONVERT)) + if (!map->size) continue; /* no space in this map */ tmp = entsize; if (INT_GET(map->base, ARCH_CONVERT) @@ -1031,8 +1031,8 @@ memcpy((char *)name_rmt->name, args->name, args->namelen); entry->flags |= XFS_ATTR_INCOMPLETE; /* just in case */ - INT_ZERO(name_rmt->valuelen, ARCH_CONVERT); - INT_ZERO(name_rmt->valueblk, ARCH_CONVERT); + name_rmt->valuelen = 0; + name_rmt->valueblk = 0; args->rmtblkno = 1; args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); } @@ -1097,12 +1097,12 @@ hdr_d->info = hdr_s->info; /* struct copy */ INT_SET(hdr_d->firstused, ARCH_CONVERT, XFS_LBSIZE(mp)); /* handle truncation gracefully */ - if (INT_ISZERO(hdr_d->firstused, ARCH_CONVERT)) { + if (!hdr_d->firstused) { INT_SET(hdr_d->firstused, ARCH_CONVERT, XFS_LBSIZE(mp) - XFS_ATTR_LEAF_NAME_ALIGN); } - INT_ZERO(hdr_d->usedbytes, ARCH_CONVERT); - INT_ZERO(hdr_d->count, ARCH_CONVERT); + hdr_d->usedbytes = 0; + hdr_d->count = 0; hdr_d->holes = 0; INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, sizeof(xfs_attr_leaf_hdr_t)); @@ -1456,7 +1456,7 @@ * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ - forward = (!INT_ISZERO(info->forw, ARCH_CONVERT)); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1617,8 +1617,8 @@ INT_MOD(map->size, ARCH_CONVERT, INT_GET(hdr->freemap[after].size, ARCH_CONVERT)); - INT_ZERO(hdr->freemap[after].base, ARCH_CONVERT); - INT_ZERO(hdr->freemap[after].size, ARCH_CONVERT); + hdr->freemap[after].base = 0; + hdr->freemap[after].size = 0; } else if (before >= 0) { map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, entsize); @@ -1686,7 +1686,7 @@ tmp = INT_GET(entry->nameidx, ARCH_CONVERT); } INT_SET(hdr->firstused, ARCH_CONVERT, tmp); - if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) { + if (!hdr->firstused) { INT_SET(hdr->firstused, ARCH_CONVERT, tmp - XFS_ATTR_LEAF_NAME_ALIGN); } @@ -1772,13 +1772,13 @@ tmp_leaf = (xfs_attr_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; tmp_hdr->info = save_hdr->info; /* struct copy */ - INT_ZERO(tmp_hdr->count, ARCH_CONVERT); + tmp_hdr->count = 0; INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); - if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) { + if (!tmp_hdr->firstused) { INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize - XFS_ATTR_LEAF_NAME_ALIGN); } - INT_ZERO(tmp_hdr->usedbytes, ARCH_CONVERT); + tmp_hdr->usedbytes = 0; if (xfs_attr_leaf_order(save_blk->bp, drop_blk->bp)) { xfs_attr_leaf_moveents(drop_leaf, 0, tmp_leaf, 0, (int)INT_GET(drop_hdr->count, ARCH_CONVERT), @@ -1860,8 +1860,8 @@ else break; } - ASSERT((probe >= 0) && \ - ((INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + ASSERT((probe >= 0) && + (!leaf->hdr.count || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT)))); ASSERT((span <= 4) || (INT_GET(entry->hashval, ARCH_CONVERT) == hashval)); @@ -2151,10 +2151,10 @@ INT_SET(hdr_d->freemap[0].size, ARCH_CONVERT, INT_GET(hdr_d->firstused, ARCH_CONVERT) - INT_GET(hdr_d->freemap[0].base, ARCH_CONVERT)); - INT_ZERO(hdr_d->freemap[1].base, ARCH_CONVERT); - INT_ZERO(hdr_d->freemap[2].base, ARCH_CONVERT); - INT_ZERO(hdr_d->freemap[1].size, ARCH_CONVERT); - INT_ZERO(hdr_d->freemap[2].size, ARCH_CONVERT); + hdr_d->freemap[1].base = 0; + hdr_d->freemap[2].base = 0; + hdr_d->freemap[1].size = 0; + hdr_d->freemap[2].size = 0; hdr_s->holes = 1; /* leaf may not be compact */ } @@ -2199,7 +2199,7 @@ == XFS_ATTR_LEAF_MAGIC); if (count) *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return(0); return(INT_GET(leaf->entries[INT_GET(leaf->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT)); @@ -2543,8 +2543,8 @@ XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); if ((entry->flags & XFS_ATTR_LOCAL) == 0) { name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); - INT_ZERO(name_rmt->valueblk, ARCH_CONVERT); - INT_ZERO(name_rmt->valuelen, ARCH_CONVERT); + name_rmt->valueblk = 0; + name_rmt->valuelen = 0; xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt))); } @@ -2661,8 +2661,8 @@ XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); - INT_ZERO(name_rmt->valueblk, ARCH_CONVERT); - INT_ZERO(name_rmt->valuelen, ARCH_CONVERT); + name_rmt->valueblk = 0; + name_rmt->valuelen = 0; xfs_da_log_buf(args->trans, bp2, XFS_DA_LOGRANGE(leaf2, name_rmt, sizeof(*name_rmt))); } @@ -2871,7 +2871,7 @@ if ( INT_GET(entry->nameidx, ARCH_CONVERT) && ((entry->flags & XFS_ATTR_LOCAL) == 0)) { name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); - if (!INT_ISZERO(name_rmt->valueblk, ARCH_CONVERT)) + if (name_rmt->valueblk) count++; } } @@ -2899,7 +2899,7 @@ if ( INT_GET(entry->nameidx, ARCH_CONVERT) && ((entry->flags & XFS_ATTR_LOCAL) == 0)) { name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); - if (!INT_ISZERO(name_rmt->valueblk, ARCH_CONVERT)) { + if (name_rmt->valueblk) { /* both on-disk, don't endian flip twice */ lp->valueblk = name_rmt->valueblk; INT_SET(lp->valuelen, ARCH_CONVERT, diff -Nru a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c --- a/fs/xfs/xfs_bmap.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_bmap.c 2005-03-20 16:43:29 -08:00 @@ -3261,7 +3261,7 @@ */ ablock = XFS_BUF_TO_BMBT_BLOCK(abp); INT_SET(ablock->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC); - INT_ZERO(ablock->bb_level, ARCH_CONVERT); + ablock->bb_level = 0; INT_SET(ablock->bb_leftsib, ARCH_CONVERT, NULLDFSBNO); INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO); arp = XFS_BMAP_REC_IADDR(ablock, 1, cur); diff -Nru a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c --- a/fs/xfs/xfs_bmap_btree.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_bmap_btree.c 2005-03-20 16:43:29 -08:00 @@ -2017,7 +2017,7 @@ ext_flag); } -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN /* Endian flipping versions of the bmbt extraction functions */ void xfs_bmbt_disk_get_all( @@ -2545,7 +2545,7 @@ #endif /* XFS_BIG_BLKNOS */ } -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN /* * Set all the fields in a bmap extent record from the uncompressed form. */ diff -Nru a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h --- a/fs/xfs/xfs_bmap_btree.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_bmap_btree.h 2005-03-20 16:43:29 -08:00 @@ -505,7 +505,7 @@ xfs_bmbt_get_state( xfs_bmbt_rec_t *r); -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN void xfs_bmbt_disk_get_all( xfs_bmbt_rec_t *r, @@ -631,7 +631,7 @@ xfs_bmbt_rec_t *r, xfs_exntst_t v); -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN void xfs_bmbt_disk_set_all( xfs_bmbt_rec_t *r, diff -Nru a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c --- a/fs/xfs/xfs_btree.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_btree.c 2005-03-20 16:43:29 -08:00 @@ -208,10 +208,10 @@ INT_GET(block->bb_level, ARCH_CONVERT) == level && INT_GET(block->bb_numrecs, ARCH_CONVERT) <= xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) && - !INT_ISZERO(block->bb_leftsib, ARCH_CONVERT) && + block->bb_leftsib && (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLDFSBNO || XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_leftsib, ARCH_CONVERT))) && - !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT) && + block->bb_rightsib && (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLDFSBNO || XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_rightsib, ARCH_CONVERT))); if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK, @@ -329,10 +329,10 @@ xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) && (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLAGBLOCK || INT_GET(block->bb_leftsib, ARCH_CONVERT) < agflen) && - !INT_ISZERO(block->bb_leftsib, ARCH_CONVERT) && + block->bb_leftsib && (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK || INT_GET(block->bb_rightsib, ARCH_CONVERT) < agflen) && - !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT); + block->bb_rightsib; if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp, XFS_ERRTAG_BTREE_CHECK_SBLOCK, XFS_RANDOM_BTREE_CHECK_SBLOCK))) { @@ -484,7 +484,7 @@ /* * It's empty, there is no such record. */ - if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT)) + if (!block->bb_h.bb_numrecs) return 0; /* * Set the ptr value to 1, that's the first record/key. @@ -698,7 +698,7 @@ /* * It's empty, there is no such record. */ - if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT)) + if (!block->bb_h.bb_numrecs) return 0; /* * Set the ptr value to numrecs, that's the last record/key. diff -Nru a/fs/xfs/xfs_clnt.h b/fs/xfs/xfs_clnt.h --- a/fs/xfs/xfs_clnt.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_clnt.h 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 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 * under the terms of version 2 of the GNU General Public License as @@ -103,5 +103,6 @@ #define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */ #define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width * allocation */ +#define XFSMNT_IHASHSIZE 0x20000000 /* inode hash table size */ #endif /* __XFS_CLNT_H__ */ diff -Nru a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c --- a/fs/xfs/xfs_da_btree.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_da_btree.c 2005-03-20 16:43:29 -08:00 @@ -137,11 +137,11 @@ return(error); ASSERT(bp != NULL); node = bp->data; - INT_ZERO(node->hdr.info.forw, ARCH_CONVERT); - INT_ZERO(node->hdr.info.back, ARCH_CONVERT); + node->hdr.info.forw = 0; + node->hdr.info.back = 0; INT_SET(node->hdr.info.magic, ARCH_CONVERT, XFS_DA_NODE_MAGIC); - INT_ZERO(node->hdr.info.pad, ARCH_CONVERT); - INT_ZERO(node->hdr.count, ARCH_CONVERT); + node->hdr.info.pad = 0; + node->hdr.count = 0; INT_SET(node->hdr.level, ARCH_CONVERT, level); xfs_da_log_buf(tp, bp, @@ -306,7 +306,7 @@ */ node = oldblk->bp->data; - if (!INT_ISZERO(node->hdr.info.forw, ARCH_CONVERT)) { + if (node->hdr.info.forw) { if (INT_GET(node->hdr.info.forw, ARCH_CONVERT) == addblk->blkno) { bp = addblk->bp; } else { @@ -791,8 +791,8 @@ ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); oldroot = root_blk->bp->data; ASSERT(INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); - ASSERT(INT_ISZERO(oldroot->hdr.info.forw, ARCH_CONVERT)); - ASSERT(INT_ISZERO(oldroot->hdr.info.back, ARCH_CONVERT)); + ASSERT(!oldroot->hdr.info.forw); + ASSERT(!oldroot->hdr.info.back); /* * If the root has more than one child, then don't do anything. @@ -818,8 +818,8 @@ } else { ASSERT(INT_GET(blkinfo->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); } - ASSERT(INT_ISZERO(blkinfo->forw, ARCH_CONVERT)); - ASSERT(INT_ISZERO(blkinfo->back, ARCH_CONVERT)); + ASSERT(!blkinfo->forw); + ASSERT(!blkinfo->back); memcpy(root_blk->bp->data, bp->data, state->blocksize); xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1); error = xfs_da_shrink_inode(args, child, bp); @@ -871,7 +871,7 @@ * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ - forward = (!INT_ISZERO(info->forw, ARCH_CONVERT)); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1416,7 +1416,7 @@ ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); if (count) *count = INT_GET(node->hdr.count, ARCH_CONVERT); - if (INT_ISZERO(node->hdr.count, ARCH_CONVERT)) + if (!node->hdr.count) return(0); return(INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); } diff -Nru a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h --- a/fs/xfs/xfs_dinode.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dinode.h 2005-03-20 16:43:29 -08:00 @@ -204,58 +204,59 @@ * Inode data & attribute fork sizes, per inode. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q) -int xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); +int xfs_cfork_q_disk(xfs_dinode_core_t *dcp); int xfs_cfork_q(xfs_dinode_core_t *dcp); -#define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch) +#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_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch)) +#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF) -int xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); +int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp); int xfs_cfork_boff(xfs_dinode_core_t *dcp); -#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch) +#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_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3)) +#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)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE) -int xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); +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_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch) +#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_ARCH(dcp,mp,arch) \ - (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_CFORK_BOFF_ARCH(dcp, arch) : XFS_LITINO(mp)) +#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ + (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) #define XFS_CFORK_DSIZE(dcp,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_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); +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_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch) +#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_ARCH(dcp,mp,arch) \ - (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_ARCH(dcp, arch) : 0) +#define XFS_CFORK_ASIZE_DISK(dcp,mp) \ + (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) #define XFS_CFORK_ASIZE(dcp,mp) \ (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_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w, xfs_arch_t arch); +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_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch) +#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_ARCH(dcp,mp,w,arch) \ +#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ ((w) == XFS_DATA_FORK ? \ - XFS_CFORK_DSIZE_ARCH(dcp, mp, arch) : XFS_CFORK_ASIZE_ARCH(dcp, mp, arch)) + XFS_CFORK_DSIZE_DISK(dcp, mp) : \ + XFS_CFORK_ASIZE_DISK(dcp, mp)) #define XFS_CFORK_SIZE(dcp,mp,w) \ ((w) == XFS_DATA_FORK ? \ XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) @@ -263,33 +264,24 @@ #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) -int xfs_dfork_dsize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch) #define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) #else -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#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_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch) #define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp) #else -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#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_arch(xfs_dinode_t *dip, struct xfs_mount *mp, int w, xfs_arch_t arch); int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch) #define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w) #else -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch) -#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT) +#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) #endif @@ -297,143 +289,89 @@ * Macros for accessing per-fork disk inode information. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q) -int xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_q(xfs_dinode_t *dip); -#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch) #define XFS_DFORK_Q(dip) xfs_dfork_q(dip) #else -#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT) +#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_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_boff(xfs_dinode_t *dip); -#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch) -#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) +#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) #else -#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT) +#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_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_dptr(xfs_dinode_t *dip); -#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch) #define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip) #else -#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c) -#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR) -char *xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_aptr(xfs_dinode_t *dip); -#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch) #define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip) #else -#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch)) -#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT) +#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_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); char *xfs_dfork_ptr(xfs_dinode_t *dip, int w); -#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch) #define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w) #else -#define XFS_DFORK_PTR_ARCH(dip,w,arch) \ - ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR_ARCH(dip, arch) : XFS_DFORK_APTR_ARCH(dip, arch)) -#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT) +#define XFS_DFORK_PTR(dip,w) \ + ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT) -int xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); int xfs_cfork_format(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch) #define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w) #else -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \ - ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_format, arch) : INT_GET((dcp)->di_aformat, arch)) -#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_FORMAT(dcp,w) \ + ((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_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch) #define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n) #else -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_FMT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - (INT_SET((dcp)->di_format, arch, (n))) : \ - (INT_SET((dcp)->di_aformat, arch, (n)))) -#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) + ((dcp)->di_format = (n)) : \ + ((dcp)->di_aformat = (n))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS) -int xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); +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_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch) +#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_ARCH(dcp,w,arch) \ - ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_nextents, arch) : INT_GET((dcp)->di_anextents, arch)) -#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ + ((w) == XFS_DATA_FORK ? \ + INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ + INT_GET((dcp)->di_anextents, ARCH_CONVERT)) +#define XFS_CFORK_NEXTENTS(dcp,w) \ + ((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_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch) #define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n) #else -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_NEXT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - (INT_SET((dcp)->di_nextents, arch, (n))) : \ - (INT_SET((dcp)->di_anextents, arch, (n)))) -#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) + ((dcp)->di_nextents = (n)) : \ + ((dcp)->di_anextents = (n))) #endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FORMAT) -int xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); -int xfs_dfork_format(xfs_dinode_t *dip, int w); -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch) -#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w) -#else -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FMT_SET) -void xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); -void xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch) -#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n) -#else -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) -#endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS) -int xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); int xfs_dfork_nextents(xfs_dinode_t *dip, int w); -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch) -#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) +#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) #else -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXT_SET) -void xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); -void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n) -#else -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) - +#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) diff -Nru a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c --- a/fs/xfs/xfs_dir.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir.c 2005-03-20 16:43:29 -08:00 @@ -557,7 +557,7 @@ return 1; } sf = (xfs_dir_shortform_t *)(&dp->di_u.di_dirsf); - ino = XFS_GET_DIR_INO_ARCH(mp, sf->hdr.parent, ARCH_CONVERT); + ino = XFS_GET_DIR_INO8(sf->hdr.parent); if (xfs_dir_ino_validate(mp, ino)) return 1; @@ -575,7 +575,7 @@ namelen_sum = 0; sfe = &sf->list[0]; for (i = sf->hdr.count - 1; i >= 0; i--) { - ino = XFS_GET_DIR_INO_ARCH(mp, sfe->inumber, ARCH_CONVERT); + ino = XFS_GET_DIR_INO8(sfe->inumber); xfs_dir_ino_validate(mp, ino); if (sfe->namelen >= XFS_LITINO(mp)) { xfs_fs_cmn_err(CE_WARN, mp, @@ -716,7 +716,7 @@ entry = &leaf->entries[index]; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); /* XXX - replace assert? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&inum, &namest->inumber); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber))); xfs_da_buf_done(bp); @@ -1065,7 +1065,7 @@ entry = &leaf->entries[blk->index]; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); /* XXX - replace assert ? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&inum, &namest->inumber); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber))); xfs_da_buf_done(bp); diff -Nru a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c --- a/fs/xfs/xfs_dir2.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2.c 2005-03-20 16:43:29 -08:00 @@ -165,7 +165,7 @@ if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) return 0; sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; - return INT_ISZERO(sfp->hdr.count, ARCH_CONVERT); + return !sfp->hdr.count; } /* diff -Nru a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c --- a/fs/xfs/xfs_dir2_block.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_block.c 2005-03-20 16:43:29 -08:00 @@ -135,11 +135,11 @@ */ bf = block->hdr.bestfree; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * No stale entries? Need space for entry and new leaf. */ - if (INT_ISZERO(btp->stale, ARCH_CONVERT)) { + if (!btp->stale) { /* * Tag just before the first leaf entry. */ @@ -327,7 +327,7 @@ /* * No stale entries, will use enddup space to hold new leaf. */ - if (INT_ISZERO(btp->stale, ARCH_CONVERT)) { + if (!btp->stale) { /* * Mark the space needed for the new leaf entry, now in use. */ @@ -494,7 +494,7 @@ */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); ptr = (char *)block->u; - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); p.dbp = dbp; p.put = put; p.uio = uio; @@ -585,7 +585,7 @@ mp = tp->t_mountp; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); xfs_da_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)block), (uint)((char *)&blp[last + 1] - (char *)block - 1)); } @@ -639,7 +639,7 @@ block = bp->data; xfs_dir2_data_check(dp, bp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Get the offset from the leaf entry, to point to the data. */ @@ -691,7 +691,7 @@ block = bp->data; xfs_dir2_data_check(dp, bp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Loop doing a binary search for our hash value. * Find our entry, ENOENT if it's not there. @@ -784,7 +784,7 @@ mp = dp->i_mount; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Point to the data entry using the leaf entry. */ @@ -860,7 +860,7 @@ mp = dp->i_mount; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Point to the data entry we need to change. */ @@ -936,7 +936,7 @@ * These will show up in the leaf bests table. */ while (dp->i_d.di_size > mp->m_dirblksize) { - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); if (INT_GET(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1], ARCH_CONVERT) == mp->m_dirblksize - (uint)sizeof(block->hdr)) { if ((error = @@ -991,12 +991,12 @@ */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); INT_SET(btp->count, ARCH_CONVERT, INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT)); - INT_ZERO(btp->stale, ARCH_CONVERT); + btp->stale = 0; xfs_dir2_block_log_tail(tp, dbp); /* * Initialize the block leaf area. We compact out stale entries. */ - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + lep = XFS_DIR2_BLOCK_LEAF_P(btp); for (from = to = 0; from < INT_GET(leaf->hdr.count, ARCH_CONVERT); from++) { if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) continue; @@ -1137,8 +1137,8 @@ */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); INT_SET(btp->count, ARCH_CONVERT, INT_GET(sfp->hdr.count, ARCH_CONVERT) + 2); /* ., .. */ - INT_ZERO(btp->stale, ARCH_CONVERT); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + btp->stale = 0; + blp = XFS_DIR2_BLOCK_LEAF_P(btp); endoffset = (uint)((char *)blp - (char *)block); /* * Remove the freespace, we'll manage it. @@ -1164,7 +1164,7 @@ */ dep = (xfs_dir2_data_entry_t *) ((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET); - INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT)); + INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); dep->namelen = 2; dep->name[0] = dep->name[1] = '.'; tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); @@ -1191,7 +1191,7 @@ if (sfep == NULL) newoffset = endoffset; else - newoffset = XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT); + newoffset = XFS_DIR2_SF_GET_OFFSET(sfep); /* * There should be a hole here, make one. */ @@ -1200,7 +1200,7 @@ ((char *)block + offset); INT_SET(dup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(dup->length, ARCH_CONVERT, newoffset - offset); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, (xfs_dir2_data_off_t) ((char *)dup - (char *)block)); xfs_dir2_data_log_unused(tp, bp, dup); @@ -1213,8 +1213,8 @@ * Copy a real entry. */ dep = (xfs_dir2_data_entry_t *)((char *)block + newoffset); - INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT)); + INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep))); dep->namelen = sfep->namelen; memcpy(dep->name, sfep->name, dep->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); diff -Nru a/fs/xfs/xfs_dir2_block.h b/fs/xfs/xfs_dir2_block.h --- a/fs/xfs/xfs_dir2_block.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_block.h 2005-03-20 16:43:29 -08:00 @@ -87,13 +87,12 @@ * 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) -struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p_arch( - xfs_dir2_block_tail_t *btp, xfs_arch_t arch); -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ - xfs_dir2_block_leaf_p_arch(btp,arch) +struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp); +#define XFS_DIR2_BLOCK_LEAF_P(btp) \ + xfs_dir2_block_leaf_p(btp) #else -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ - (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, arch)) +#define XFS_DIR2_BLOCK_LEAF_P(btp) \ + (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, ARCH_CONVERT)) #endif /* diff -Nru a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c --- a/fs/xfs/xfs_dir2_data.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_data.c 2005-03-20 16:43:29 -08:00 @@ -98,7 +98,7 @@ p = (char *)d->u; if (INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + lep = XFS_DIR2_BLOCK_LEAF_P(btp); endp = (char *)lep; } else endp = (char *)d + mp->m_dirblksize; @@ -106,16 +106,16 @@ /* * Account for zero bestfree entries. */ - if (INT_ISZERO(bf[0].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[0].offset, ARCH_CONVERT)); + if (!bf[0].length) { + ASSERT(!bf[0].offset); freeseen |= 1 << 0; } - if (INT_ISZERO(bf[1].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[1].offset, ARCH_CONVERT)); + if (!bf[1].length) { + ASSERT(!bf[1].offset); freeseen |= 1 << 1; } - if (INT_ISZERO(bf[2].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[2].offset, ARCH_CONVERT)); + if (!bf[2].length) { + ASSERT(!bf[2].offset); freeseen |= 1 << 2; } ASSERT(INT_GET(bf[0].length, ARCH_CONVERT) >= INT_GET(bf[1].length, ARCH_CONVERT)); @@ -132,7 +132,7 @@ */ if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) { ASSERT(lastfree == 0); - ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT) == + ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT) == (char *)dup - (char *)d); dfp = xfs_dir2_data_freefind(d, dup); if (dfp) { @@ -217,8 +217,8 @@ for (dfp = &d->hdr.bestfree[0], seenzero = matched = 0; dfp < &d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT]; dfp++) { - if (INT_ISZERO(dfp->offset, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(dfp->length, ARCH_CONVERT)); + if (!dfp->offset) { + ASSERT(!dfp->length); seenzero = 1; continue; } @@ -247,7 +247,7 @@ for (dfp = &d->hdr.bestfree[0]; dfp < &d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT]; dfp++) { - if (INT_ISZERO(dfp->offset, ARCH_CONVERT)) + if (!dfp->offset) return NULL; if (INT_GET(dfp->offset, ARCH_CONVERT) == off) return dfp; @@ -334,8 +334,8 @@ /* * Clear the 3rd entry, must be zero now. */ - INT_ZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); - INT_ZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT); + d->hdr.bestfree[2].length = 0; + d->hdr.bestfree[2].offset = 0; *loghead = 1; } @@ -372,7 +372,7 @@ endp = aendp; else if (INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - endp = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endp = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } else endp = (char *)d + mp->m_dirblksize; /* @@ -385,7 +385,7 @@ */ if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) { ASSERT((char *)dup - (char *)d == - INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT)); + INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); xfs_dir2_data_freeinsert(d, dup, loghead); p += INT_GET(dup->length, ARCH_CONVERT); } @@ -440,8 +440,8 @@ INT_SET(d->hdr.magic, ARCH_CONVERT, XFS_DIR2_DATA_MAGIC); INT_SET(d->hdr.bestfree[0].offset, ARCH_CONVERT, (xfs_dir2_data_off_t)sizeof(d->hdr)); for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { - INT_ZERO(d->hdr.bestfree[i].length, ARCH_CONVERT); - INT_ZERO(d->hdr.bestfree[i].offset, ARCH_CONVERT); + d->hdr.bestfree[i].length = 0; + d->hdr.bestfree[i].offset = 0; } /* * Set up an unused entry for the block's body. @@ -452,7 +452,7 @@ t=mp->m_dirblksize - (uint)sizeof(d->hdr); INT_SET(d->hdr.bestfree[0].length, ARCH_CONVERT, t); INT_SET(dup->length, ARCH_CONVERT, t); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dup - (char *)d)); /* * Log it and return it. @@ -523,8 +523,8 @@ * Log the end (tag) of the unused entry. */ xfs_da_log_buf(tp, bp, - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT) - (char *)d), - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT) - (char *)d + + (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d), + (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d + sizeof(xfs_dir2_data_off_t) - 1)); } @@ -562,7 +562,7 @@ ASSERT(INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC); btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } /* * If this isn't the start of the block, then back up to @@ -608,12 +608,12 @@ * since the third bestfree is there, there might be more * entries. */ - needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].length; /* * Fix up the new big freespace. */ INT_MOD(prevdup->length, ARCH_CONVERT, len + INT_GET(postdup->length, ARCH_CONVERT)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(prevdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, prevdup); if (!needscan) { @@ -637,8 +637,8 @@ dfp = xfs_dir2_data_freeinsert(d, prevdup, needlogp); ASSERT(dfp == &d->hdr.bestfree[0]); ASSERT(INT_GET(dfp->length, ARCH_CONVERT) == INT_GET(prevdup->length, ARCH_CONVERT)); - ASSERT(INT_ISZERO(dfp[1].length, ARCH_CONVERT)); - ASSERT(INT_ISZERO(dfp[2].length, ARCH_CONVERT)); + ASSERT(!dfp[1].length); + ASSERT(!dfp[2].length); } } /* @@ -647,7 +647,7 @@ else if (prevdup) { dfp = xfs_dir2_data_freefind(d, prevdup); INT_MOD(prevdup->length, ARCH_CONVERT, len); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(prevdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, prevdup); /* @@ -673,7 +673,7 @@ newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(newdup->length, ARCH_CONVERT, len + INT_GET(postdup->length, ARCH_CONVERT)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup); /* @@ -698,7 +698,7 @@ newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(newdup->length, ARCH_CONVERT, len); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup); (void)xfs_dir2_data_freeinsert(d, newdup, needlogp); @@ -734,7 +734,7 @@ ASSERT(INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG); ASSERT(offset >= (char *)dup - (char *)d); ASSERT(offset + len <= (char *)dup + INT_GET(dup->length, ARCH_CONVERT) - (char *)d); - ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT)); + ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); /* * Look up the entry in the bestfree table. */ @@ -754,7 +754,7 @@ */ if (matchfront && matchback) { if (dfp) { - needscan = !INT_ISZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].offset; if (!needscan) xfs_dir2_data_freeremove(d, dfp, needlogp); } @@ -767,7 +767,7 @@ newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len); INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(newdup->length, ARCH_CONVERT, oldlen - len); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup); /* @@ -795,7 +795,7 @@ newdup = dup; INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t) (((char *)d + offset) - (char *)newdup)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup); /* @@ -823,13 +823,13 @@ newdup = dup; INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t) (((char *)d + offset) - (char *)newdup)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup); newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len); INT_SET(newdup2->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(newdup2->length, ARCH_CONVERT, oldlen - len - INT_GET(newdup->length, ARCH_CONVERT)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup2, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup2), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)newdup2 - (char *)d)); xfs_dir2_data_log_unused(tp, bp, newdup2); /* @@ -841,7 +841,7 @@ * the 2 new will work. */ if (dfp) { - needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].length; if (!needscan) { xfs_dir2_data_freeremove(d, dfp, needlogp); (void)xfs_dir2_data_freeinsert(d, newdup, diff -Nru a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h --- a/fs/xfs/xfs_dir2_data.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_data.h 2005-03-20 16:43:29 -08:00 @@ -163,14 +163,13 @@ * 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_arch( - xfs_dir2_data_unused_t *dup, xfs_arch_t arch); -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ - xfs_dir2_data_unused_tag_p_arch(dup,arch) +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) \ + xfs_dir2_data_unused_tag_p(dup) #else -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ +#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ ((xfs_dir2_data_off_t *)\ - ((char *)(dup) + INT_GET((dup)->length, arch) \ + ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ - (uint)sizeof(xfs_dir2_data_off_t))) #endif diff -Nru a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c --- a/fs/xfs/xfs_dir2_leaf.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_leaf.c 2005-03-20 16:43:29 -08:00 @@ -127,7 +127,7 @@ block = dbp->data; xfs_dir2_data_check(dp, dbp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Set the counts in the leaf header. */ @@ -162,7 +162,7 @@ */ ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); INT_SET(ltp->bestcount, ARCH_CONVERT, 1); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); INT_COPY(bestsp[0], block->hdr.bestfree[0].length, ARCH_CONVERT); /* * Log the data header and leaf bests table. @@ -233,7 +233,7 @@ index = xfs_dir2_leaf_search_hash(args, lbp); leaf = lbp->data; ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); length = XFS_DIR2_DATA_ENTSIZE(args->namelen); /* * See if there are any entries with the same hash value @@ -274,7 +274,7 @@ * How many bytes do we need in the leaf block? */ needbytes = - (!INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT) ? 0 : (uint)sizeof(leaf->ents[0])) + + (leaf->hdr.stale ? 0 : (uint)sizeof(leaf->ents[0])) + (use_block != -1 ? 0 : (uint)sizeof(leaf->bests[0])); /* * Now kill use_block if it refers to a missing block, so we @@ -456,7 +456,7 @@ * Now we need to make room to insert the leaf entry. * If there are no stale entries, we just insert a hole at index. */ - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { /* * lep is still good as the index leaf entry. */ @@ -595,7 +595,7 @@ * Leaves and bests don't overlap. */ ASSERT((char *)&leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT)] <= - (char *)XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT)); + (char *)XFS_DIR2_LEAF_BESTS_P(ltp)); /* * Check hash value order, count stale entries. */ @@ -625,7 +625,7 @@ int to; /* target leaf index */ leaf = bp->data; - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { return; } /* @@ -649,7 +649,7 @@ */ ASSERT(INT_GET(leaf->hdr.stale, ARCH_CONVERT) == from - to); INT_MOD(leaf->hdr.count, ARCH_CONVERT, -(INT_GET(leaf->hdr.stale, ARCH_CONVERT))); - INT_ZERO(leaf->hdr.stale, ARCH_CONVERT); + leaf->hdr.stale = 0; xfs_dir2_leaf_log_header(args->trans, bp); if (loglow != -1) xfs_dir2_leaf_log_ents(args->trans, bp, loglow, to - 1); @@ -1192,10 +1192,10 @@ * Initialize the header. */ INT_SET(leaf->hdr.info.magic, ARCH_CONVERT, magic); - INT_ZERO(leaf->hdr.info.forw, ARCH_CONVERT); - INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT); - INT_ZERO(leaf->hdr.count, ARCH_CONVERT); - INT_ZERO(leaf->hdr.stale, ARCH_CONVERT); + leaf->hdr.info.forw = 0; + leaf->hdr.info.back = 0; + leaf->hdr.count = 0; + leaf->hdr.stale = 0; xfs_dir2_leaf_log_header(tp, bp); /* * If it's a leaf-format directory initialize the tail. @@ -1204,7 +1204,7 @@ */ if (magic == XFS_DIR2_LEAF1_MAGIC) { ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - INT_ZERO(ltp->bestcount, ARCH_CONVERT); + ltp->bestcount = 0; xfs_dir2_leaf_log_tail(tp, bp); } *bpp = bp; @@ -1229,8 +1229,8 @@ leaf = bp->data; ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC); ltp = XFS_DIR2_LEAF_TAIL_P(tp->t_mountp, leaf); - firstb = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT) + first; - lastb = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT) + last; + firstb = XFS_DIR2_LEAF_BESTS_P(ltp) + first; + lastb = XFS_DIR2_LEAF_BESTS_P(ltp) + last; xfs_da_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); } @@ -1497,7 +1497,7 @@ needscan = needlog = 0; oldbest = INT_GET(data->hdr.bestfree[0].length, ARCH_CONVERT); ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); ASSERT(INT_GET(bestsp[db], ARCH_CONVERT) == oldbest); /* * Mark the former data entry unused. @@ -1658,7 +1658,7 @@ leaf = lbp->data; #ifndef __KERNEL__ - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return 0; #endif /* @@ -1749,7 +1749,7 @@ /* * Eliminate the last bests entry from the table. */ - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); INT_MOD(ltp->bestcount, ARCH_CONVERT, -1); memmove(&bestsp[1], &bestsp[0], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(*bestsp)); xfs_dir2_leaf_log_tail(tp, lbp); @@ -1835,7 +1835,7 @@ } free = fbp->data; ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC); - ASSERT(INT_ISZERO(free->hdr.firstdb, ARCH_CONVERT)); + ASSERT(!free->hdr.firstdb); /* * Now see if the leafn and free data will fit in a leaf1. * If not, release the buffer and give up. @@ -1865,7 +1865,7 @@ /* * Set up the leaf bests table. */ - memcpy(XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), free->bests, + memcpy(XFS_DIR2_LEAF_BESTS_P(ltp), free->bests, INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(leaf->bests[0])); xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); xfs_dir2_leaf_log_tail(tp, lbp); diff -Nru a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h --- a/fs/xfs/xfs_dir2_leaf.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_leaf.h 2005-03-20 16:43:29 -08:00 @@ -144,11 +144,11 @@ */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P) xfs_dir2_data_off_t * -xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch); -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch) +xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp); +#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) #else -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \ - ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, arch)) +#define XFS_DIR2_LEAF_BESTS_P(ltp) \ + ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT)) #endif /* diff -Nru a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c --- a/fs/xfs/xfs_dir2_node.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_node.c 2005-03-20 16:43:29 -08:00 @@ -172,14 +172,14 @@ * Initialize the freespace block header. */ INT_SET(free->hdr.magic, ARCH_CONVERT, XFS_DIR2_FREE_MAGIC); - INT_ZERO(free->hdr.firstdb, ARCH_CONVERT); + free->hdr.firstdb = 0; ASSERT(INT_GET(ltp->bestcount, ARCH_CONVERT) <= (uint)dp->i_d.di_size / mp->m_dirblksize); INT_COPY(free->hdr.nvalid, ltp->bestcount, ARCH_CONVERT); /* * Copy freespace entries from the leaf block to the new block. * Count active entries. */ - for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), to = free->bests; + for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests; i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++, from++, to++) { if ((off = INT_GET(*from, ARCH_CONVERT)) != NULLDATAOFF) n++; @@ -240,7 +240,7 @@ */ if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) { - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) + if (!leaf->hdr.stale) return XFS_ERROR(ENOSPC); compact = INT_GET(leaf->hdr.stale, ARCH_CONVERT) > 1; } else @@ -263,14 +263,14 @@ /* * Set impossible logging indices for this case. */ - else if (!INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + else if (leaf->hdr.stale) { lfloglow = INT_GET(leaf->hdr.count, ARCH_CONVERT); lfloghigh = -1; } /* * No stale entries, just insert a space for the new entry. */ - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { lep = &leaf->ents[index]; if (index < INT_GET(leaf->hdr.count, ARCH_CONVERT)) memmove(lep + 1, lep, @@ -403,7 +403,7 @@ ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); if (count) *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return 0; return INT_GET(leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); } @@ -690,7 +690,7 @@ * If the source has stale leaves, count the ones in the copy range * so we can update the header correctly. */ - if (!INT_ISZERO(leaf_s->hdr.stale, ARCH_CONVERT)) { + if (leaf_s->hdr.stale) { int i; /* temp leaf index */ for (i = start_s, stale = 0; i < start_s + count; i++) { @@ -1020,7 +1020,7 @@ * If there are no useful entries left in the block, * get rid of the block if we can. */ - if (INT_ISZERO(free->hdr.nused, ARCH_CONVERT)) { + if (!free->hdr.nused) { error = xfs_dir2_shrink_inode(args, fdb, fbp); if (error == 0) { fbp = NULL; @@ -1182,7 +1182,7 @@ * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ - forward = !INT_ISZERO(info->forw, ARCH_CONVERT); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &rval); @@ -1634,8 +1634,8 @@ INT_SET(free->hdr.firstdb, ARCH_CONVERT, (fbno - XFS_DIR2_FREE_FIRSTDB(mp)) * XFS_DIR2_MAX_FREE_BESTS(mp)); - INT_ZERO(free->hdr.nvalid, ARCH_CONVERT); - INT_ZERO(free->hdr.nused, ARCH_CONVERT); + free->hdr.nvalid = 0; + free->hdr.nused = 0; } else { free = fbp->data; ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC); diff -Nru a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c --- a/fs/xfs/xfs_dir2_sf.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_sf.c 2005-03-20 16:43:29 -08:00 @@ -114,7 +114,7 @@ count = i8count = namelen = 0; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Iterate over the block's data entries by using the leaf pointers. @@ -163,7 +163,7 @@ */ sfhp->count = count; sfhp->i8count = i8count; - XFS_DIR2_SF_PUT_INUMBER_ARCH((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent); return size; } @@ -230,7 +230,7 @@ */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); ptr = (char *)block->u; - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); sfep = XFS_DIR2_SF_FIRSTENTRY(sfp); /* * Loop over the active and unused entries. @@ -257,19 +257,19 @@ else if (dep->namelen == 2 && dep->name[0] == '.' && dep->name[1] == '.') ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) == - XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT)); + XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); /* * Normal entry, copy it into shortform. */ else { sfep->namelen = dep->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, + XFS_DIR2_SF_PUT_OFFSET(sfep, (xfs_dir2_data_aoff_t) - ((char *)dep - (char *)block), ARCH_CONVERT); + ((char *)dep - (char *)block)); memcpy(sfep->name, dep->name, dep->namelen); temp=INT_GET(dep->inumber, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &temp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &temp, + XFS_DIR2_SF_INUMBERP(sfep)); sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); } ptr += XFS_DIR2_DATA_ENTSIZE(dep->namelen); @@ -427,10 +427,10 @@ * Fill in the new entry. */ sfep->namelen = args->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(sfep, offset); memcpy(sfep->name, args->name, sfep->namelen); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); /* * Update the header and inode. */ @@ -494,7 +494,7 @@ offset = new_offset + XFS_DIR2_DATA_ENTSIZE(oldsfep->namelen), oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep), eof = (char *)oldsfep == &buf[old_isize]) { - new_offset = XFS_DIR2_SF_GET_OFFSET_ARCH(oldsfep, ARCH_CONVERT); + new_offset = XFS_DIR2_SF_GET_OFFSET(oldsfep); if (offset + add_datasize <= new_offset) break; } @@ -519,10 +519,10 @@ * Fill in the new entry, and update the header counts. */ sfep->namelen = args->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(sfep, offset); memcpy(sfep->name, args->name, sfep->namelen); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); sfp->hdr.count++; #if XFS_BIG_INUMS if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange) @@ -579,8 +579,8 @@ */ for (i = 0; i < sfp->hdr.count; i++) { if (!holefit) - holefit = offset + size <= XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT); - offset = XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + holefit = offset + size <= XFS_DIR2_SF_GET_OFFSET(sfep); + offset = XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(sfep->namelen); sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); } @@ -641,17 +641,17 @@ sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; offset = XFS_DIR2_DATA_FIRST_OFFSET; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); i8count = ino > XFS_DIR2_MAX_SHORT_INUM; for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp); i < sfp->hdr.count; i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { - ASSERT(XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) >= offset); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ASSERT(XFS_DIR2_SF_GET_OFFSET(sfep) >= offset); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep)); i8count += ino > XFS_DIR2_MAX_SHORT_INUM; offset = - XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(sfep->namelen); } ASSERT(i8count == sfp->hdr.i8count); @@ -708,7 +708,7 @@ /* * Now can put in the inode number, since i8count is set. */ - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &pino, &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &pino, &sfp->hdr.parent); sfp->hdr.count = 0; dp->i_d.di_size = size; xfs_dir2_sf_check(args); @@ -800,8 +800,7 @@ XFS_DIR2_DATA_DOTDOT_OFFSET)) { p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk, XFS_DIR2_DATA_FIRST_OFFSET); - p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, - ARCH_CONVERT); + p.ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); #if XFS_BIG_INUMS p.ino += mp->m_inoadd; #endif @@ -826,7 +825,7 @@ i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { off = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk, - XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT)); + XFS_DIR2_SF_GET_OFFSET(sfep)); if (dir_offset > off) continue; @@ -834,11 +833,10 @@ p.namelen = sfep->namelen; p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk, - XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(p.namelen)); - p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + p.ino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep)); #if XFS_BIG_INUMS p.ino += mp->m_inoadd; #endif @@ -904,7 +902,7 @@ */ if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { - args->inumber = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + args->inumber = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); return XFS_ERROR(EEXIST); } /* @@ -917,8 +915,8 @@ sfep->name[0] == args->name[0] && memcmp(args->name, sfep->name, args->namelen) == 0) { args->inumber = - XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)); return XFS_ERROR(EEXIST); } } @@ -971,8 +969,8 @@ if (sfep->namelen == args->namelen && sfep->name[0] == args->name[0] && memcmp(sfep->name, args->name, args->namelen) == 0) { - ASSERT(XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT) == + ASSERT(XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)) == args->inumber); break; } @@ -1093,10 +1091,10 @@ if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { #if XFS_BIG_INUMS || defined(DEBUG) - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); ASSERT(args->inumber != ino); #endif - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, &sfp->hdr.parent); } /* * Normal entry, look for the name. @@ -1109,12 +1107,12 @@ sfep->name[0] == args->name[0] && memcmp(args->name, sfep->name, args->namelen) == 0) { #if XFS_BIG_INUMS || defined(DEBUG) - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)); ASSERT(args->inumber != ino); #endif - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); break; } } @@ -1215,8 +1213,8 @@ */ sfp->hdr.count = oldsfp->hdr.count; sfp->hdr.i8count = 0; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, &oldsfp->hdr.parent, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent); /* * Copy the entries field by field. */ @@ -1228,9 +1226,9 @@ sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; memcpy(sfep->name, oldsfep->name, sfep->namelen); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, + XFS_DIR2_SF_INUMBERP(oldsfep)); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep)); } /* * Clean up the inode. @@ -1292,8 +1290,8 @@ */ sfp->hdr.count = oldsfp->hdr.count; sfp->hdr.i8count = 1; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, &oldsfp->hdr.parent, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent); /* * Copy the entries field by field. */ @@ -1305,9 +1303,9 @@ sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; memcpy(sfep->name, oldsfep->name, sfep->namelen); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, + XFS_DIR2_SF_INUMBERP(oldsfep)); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep)); } /* * Clean up the inode. diff -Nru a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h --- a/fs/xfs/xfs_dir2_sf.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir2_sf.h 2005-03-20 16:43:29 -08:00 @@ -59,21 +59,12 @@ */ typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; -#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \ - (xfs_ino_t)(DIRINO_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO8(di) \ - XFS_DIR2_SF_GET_INO8_ARCH(di,ARCH_NOCONVERT) - /* * Inode number stored as 4 8-bit values. * Works a lot of the time, when all the inode numbers in a directory * fit in 32 bits. */ typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t; -#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \ - (xfs_ino_t)(DIRINO4_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO4(di) \ - XFS_DIR2_SF_GET_INO4_ARCH(di,ARCH_NOCONVERT) typedef union { xfs_dir2_ino8_t i8; @@ -132,51 +123,48 @@ #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER) -xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from, - xfs_arch_t arch); -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ - xfs_dir2_sf_get_inumber_arch(sfp, from, arch) +xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from); +#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ + xfs_dir2_sf_get_inumber(sfp, from) #else -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ +#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ ((sfp)->hdr.i8count == 0 ? \ - (xfs_intino_t)XFS_DIR2_SF_GET_INO4_ARCH(*(from), arch) : \ - (xfs_intino_t)XFS_DIR2_SF_GET_INO8_ARCH(*(from), arch)) + (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ + (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) -void xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from, - xfs_dir2_inou_t *to, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ - xfs_dir2_sf_put_inumber_arch(sfp,from,to,arch) +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) #else -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ +#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ if ((sfp)->hdr.i8count == 0) { \ - DIRINO4_COPY_ARCH(from,to,arch); \ + XFS_PUT_DIR_INO4(*(from), (to)->i4); \ } else { \ - DIRINO_COPY_ARCH(from,to,arch); \ + 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_arch(xfs_dir2_sf_entry_t *sfep, - xfs_arch_t arch); xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep); -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ - xfs_dir2_sf_get_offset_arch(sfep,arch) +#define XFS_DIR2_SF_GET_OFFSET(sfep) \ + xfs_dir2_sf_get_offset(sfep) #else -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ - INT_GET_UNALIGNED_16_ARCH(&(sfep)->offset.i,arch) +#define XFS_DIR2_SF_GET_OFFSET(sfep) \ + INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET) -void xfs_dir2_sf_put_offset_arch(xfs_dir2_sf_entry_t *sfep, - xfs_dir2_data_aoff_t off, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ - xfs_dir2_sf_put_offset_arch(sfep,off,arch) +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) \ + xfs_dir2_sf_put_offset(sfep,off) #else -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ - INT_SET_UNALIGNED_16_ARCH(&(sfep)->offset.i,off,arch) +#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ + INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i,off) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME) diff -Nru a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c --- a/fs/xfs/xfs_dir_leaf.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir_leaf.c 2005-03-20 16:43:29 -08:00 @@ -160,9 +160,9 @@ ASSERT(dp->i_df.if_bytes == 0); xfs_idata_realloc(dp, sizeof(*hdr), XFS_DATA_FORK); hdr = (xfs_dir_sf_hdr_t *)dp->i_df.if_u1.if_data; - XFS_DIR_SF_PUT_DIRINO_ARCH(&parent, &hdr->parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&parent, &hdr->parent); - INT_ZERO(hdr->count, ARCH_CONVERT); + hdr->count = 0; dp->i_d.di_size = sizeof(*hdr); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); return(0); @@ -208,7 +208,7 @@ sf = (xfs_dir_shortform_t *)dp->i_df.if_u1.if_data; sfe = (xfs_dir_sf_entry_t *)((char *)sf + offset); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sfe->inumber); sfe->namelen = args->namelen; memcpy(sfe->name, args->name, sfe->namelen); INT_MOD(sf->hdr.count, ARCH_CONVERT, +1); @@ -298,7 +298,7 @@ sf = (xfs_dir_shortform_t *)dp->i_df.if_u1.if_data; if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { - XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf->hdr.parent, &args->inumber); return(XFS_ERROR(EEXIST)); } if (args->namelen == 1 && args->name[0] == '.') { @@ -310,7 +310,7 @@ if (sfe->namelen == args->namelen && sfe->name[0] == args->name[0] && memcmp(args->name, sfe->name, args->namelen) == 0) { - XFS_DIR_SF_GET_DIRINO_ARCH(&sfe->inumber, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sfe->inumber, &args->inumber); return(XFS_ERROR(EEXIST)); } sfe = XFS_DIR_SF_NEXTENTRY(sfe); @@ -353,7 +353,7 @@ memcpy(tmpbuffer, dp->i_df.if_u1.if_data, size); sf = (xfs_dir_shortform_t *)tmpbuffer; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf->hdr.parent, &inumber); xfs_idata_realloc(dp, -size, XFS_DATA_FORK); dp->i_d.di_size = 0; @@ -398,7 +398,7 @@ args.namelen = sfe->namelen; args.hashval = xfs_da_hashname((char *)(sfe->name), sfe->namelen); - XFS_DIR_SF_GET_DIRINO_ARCH(&sfe->inumber, &args.inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sfe->inumber, &args.inumber); retval = xfs_dir_leaf_addname(&args); if (retval) goto out; @@ -470,7 +470,7 @@ sbp->entno = 1; sbp->seqno = 0; sbp->hash = xfs_dir_hash_dotdot; - sbp->ino = XFS_GET_DIR_INO_ARCH(mp, sf->hdr.parent, ARCH_CONVERT); + sbp->ino = XFS_GET_DIR_INO8(sf->hdr.parent); sbp->name = ".."; sbp->namelen = 2; sbp++; @@ -494,7 +494,7 @@ sbp->entno = i + 2; sbp->seqno = 0; sbp->hash = xfs_da_hashname((char *)sfe->name, sfe->namelen); - sbp->ino = XFS_GET_DIR_INO_ARCH(mp, sfe->inumber, ARCH_CONVERT); + sbp->ino = XFS_GET_DIR_INO8(sfe->inumber); sbp->name = (char *)sfe->name; sbp->namelen = sfe->namelen; sfe = XFS_DIR_SF_NEXTENTRY(sfe); @@ -612,7 +612,7 @@ if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { /* XXX - replace assert? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sf->hdr.parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sf->hdr.parent); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); return(0); } @@ -624,7 +624,7 @@ memcmp(args->name, sfe->name, args->namelen) == 0) { ASSERT(memcmp((char *)&args->inumber, (char *)&sfe->inumber, sizeof(xfs_ino_t))); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sfe->inumber); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); return(0); } @@ -675,10 +675,10 @@ if ((entry->namelen == 2) && (namest->name[0] == '.') && (namest->name[1] == '.')) { - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &parent, ARCH_CONVERT); - INT_ZERO(entry->nameidx, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &parent); + entry->nameidx = 0; } else if ((entry->namelen == 1) && (namest->name[0] == '.')) { - INT_ZERO(entry->nameidx, ARCH_CONVERT); + entry->nameidx = 0; } } retval = xfs_da_shrink_inode(iargs, 0, bp); @@ -701,13 +701,13 @@ args.justcheck = 0; args.addname = args.oknoent = 1; for (i = 0; i < INT_GET(hdr->count, ARCH_CONVERT); entry++, i++) { - if (INT_ISZERO(entry->nameidx, ARCH_CONVERT)) + if (!entry->nameidx) continue; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); args.name = (char *)(namest->name); args.namelen = entry->namelen; args.hashval = INT_GET(entry->hashval, ARCH_CONVERT); - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &args.inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &args.inumber); xfs_dir_shortform_addname(&args); } @@ -801,7 +801,7 @@ hdr = &leaf->hdr; INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_DIR_LEAF_MAGIC); INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); - if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) + if (!hdr->firstused) INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount) - 1); INT_SET(hdr->freemap[0].base, ARCH_CONVERT, sizeof(xfs_dir_leaf_hdr_t)); INT_SET(hdr->freemap[0].size, ARCH_CONVERT, INT_GET(hdr->firstused, ARCH_CONVERT) - INT_GET(hdr->freemap[0].base, ARCH_CONVERT)); @@ -895,7 +895,7 @@ sum += INT_GET(map->size, ARCH_CONVERT); continue; } - if (INT_ISZERO(map->size, ARCH_CONVERT)) + if (!map->size) continue; /* no space in this map */ tmp = entsize; if (INT_GET(map->base, ARCH_CONVERT) < INT_GET(hdr->firstused, ARCH_CONVERT)) @@ -995,7 +995,7 @@ * Copy the string and inode number into the new space. */ namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &namest->inumber); memcpy(namest->name, args->name, args->namelen); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry))); @@ -1060,10 +1060,10 @@ hdr_d = &leaf_d->hdr; hdr_d->info = hdr_s->info; /* struct copy */ INT_SET(hdr_d->firstused, ARCH_CONVERT, lbsize); - if (INT_ISZERO(hdr_d->firstused, ARCH_CONVERT)) + if (!hdr_d->firstused) INT_SET(hdr_d->firstused, ARCH_CONVERT, lbsize - 1); - INT_ZERO(hdr_d->namebytes, ARCH_CONVERT); - INT_ZERO(hdr_d->count, ARCH_CONVERT); + hdr_d->namebytes = 0; + hdr_d->count = 0; hdr_d->holes = 0; INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, sizeof(xfs_dir_leaf_hdr_t)); INT_SET(hdr_d->freemap[0].size, ARCH_CONVERT, INT_GET(hdr_d->firstused, ARCH_CONVERT) - INT_GET(hdr_d->freemap[0].base, ARCH_CONVERT)); @@ -1366,7 +1366,7 @@ * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ - forward = !INT_ISZERO(info->forw, ARCH_CONVERT); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1515,8 +1515,8 @@ map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, entsize); INT_MOD(map->size, ARCH_CONVERT, INT_GET(hdr->freemap[after].size, ARCH_CONVERT)); - INT_ZERO(hdr->freemap[after].base, ARCH_CONVERT); - INT_ZERO(hdr->freemap[after].size, ARCH_CONVERT); + hdr->freemap[after].base = 0; + hdr->freemap[after].size = 0; } else if (before >= 0) { map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, entsize); @@ -1576,7 +1576,7 @@ tmp = INT_GET(entry->nameidx, ARCH_CONVERT); } INT_SET(hdr->firstused, ARCH_CONVERT, tmp); - if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) + if (!hdr->firstused) INT_SET(hdr->firstused, ARCH_CONVERT, tmp - 1); } else { hdr->holes = 1; /* mark as needing compaction */ @@ -1656,11 +1656,11 @@ tmp_leaf = (xfs_dir_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; tmp_hdr->info = save_hdr->info; /* struct copy */ - INT_ZERO(tmp_hdr->count, ARCH_CONVERT); + tmp_hdr->count = 0; INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); - if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) + if (!tmp_hdr->firstused) INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize - 1); - INT_ZERO(tmp_hdr->namebytes, ARCH_CONVERT); + tmp_hdr->namebytes = 0; if (xfs_dir_leaf_order(save_blk->bp, drop_blk->bp)) { xfs_dir_leaf_moveents(drop_leaf, 0, tmp_leaf, 0, (int)INT_GET(drop_hdr->count, ARCH_CONVERT), mp); @@ -1732,7 +1732,7 @@ break; } ASSERT((probe >= 0) && \ - ((INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT)))); + ((!leaf->hdr.count) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT)))); ASSERT((span <= 4) || (INT_GET(entry->hashval, ARCH_CONVERT) == hashval)); /* @@ -1761,7 +1761,7 @@ if (entry->namelen == args->namelen && namest->name[0] == args->name[0] && memcmp(args->name, namest->name, args->namelen) == 0) { - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &args->inumber); *index = probe; return(XFS_ERROR(EEXIST)); } @@ -1886,8 +1886,8 @@ INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, (uint)sizeof(xfs_dir_leaf_hdr_t)); INT_MOD(hdr_d->freemap[0].base, ARCH_CONVERT, INT_GET(hdr_d->count, ARCH_CONVERT) * (uint)sizeof(xfs_dir_leaf_entry_t)); INT_SET(hdr_d->freemap[0].size, ARCH_CONVERT, INT_GET(hdr_d->firstused, ARCH_CONVERT) - INT_GET(hdr_d->freemap[0].base, ARCH_CONVERT)); - INT_SET(hdr_d->freemap[1].base, ARCH_CONVERT, INT_ZERO(hdr_d->freemap[2].base, ARCH_CONVERT)); - INT_SET(hdr_d->freemap[1].size, ARCH_CONVERT, INT_ZERO(hdr_d->freemap[2].size, ARCH_CONVERT)); + INT_SET(hdr_d->freemap[1].base, ARCH_CONVERT, (hdr_d->freemap[2].base = 0)); + INT_SET(hdr_d->freemap[1].size, ARCH_CONVERT, (hdr_d->freemap[2].size = 0)); hdr_s->holes = 1; /* leaf may not be compact */ } @@ -1925,7 +1925,7 @@ ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC); if (count) *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return(0); return(INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); } @@ -2140,7 +2140,7 @@ * then restore the UIO to the first entry in the current * run of equal-hashval entries (probably one 1 entry long). */ - p.ino = XFS_GET_DIR_INO_ARCH(mp, namest->inumber, ARCH_CONVERT); + p.ino = XFS_GET_DIR_INO8(namest->inumber); #if XFS_BIG_INUMS p.ino += mp->m_inoadd; #endif diff -Nru a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h --- a/fs/xfs/xfs_dir_leaf.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir_leaf.h 2005-03-20 16:43:29 -08:00 @@ -140,11 +140,6 @@ #define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash)) -#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \ - DIRINO_GET_ARCH(&(di),arch) -#define XFS_GET_DIR_INO(mp,di) \ - XFS_GET_DIR_INO_ARCH(mp,di,ARCH_NOCONVERT) - typedef struct xfs_dir_put_args { xfs_dircook_t cook; /* cookie of (next) entry */ diff -Nru a/fs/xfs/xfs_dir_sf.h b/fs/xfs/xfs_dir_sf.h --- a/fs/xfs/xfs_dir_sf.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_dir_sf.h 2005-03-20 16:43:29 -08:00 @@ -77,22 +77,16 @@ } xfs_dir_sf_sort_t; #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) -void xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch) #define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) #else -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#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) -void xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) +#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) #else -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#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) int xfs_dir_sf_entsize_byname(int len); diff -Nru a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c --- a/fs/xfs/xfs_fsops.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_fsops.c 2005-03-20 16:43:29 -08:00 @@ -220,9 +220,9 @@ XFS_CNT_BLOCK(mp)); INT_SET(agf->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT, 1); INT_SET(agf->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT, 1); - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE(mp) - 1); - INT_ZERO(agf->agf_flcount, ARCH_CONVERT); + agf->agf_flcount = 0; tmpsize = agsize - XFS_PREALLOC_BLOCKS(mp); INT_SET(agf->agf_freeblks, ARCH_CONVERT, tmpsize); INT_SET(agf->agf_longest, ARCH_CONVERT, tmpsize); @@ -242,10 +242,10 @@ INT_SET(agi->agi_versionnum, ARCH_CONVERT, XFS_AGI_VERSION); INT_SET(agi->agi_seqno, ARCH_CONVERT, agno); INT_SET(agi->agi_length, ARCH_CONVERT, agsize); - INT_ZERO(agi->agi_count, ARCH_CONVERT); + agi->agi_count = 0; INT_SET(agi->agi_root, ARCH_CONVERT, XFS_IBT_BLOCK(mp)); INT_SET(agi->agi_level, ARCH_CONVERT, 1); - INT_ZERO(agi->agi_freecount, ARCH_CONVERT); + agi->agi_freecount = 0; INT_SET(agi->agi_newino, ARCH_CONVERT, NULLAGINO); INT_SET(agi->agi_dirino, ARCH_CONVERT, NULLAGINO); for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++) @@ -264,7 +264,7 @@ block = XFS_BUF_TO_SBLOCK(bp); memset(block, 0, mp->m_sb.sb_blocksize); INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTB_MAGIC); - INT_ZERO(block->bb_level, ARCH_CONVERT); + block->bb_level = 0; INT_SET(block->bb_numrecs, ARCH_CONVERT, 1); INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK); INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); @@ -287,7 +287,7 @@ block = XFS_BUF_TO_SBLOCK(bp); memset(block, 0, mp->m_sb.sb_blocksize); INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTC_MAGIC); - INT_ZERO(block->bb_level, ARCH_CONVERT); + block->bb_level = 0; INT_SET(block->bb_numrecs, ARCH_CONVERT, 1); INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK); INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); @@ -311,8 +311,8 @@ block = XFS_BUF_TO_SBLOCK(bp); memset(block, 0, mp->m_sb.sb_blocksize); INT_SET(block->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC); - INT_ZERO(block->bb_level, ARCH_CONVERT); - INT_ZERO(block->bb_numrecs, ARCH_CONVERT); + block->bb_level = 0; + block->bb_numrecs = 0; INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK); INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); error = xfs_bwrite(mp, bp); @@ -393,7 +393,7 @@ break; } sbp = XFS_BUF_TO_SBP(bp); - xfs_xlatesb(sbp, &mp->m_sb, -1, ARCH_CONVERT, XFS_SB_ALL_BITS); + xfs_xlatesb(sbp, &mp->m_sb, -1, XFS_SB_ALL_BITS); /* * If we get an error writing out the alternate superblocks, * just issue a warning and continue. The real work is diff -Nru a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c --- a/fs/xfs/xfs_ialloc.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_ialloc.c 2005-03-20 16:43:29 -08:00 @@ -580,7 +580,7 @@ * allocation groups upward, wrapping at the end. */ *alloc_done = B_FALSE; - while (INT_ISZERO(agi->agi_freecount, ARCH_CONVERT)) { + while (!agi->agi_freecount) { /* * Don't do anything if we're not supposed to allocate * any blocks, just go on to the next ag. @@ -662,7 +662,7 @@ XFS_WANT_CORRUPTED_GOTO(i == 1, error0); do { if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_freecount, &rec.ir_free, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; @@ -682,7 +682,7 @@ goto error0; if (i != 0 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &j, ARCH_NOCONVERT)) == 0 && + &rec.ir_freecount, &rec.ir_free, &j)) == 0 && j == 1 && rec.ir_freecount > 0) { /* @@ -717,7 +717,7 @@ if ((error = xfs_inobt_get_rec(tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT))) + &trec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } @@ -731,7 +731,7 @@ if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } @@ -795,7 +795,7 @@ tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT))) + &trec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -815,7 +815,7 @@ cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -835,7 +835,7 @@ goto error0; if (i == 1 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &j, ARCH_NOCONVERT)) == 0 && + &rec.ir_freecount, &rec.ir_free, &j)) == 0 && j == 1 && rec.ir_freecount > 0) { /* @@ -856,7 +856,7 @@ if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, &rec.ir_free, - &i, ARCH_NOCONVERT))) + &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (rec.ir_freecount > 0) @@ -873,7 +873,7 @@ ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) % XFS_INODES_PER_CHUNK) == 0); ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino + offset); - XFS_INOBT_CLR_FREE(&rec, offset, ARCH_NOCONVERT); + XFS_INOBT_CLR_FREE(&rec, offset); rec.ir_freecount--; if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, rec.ir_free))) @@ -891,7 +891,7 @@ goto error0; do { if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_freecount, &rec.ir_free, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; @@ -998,7 +998,7 @@ goto error0; do { if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_freecount, &rec.ir_free, &i))) goto error0; if (i) { freecount += rec.ir_freecount; @@ -1021,7 +1021,7 @@ } XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT))) { + &rec.ir_free, &i))) { cmn_err(CE_WARN, "xfs_difree: xfs_inobt_get_rec() returned an error %d on %s. Returning error.", error, mp->m_fsname); @@ -1033,11 +1033,11 @@ */ off = agino - rec.ir_startino; ASSERT(off >= 0 && off < XFS_INODES_PER_CHUNK); - ASSERT(!XFS_INOBT_IS_FREE(&rec, off, ARCH_NOCONVERT)); + ASSERT(!XFS_INOBT_IS_FREE(&rec, off)); /* * Mark the inode free & increment the count. */ - XFS_INOBT_SET_FREE(&rec, off, ARCH_NOCONVERT); + XFS_INOBT_SET_FREE(&rec, off); rec.ir_freecount++; /* @@ -1103,8 +1103,7 @@ if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, - ARCH_NOCONVERT))) + &rec.ir_free, &i))) goto error0; if (i) { freecount += rec.ir_freecount; @@ -1232,7 +1231,7 @@ goto error0; } if ((error = xfs_inobt_get_rec(cur, &chunk_agino, &chunk_cnt, - &chunk_free, &i, ARCH_NOCONVERT))) { + &chunk_free, &i))) { #ifdef DEBUG xfs_fs_cmn_err(CE_ALERT, mp, "xfs_dilocate: " "xfs_inobt_get_rec() failed"); @@ -1392,7 +1391,7 @@ int i; for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) - ASSERT(!INT_ISZERO(agi->agi_unlinked[i], ARCH_CONVERT)); + ASSERT(agi->agi_unlinked[i]); } #endif diff -Nru a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c --- a/fs/xfs/xfs_ialloc_btree.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_ialloc_btree.c 2005-03-20 16:43:29 -08:00 @@ -1801,8 +1801,7 @@ 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 */ - xfs_arch_t arch) /* input: architecture */ + int *stat) /* output: success/failure */ { xfs_inobt_block_t *block; /* btree block */ xfs_buf_t *bp; /* buffer containing btree block */ @@ -1830,16 +1829,9 @@ * Point to the record and extract its data. */ rec = XFS_INOBT_REC_ADDR(block, ptr, cur); - ASSERT(arch == ARCH_NOCONVERT || arch == ARCH_CONVERT); - if (arch == ARCH_NOCONVERT) { - *ino = INT_GET(rec->ir_startino, ARCH_CONVERT); - *fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT); - *free = INT_GET(rec->ir_free, ARCH_CONVERT); - } else { - INT_COPY(*ino, rec->ir_startino, ARCH_CONVERT); - INT_COPY(*fcnt, rec->ir_freecount, ARCH_CONVERT); - INT_COPY(*free, rec->ir_free, ARCH_CONVERT); - } + *ino = INT_GET(rec->ir_startino, ARCH_CONVERT); + *fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT); + *free = INT_GET(rec->ir_free, ARCH_CONVERT); *stat = 1; return 0; } diff -Nru a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h --- a/fs/xfs/xfs_ialloc_btree.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_ialloc_btree.h 2005-03-20 16:43:29 -08:00 @@ -99,23 +99,22 @@ #define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) -int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch) +int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); +#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) #else -#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \ - & XFS_INOBT_MASK(i)) != 0) +#define XFS_INOBT_IS_FREE(rp,i) (((rp)->ir_free & 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, xfs_arch_t arch); -#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch) +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,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= 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, xfs_arch_t arch); -#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch) +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,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i))) +#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) #endif /* @@ -244,8 +243,7 @@ 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 */ - xfs_arch_t arch); /* output: architecture */ + int *stat); /* output: success/failure */ /* * Increment cursor by one record at the level. diff -Nru a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c --- a/fs/xfs/xfs_iget.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_iget.c 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 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 * under the terms of version 2 of the GNU General Public License as @@ -61,7 +61,8 @@ * Initialize the inode hash table for the newly mounted file system. * Choose an initial table size based on user specified value, else * use a simple algorithm using the maximum number of inodes as an - * indicator for table size, and cap it at 16 pages (gettin' big). + * indicator for table size, and clamp it between one and some large + * number of pages. */ void xfs_ihash_init(xfs_mount_t *mp) @@ -72,8 +73,10 @@ if (!mp->m_ihsize) { icount = mp->m_maxicount ? mp->m_maxicount : (mp->m_sb.sb_dblocks << mp->m_sb.sb_inopblog); - mp->m_ihsize = 1 << max_t(uint, xfs_highbit64(icount) / 3, 8); - mp->m_ihsize = min_t(uint, mp->m_ihsize, 16 * PAGE_SIZE); + mp->m_ihsize = 1 << max_t(uint, 8, + (xfs_highbit64(icount) + 1) / 2); + mp->m_ihsize = min_t(uint, mp->m_ihsize, + (64 * NBPP) / sizeof(xfs_ihash_t)); } while (!(mp->m_ihash = (xfs_ihash_t *)kmem_zalloc(mp->m_ihsize * @@ -488,6 +491,11 @@ vn_wait(vp); iput(inode); goto retry; + } + + if (is_bad_inode(inode)) { + iput(inode); + return EIO; } bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops); diff -Nru a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c --- a/fs/xfs/xfs_inode.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_inode.c 2005-03-20 16:43:29 -08:00 @@ -135,11 +135,11 @@ for (i = 0; i < j; i++) { dip = (xfs_dinode_t *)xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize); - if (INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)) { + if (!dip->di_next_unlinked) { xfs_fs_cmn_err(CE_ALERT, mp, "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.", bp); - ASSERT(!INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)); + ASSERT(dip->di_next_unlinked); } } } @@ -176,7 +176,7 @@ xfs_fs_cmn_err(CE_WARN, mp, "corrupt, unmount and run xfs_repair"); } - if (INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)) { + if (!dip->di_next_unlinked) { cmn_err(CE_WARN, "Bad next_unlinked field (0) in XFS inode buffer 0x%p, starting blockno %Ld, offset 0x%x", (__uint64_t)(__psunsigned_t) bp, @@ -520,8 +520,7 @@ } di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); - if (unlikely(di_size > - XFS_DFORK_DSIZE_ARCH(dip, ip->i_mount, ARCH_CONVERT))) { + if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (bad size %Ld for local inode). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, @@ -555,7 +554,7 @@ if (error) { return error; } - if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)) + if (!XFS_DFORK_Q(dip)) return 0; ASSERT(ip->i_afp == NULL); ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); @@ -563,7 +562,7 @@ XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); switch (INT_GET(dip->di_core.di_aformat, ARCH_CONVERT)) { case XFS_DINODE_FMT_LOCAL: - atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); size = (int)INT_GET(atp->hdr.totsize, ARCH_CONVERT); error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); break; @@ -610,11 +609,11 @@ * is wrong and we just bail out rather than crash in * kmem_alloc() or memcpy() below. */ - if (unlikely(size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT))) { + if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (bad size %d for local fork, size = %d). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, size, - XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT)); + XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, ip->i_mount, dip); return XFS_ERROR(EFSCORRUPTED); @@ -632,8 +631,7 @@ ifp->if_bytes = size; ifp->if_real_bytes = real_size; if (size) - memcpy(ifp->if_u1.if_data, - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), size); + memcpy(ifp->if_u1.if_data, XFS_DFORK_PTR(dip, whichfork), size); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFINLINE; return 0; @@ -662,7 +660,7 @@ int i; ifp = XFS_IFORK_PTR(ip, whichfork); - nex = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); + nex = XFS_DFORK_NEXTENTS(dip, whichfork); size = nex * (uint)sizeof(xfs_bmbt_rec_t); /* @@ -670,7 +668,7 @@ * is wrong and we just bail out rather than crash in * kmem_alloc() or memcpy() below. */ - if (unlikely(size < 0 || size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT))) { + if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu ((a)extents = %d). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, nex); @@ -692,8 +690,7 @@ ifp->if_bytes = size; ifp->if_real_bytes = real_size; if (size) { - dp = (xfs_bmbt_rec_t *) - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork); xfs_validate_extents(dp, nex, 1, XFS_EXTFMT_INODE(ip)); ep = ifp->if_u1.if_extents; for (i = 0; i < nex; i++, ep++, dp++) { @@ -739,7 +736,7 @@ int size; ifp = XFS_IFORK_PTR(ip, whichfork); - dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); size = XFS_BMAP_BROOT_SPACE(dfp); nrecs = XFS_BMAP_BROOT_NUMRECS(dfp); @@ -752,7 +749,7 @@ */ if (unlikely(XFS_IFORK_NEXTENTS(ip, whichfork) <= ifp->if_ext_max || XFS_BMDR_SPACE_CALC(nrecs) > - XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT) + XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (btree). Unmount and run xfs_repair.", @@ -769,7 +766,7 @@ * Copy and convert from the on-disk structure * to the in-memory structure. */ - xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT), + xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), ifp->if_broot, size); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFBROOT; @@ -785,29 +782,18 @@ * dip = native representation * dir = direction - +ve -> disk to native * -ve -> native to disk - * arch = on-disk architecture */ void xfs_xlate_dinode_core( xfs_caddr_t buf, xfs_dinode_core_t *dip, - int dir, - xfs_arch_t arch) + int dir) { xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf; xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip; + xfs_arch_t arch = ARCH_CONVERT; ASSERT(dir); - if (arch == ARCH_NOCONVERT) { - if (dir > 0) { - memcpy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, - sizeof(xfs_dinode_core_t)); - } else { - memcpy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, - sizeof(xfs_dinode_core_t)); - } - return; - } INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch); INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch); @@ -854,16 +840,13 @@ INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch); } -uint -xfs_dic2xflags( +STATIC uint +_xfs_dic2xflags( xfs_dinode_core_t *dic, - xfs_arch_t arch) + __uint16_t di_flags) { - __uint16_t di_flags; - uint flags; + uint flags = 0; - di_flags = INT_GET(dic->di_flags, arch); - flags = XFS_CFORK_Q_ARCH(dic, arch) ? XFS_XFLAG_HASATTR : 0; if (di_flags & XFS_DIFLAG_ANY) { if (di_flags & XFS_DIFLAG_REALTIME) flags |= XFS_XFLAG_REALTIME; @@ -886,9 +869,28 @@ if (di_flags & XFS_DIFLAG_NOSYMLINKS) flags |= XFS_XFLAG_NOSYMLINKS; } + return flags; } +uint +xfs_ip2xflags( + xfs_inode_t *ip) +{ + xfs_dinode_core_t *dic = &ip->i_d; + + return _xfs_dic2xflags(dic, dic->di_flags) | + (XFS_CFORK_Q(dic) ? XFS_XFLAG_HASATTR : 0); +} + +uint +xfs_dic2xflags( + xfs_dinode_core_t *dic) +{ + return _xfs_dic2xflags(dic, INT_GET(dic->di_flags, ARCH_CONVERT)) | + (XFS_CFORK_Q_DISK(dic) ? XFS_XFLAG_HASATTR : 0); +} + /* * Given a mount structure and an inode number, return a pointer * to a newly allocated in-core inode coresponding to the given @@ -974,9 +976,9 @@ * specific information. * Otherwise, just get the truly permanent information. */ - if (!INT_ISZERO(dip->di_core.di_mode, ARCH_CONVERT)) { + if (dip->di_core.di_mode) { xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, - &(ip->i_d), 1, ARCH_CONVERT); + &(ip->i_d), 1); error = xfs_iformat(ip, dip); if (error) { kmem_zone_free(xfs_inode_zone, ip); @@ -1931,7 +1933,7 @@ agino = XFS_INO_TO_AGINO(mp, ip->i_ino); ASSERT(agino != 0); bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; - ASSERT(!INT_ISZERO(agi->agi_unlinked[bucket_index], ARCH_CONVERT)); + ASSERT(agi->agi_unlinked[bucket_index]); ASSERT(INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != agino); if (INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != NULLAGINO) { @@ -1946,7 +1948,7 @@ return error; } ASSERT(INT_GET(dip->di_next_unlinked, ARCH_CONVERT) == NULLAGINO); - ASSERT(!INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)); + ASSERT(dip->di_next_unlinked); /* both on-disk, don't endian flip twice */ dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; offset = ip->i_boffset + @@ -2039,7 +2041,7 @@ ASSERT(agino != 0); bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; ASSERT(INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != NULLAGINO); - ASSERT(!INT_ISZERO(agi->agi_unlinked[bucket_index], ARCH_CONVERT)); + ASSERT(agi->agi_unlinked[bucket_index]); if (INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) == agino) { /* @@ -3015,7 +3017,7 @@ ASSERT(whichfork == XFS_ATTR_FORK); return 0; } - cp = XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + cp = XFS_DFORK_PTR(dip, whichfork); mp = ip->i_mount; switch (XFS_IFORK_FORMAT(ip, whichfork)) { case XFS_DINODE_FMT_LOCAL: @@ -3056,7 +3058,7 @@ XFS_BROOT_SIZE_ADJ)); xfs_bmbt_to_bmdr(ifp->if_broot, ifp->if_broot_bytes, (xfs_bmdr_block_t *)cp, - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT)); + XFS_DFORK_SIZE(dip, mp, whichfork)); } break; @@ -3474,8 +3476,7 @@ * because if the inode is dirty at all the core must * be. */ - xfs_xlate_dinode_core((xfs_caddr_t)&(dip->di_core), &(ip->i_d), - -1, ARCH_CONVERT); + xfs_xlate_dinode_core((xfs_caddr_t)&(dip->di_core), &(ip->i_d), -1); /* Wrap, we never let the log put out DI_MAX_FLUSH */ if (ip->i_d.di_flushiter == DI_MAX_FLUSH) @@ -3505,7 +3506,7 @@ ip->i_d.di_version = XFS_DINODE_VERSION_2; INT_SET(dip->di_core.di_version, ARCH_CONVERT, XFS_DINODE_VERSION_2); ip->i_d.di_onlink = 0; - INT_ZERO(dip->di_core.di_onlink, ARCH_CONVERT); + dip->di_core.di_onlink = 0; memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); memset(&(dip->di_core.di_pad[0]), 0, sizeof(dip->di_core.di_pad)); diff -Nru a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h --- a/fs/xfs/xfs_inode.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_inode.h 2005-03-20 16:43:29 -08:00 @@ -499,8 +499,9 @@ xfs_dev_t, struct cred *, xfs_prid_t, int, struct xfs_buf **, boolean_t *, xfs_inode_t **); void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, - int, xfs_arch_t); -uint xfs_dic2xflags(struct xfs_dinode_core *, xfs_arch_t); + int); +uint xfs_ip2xflags(struct xfs_inode *); +uint xfs_dic2xflags(struct xfs_dinode_core *); int xfs_ifree(struct xfs_trans *, xfs_inode_t *, struct xfs_bmap_free *); void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); diff -Nru a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c --- a/fs/xfs/xfs_inode_item.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_inode_item.c 2005-03-20 16:43:29 -08:00 @@ -339,7 +339,7 @@ nrecs = ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t); ASSERT(nrecs > 0); -#if ARCH_CONVERT == ARCH_NOCONVERT +#if __BYTE_ORDER == __BIG_ENDIAN if (nrecs == ip->i_d.di_nextents) { /* * There are no delayed allocation @@ -467,7 +467,7 @@ #endif ASSERT(nrecs > 0); ASSERT(nrecs == ip->i_d.di_anextents); -#if ARCH_CONVERT == ARCH_NOCONVERT +#if __BYTE_ORDER == __BIG_ENDIAN /* * There are not delayed allocation extents * for attributes, so just point at the array. diff -Nru a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c --- a/fs/xfs/xfs_itable.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_itable.c 2005-03-20 16:43:29 -08:00 @@ -60,128 +60,137 @@ #define unuseracc(ubuffer, size, flags) #endif -/* - * Return stat information for one inode. - * Return 0 if ok, else errno. - */ -int /* error status */ -xfs_bulkstat_one( +STATIC int +xfs_bulkstat_one_iget( xfs_mount_t *mp, /* mount point for filesystem */ xfs_ino_t ino, /* inode number to get data for */ - void __user *buffer, /* buffer to place output in */ - int ubsize, /* size of buffer */ - void *private_data, /* my private data */ xfs_daddr_t bno, /* starting bno of inode cluster */ - int *ubused, /* bytes used by me */ - void *dibuff, /* on-disk inode buffer */ + xfs_bstat_t *buf, /* return buffer */ int *stat) /* BULKSTAT_RV_... */ { - xfs_bstat_t *buf; /* return buffer */ - int error; /* error value */ - xfs_dinode_t *dip; /* dinode inode pointer */ xfs_dinode_core_t *dic; /* dinode core info pointer */ - xfs_inode_t *ip = NULL; /* incore inode pointer */ - xfs_arch_t arch; /* these are set according to */ - - dip = (xfs_dinode_t *)dibuff; + xfs_inode_t *ip; /* incore inode pointer */ + int error; - if (!buffer || ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || - (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && - (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))) { + error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, bno); + if (error) { *stat = BULKSTAT_RV_NOTHING; - return XFS_ERROR(EINVAL); + return error; } - if (ubsize < sizeof(*buf)) { + + ASSERT(ip != NULL); + ASSERT(ip->i_blkno != (xfs_daddr_t)0); + if (ip->i_d.di_mode == 0) { *stat = BULKSTAT_RV_NOTHING; - return XFS_ERROR(ENOMEM); + error = XFS_ERROR(ENOENT); + goto out_iput; } - buf = kmem_alloc(sizeof(*buf), KM_SLEEP); + dic = &ip->i_d; - if (dip == NULL) { - /* We're not being passed a pointer to a dinode. This happens - * if BULKSTAT_FG_IGET is selected. Do the iget. - */ - error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, bno); - if (error) { - *stat = BULKSTAT_RV_NOTHING; - return error; - } - ASSERT(ip != NULL); - ASSERT(ip->i_blkno != (xfs_daddr_t)0); - if (ip->i_d.di_mode == 0) { - xfs_iput_new(ip, XFS_ILOCK_SHARED); - *stat = BULKSTAT_RV_NOTHING; - kmem_free(buf, sizeof(*buf)); - return XFS_ERROR(ENOENT); - } - dic = &ip->i_d; - arch = ARCH_NOCONVERT; /* in-core! */ - ASSERT(dic != NULL); + /* xfs_iget returns the following without needing + * further change. + */ + buf->bs_nlink = dic->di_nlink; + buf->bs_projid = dic->di_projid; + buf->bs_ino = ino; + buf->bs_mode = dic->di_mode; + buf->bs_uid = dic->di_uid; + buf->bs_gid = dic->di_gid; + buf->bs_size = dic->di_size; + buf->bs_atime.tv_sec = dic->di_atime.t_sec; + buf->bs_atime.tv_nsec = dic->di_atime.t_nsec; + buf->bs_mtime.tv_sec = dic->di_mtime.t_sec; + buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec; + buf->bs_ctime.tv_sec = dic->di_ctime.t_sec; + buf->bs_ctime.tv_nsec = dic->di_ctime.t_nsec; + buf->bs_xflags = xfs_ip2xflags(ip); + buf->bs_extsize = dic->di_extsize << mp->m_sb.sb_blocklog; + buf->bs_extents = dic->di_nextents; + buf->bs_gen = dic->di_gen; + memset(buf->bs_pad, 0, sizeof(buf->bs_pad)); + buf->bs_dmevmask = dic->di_dmevmask; + buf->bs_dmstate = dic->di_dmstate; + buf->bs_aextents = dic->di_anextents; - /* xfs_iget returns the following without needing - * further change. - */ - buf->bs_nlink = dic->di_nlink; - buf->bs_projid = dic->di_projid; + switch (dic->di_format) { + case XFS_DINODE_FMT_DEV: + buf->bs_rdev = ip->i_df.if_u2.if_rdev; + buf->bs_blksize = BLKDEV_IOSIZE; + buf->bs_blocks = 0; + break; + case XFS_DINODE_FMT_LOCAL: + case XFS_DINODE_FMT_UUID: + buf->bs_rdev = 0; + buf->bs_blksize = mp->m_sb.sb_blocksize; + buf->bs_blocks = 0; + break; + case XFS_DINODE_FMT_EXTENTS: + case XFS_DINODE_FMT_BTREE: + buf->bs_rdev = 0; + buf->bs_blksize = mp->m_sb.sb_blocksize; + buf->bs_blocks = dic->di_nblocks + ip->i_delayed_blks; + break; + } - } else { - dic = &dip->di_core; - ASSERT(dic != NULL); + out_iput: + xfs_iput(ip, XFS_ILOCK_SHARED); + return error; +} - /* buffer dinode_core is in on-disk arch */ - arch = ARCH_CONVERT; +STATIC int +xfs_bulkstat_one_dinode( + xfs_mount_t *mp, /* mount point for filesystem */ + xfs_ino_t ino, /* inode number to get data for */ + xfs_dinode_t *dip, /* dinode inode pointer */ + xfs_bstat_t *buf) /* return buffer */ +{ + xfs_dinode_core_t *dic; /* dinode core info pointer */ - /* - * The inode format changed when we moved the link count and - * made it 32 bits long. If this is an old format inode, - * convert it in memory to look like a new one. If it gets - * flushed to disk we will convert back before flushing or - * logging it. We zero out the new projid field and the old link - * count field. We'll handle clearing the pad field (the remains - * of the old uuid field) when we actually convert the inode to - * the new format. We don't change the version number so that we - * can distinguish this from a real new format inode. - */ - if (INT_GET(dic->di_version, arch) == XFS_DINODE_VERSION_1) { - buf->bs_nlink = INT_GET(dic->di_onlink, arch); - buf->bs_projid = 0; - } - else { - buf->bs_nlink = INT_GET(dic->di_nlink, arch); - buf->bs_projid = INT_GET(dic->di_projid, arch); - } + dic = &dip->di_core; + /* + * The inode format changed when we moved the link count and + * made it 32 bits long. If this is an old format inode, + * convert it in memory to look like a new one. If it gets + * flushed to disk we will convert back before flushing or + * logging it. We zero out the new projid field and the old link + * count field. We'll handle clearing the pad field (the remains + * of the old uuid field) when we actually convert the inode to + * the new format. We don't change the version number so that we + * can distinguish this from a real new format inode. + */ + if (INT_GET(dic->di_version, ARCH_CONVERT) == XFS_DINODE_VERSION_1) { + buf->bs_nlink = INT_GET(dic->di_onlink, ARCH_CONVERT); + buf->bs_projid = 0; + } else { + buf->bs_nlink = INT_GET(dic->di_nlink, ARCH_CONVERT); + buf->bs_projid = INT_GET(dic->di_projid, ARCH_CONVERT); } buf->bs_ino = ino; - buf->bs_mode = INT_GET(dic->di_mode, arch); - buf->bs_uid = INT_GET(dic->di_uid, arch); - buf->bs_gid = INT_GET(dic->di_gid, arch); - buf->bs_size = INT_GET(dic->di_size, arch); - buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, arch); - buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, arch); - buf->bs_mtime.tv_sec = INT_GET(dic->di_mtime.t_sec, arch); - buf->bs_mtime.tv_nsec = INT_GET(dic->di_mtime.t_nsec, arch); - buf->bs_ctime.tv_sec = INT_GET(dic->di_ctime.t_sec, arch); - buf->bs_ctime.tv_nsec = INT_GET(dic->di_ctime.t_nsec, arch); - buf->bs_xflags = xfs_dic2xflags(dic, arch); - buf->bs_extsize = INT_GET(dic->di_extsize, arch) << mp->m_sb.sb_blocklog; - buf->bs_extents = INT_GET(dic->di_nextents, arch); - buf->bs_gen = INT_GET(dic->di_gen, arch); + buf->bs_mode = INT_GET(dic->di_mode, ARCH_CONVERT); + buf->bs_uid = INT_GET(dic->di_uid, ARCH_CONVERT); + buf->bs_gid = INT_GET(dic->di_gid, ARCH_CONVERT); + buf->bs_size = INT_GET(dic->di_size, ARCH_CONVERT); + buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, ARCH_CONVERT); + buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, ARCH_CONVERT); + buf->bs_mtime.tv_sec = INT_GET(dic->di_mtime.t_sec, ARCH_CONVERT); + buf->bs_mtime.tv_nsec = INT_GET(dic->di_mtime.t_nsec, ARCH_CONVERT); + buf->bs_ctime.tv_sec = INT_GET(dic->di_ctime.t_sec, ARCH_CONVERT); + buf->bs_ctime.tv_nsec = INT_GET(dic->di_ctime.t_nsec, ARCH_CONVERT); + buf->bs_xflags = xfs_dic2xflags(dic); + buf->bs_extsize = INT_GET(dic->di_extsize, ARCH_CONVERT) << mp->m_sb.sb_blocklog; + buf->bs_extents = INT_GET(dic->di_nextents, ARCH_CONVERT); + buf->bs_gen = INT_GET(dic->di_gen, ARCH_CONVERT); memset(buf->bs_pad, 0, sizeof(buf->bs_pad)); - buf->bs_dmevmask = INT_GET(dic->di_dmevmask, arch); - buf->bs_dmstate = INT_GET(dic->di_dmstate, arch); - buf->bs_aextents = INT_GET(dic->di_anextents, arch); + buf->bs_dmevmask = INT_GET(dic->di_dmevmask, ARCH_CONVERT); + buf->bs_dmstate = INT_GET(dic->di_dmstate, ARCH_CONVERT); + buf->bs_aextents = INT_GET(dic->di_anextents, ARCH_CONVERT); - switch (INT_GET(dic->di_format, arch)) { + switch (INT_GET(dic->di_format, ARCH_CONVERT)) { case XFS_DINODE_FMT_DEV: - if ( ip ) { - buf->bs_rdev = ip->i_df.if_u2.if_rdev; - } else { - buf->bs_rdev = INT_GET(dip->di_u.di_dev, arch); - } - + buf->bs_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT); buf->bs_blksize = BLKDEV_IOSIZE; buf->bs_blocks = 0; break; @@ -195,29 +204,72 @@ case XFS_DINODE_FMT_BTREE: buf->bs_rdev = 0; buf->bs_blksize = mp->m_sb.sb_blocksize; - if ( ip ) { - buf->bs_blocks = INT_GET(dic->di_nblocks, arch) + ip->i_delayed_blks; - } else { - buf->bs_blocks = INT_GET(dic->di_nblocks, arch); - } + buf->bs_blocks = INT_GET(dic->di_nblocks, ARCH_CONVERT); break; } - if (ip) { - xfs_iput(ip, XFS_ILOCK_SHARED); + return 0; +} + +/* + * Return stat information for one inode. + * Return 0 if ok, else errno. + */ +int /* error status */ +xfs_bulkstat_one( + xfs_mount_t *mp, /* mount point for filesystem */ + xfs_ino_t ino, /* inode number to get data for */ + void __user *buffer, /* buffer to place output in */ + int ubsize, /* size of buffer */ + void *private_data, /* my private data */ + xfs_daddr_t bno, /* starting bno of inode cluster */ + int *ubused, /* bytes used by me */ + void *dibuff, /* on-disk inode buffer */ + int *stat) /* BULKSTAT_RV_... */ +{ + xfs_bstat_t *buf; /* return buffer */ + int error = 0; /* error value */ + xfs_dinode_t *dip; /* dinode inode pointer */ + + dip = (xfs_dinode_t *)dibuff; + + if (!buffer || ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || + (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && + (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))) { + *stat = BULKSTAT_RV_NOTHING; + return XFS_ERROR(EINVAL); + } + if (ubsize < sizeof(*buf)) { + *stat = BULKSTAT_RV_NOTHING; + return XFS_ERROR(ENOMEM); + } + + buf = kmem_alloc(sizeof(*buf), KM_SLEEP); + + if (dip == NULL) { + /* We're not being passed a pointer to a dinode. This happens + * if BULKSTAT_FG_IGET is selected. Do the iget. + */ + error = xfs_bulkstat_one_iget(mp, ino, bno, buf, stat); + if (error) + goto out_free; + } else { + xfs_bulkstat_one_dinode(mp, ino, dip, buf); } if (copy_to_user(buffer, buf, sizeof(*buf))) { - kmem_free(buf, sizeof(*buf)); *stat = BULKSTAT_RV_NOTHING; - return EFAULT; + error = EFAULT; + goto out_free; } - kmem_free(buf, sizeof(*buf)); *stat = BULKSTAT_RV_DIDONE; if (ubused) *ubused = sizeof(*buf); - return 0; + + out_free: + kmem_free(buf, sizeof(*buf)); + return error; } /* @@ -352,7 +404,7 @@ tmp && /* lookup succeeded */ /* got the record, should always work */ !(error = xfs_inobt_get_rec(cur, &gino, &gcnt, - &gfree, &i, ARCH_NOCONVERT)) && + &gfree, &i)) && i == 1 && /* this is the right chunk */ agino < gino + XFS_INODES_PER_CHUNK && @@ -421,7 +473,7 @@ */ if (error || (error = xfs_inobt_get_rec(cur, &gino, &gcnt, - &gfree, &i, ARCH_NOCONVERT)) || + &gfree, &i)) || i == 0) { end_of_ag = 1; break; @@ -744,7 +796,7 @@ } } if ((error = xfs_inobt_get_rec(cur, &gino, &gcnt, &gfree, - &i, ARCH_NOCONVERT)) || + &i)) || i == 0) { xfs_buf_relse(agbp); agbp = NULL; diff -Nru a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c --- a/fs/xfs/xfs_log.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_log.c 2005-03-20 16:43:29 -08:00 @@ -175,8 +175,8 @@ (void *)((unsigned long)log->l_grant_write_bytes), (void *)((unsigned long)log->l_curr_cycle), (void *)((unsigned long)log->l_curr_block), - (void *)((unsigned long)CYCLE_LSN(log->l_tail_lsn, ARCH_NOCONVERT)), - (void *)((unsigned long)BLOCK_LSN(log->l_tail_lsn, ARCH_NOCONVERT)), + (void *)((unsigned long)CYCLE_LSN(log->l_tail_lsn)), + (void *)((unsigned long)BLOCK_LSN(log->l_tail_lsn)), (void *)string, (void *)((unsigned long)13), (void *)((unsigned long)14), @@ -890,8 +890,8 @@ int tail_bytes; int tail_cycle; - tail_bytes = BBTOB(BLOCK_LSN(log->l_tail_lsn, ARCH_NOCONVERT)); - tail_cycle = CYCLE_LSN(log->l_tail_lsn, ARCH_NOCONVERT); + tail_bytes = BBTOB(BLOCK_LSN(log->l_tail_lsn)); + tail_cycle = CYCLE_LSN(log->l_tail_lsn); if ((tail_cycle == cycle) && (bytes >= tail_bytes)) { free_bytes = log->l_logsize - (bytes - tail_bytes); } else if ((tail_cycle + 1) < cycle) { @@ -1164,7 +1164,7 @@ log->l_flags |= XLOG_ACTIVE_RECOVERY; log->l_prev_block = -1; - ASSIGN_ANY_LSN(log->l_tail_lsn, 1, 0, ARCH_NOCONVERT); + ASSIGN_ANY_LSN_HOST(log->l_tail_lsn, 1, 0); /* log->l_tail_lsn = 0x100000000LL; cycle = 1; current block = 0 */ log->l_last_sync_lsn = log->l_tail_lsn; log->l_curr_cycle = 1; /* 0 is bad since this is initial value */ @@ -1321,19 +1321,19 @@ free_threshold = MAX(free_threshold, (log->l_logBBsize >> 2)); free_threshold = MAX(free_threshold, 256); if (free_blocks < free_threshold) { - threshold_block = BLOCK_LSN(tail_lsn, ARCH_NOCONVERT) + free_threshold; - threshold_cycle = CYCLE_LSN(tail_lsn, ARCH_NOCONVERT); + threshold_block = BLOCK_LSN(tail_lsn) + free_threshold; + threshold_cycle = CYCLE_LSN(tail_lsn); if (threshold_block >= log->l_logBBsize) { threshold_block -= log->l_logBBsize; threshold_cycle += 1; } - ASSIGN_ANY_LSN(threshold_lsn, threshold_cycle, - threshold_block, ARCH_NOCONVERT); + ASSIGN_ANY_LSN_HOST(threshold_lsn, threshold_cycle, + threshold_block); /* Don't pass in an lsn greater than the lsn of the last * log record known to be on disk. */ - if (XFS_LSN_CMP_ARCH(threshold_lsn, log->l_last_sync_lsn, ARCH_NOCONVERT) > 0) + if (XFS_LSN_CMP(threshold_lsn, log->l_last_sync_lsn) > 0) threshold_lsn = log->l_last_sync_lsn; } GRANT_UNLOCK(log, s); @@ -1435,7 +1435,7 @@ bp = iclog->ic_bp; ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) == (unsigned long)1); XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)2); - XFS_BUF_SET_ADDR(bp, BLOCK_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT)); + XFS_BUF_SET_ADDR(bp, BLOCK_LSN(INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT))); XFS_STATS_ADD(xs_log_blocks, BTOBB(count)); @@ -1728,9 +1728,9 @@ logop_head = (xlog_op_header_t *)ptr; INT_SET(logop_head->oh_tid, ARCH_CONVERT, ticket->t_tid); logop_head->oh_clientid = ticket->t_clientid; - INT_ZERO(logop_head->oh_len, ARCH_CONVERT); + logop_head->oh_len = 0; logop_head->oh_flags = XLOG_START_TRANS; - INT_ZERO(logop_head->oh_res2, ARCH_CONVERT); + logop_head->oh_res2 = 0; ticket->t_flags &= ~XLOG_TIC_INITED; /* clear bit */ record_cnt++; @@ -1742,7 +1742,7 @@ logop_head = (xlog_op_header_t *)ptr; INT_SET(logop_head->oh_tid, ARCH_CONVERT, ticket->t_tid); logop_head->oh_clientid = ticket->t_clientid; - INT_ZERO(logop_head->oh_res2, ARCH_CONVERT); + logop_head->oh_res2 = 0; /* header copied directly */ xlog_write_adv_cnt(ptr, len, log_offset, sizeof(xlog_op_header_t)); @@ -1888,10 +1888,10 @@ */ changed = 2; } - INT_ZERO(iclog->ic_header.h_num_logops, ARCH_CONVERT); + iclog->ic_header.h_num_logops = 0; memset(iclog->ic_header.h_cycle_data, 0, sizeof(iclog->ic_header.h_cycle_data)); - INT_ZERO(iclog->ic_header.h_lsn, ARCH_CONVERT); + iclog->ic_header.h_lsn = 0; } else if (iclog->ic_state == XLOG_STATE_ACTIVE) /* do nothing */; else @@ -1948,7 +1948,7 @@ if (!(lsn_log->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_DIRTY))) { lsn = INT_GET(lsn_log->ic_header.h_lsn, ARCH_CONVERT); if ((lsn && !lowest_lsn) || - (XFS_LSN_CMP_ARCH(lsn, lowest_lsn, ARCH_NOCONVERT) < 0)) { + (XFS_LSN_CMP(lsn, lowest_lsn) < 0)) { lowest_lsn = lsn; } } @@ -2049,10 +2049,9 @@ lowest_lsn = xlog_get_lowest_lsn(log); if (lowest_lsn && ( - XFS_LSN_CMP_ARCH( + XFS_LSN_CMP( lowest_lsn, - INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT), - ARCH_NOCONVERT + INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT) )<0)) { iclog = iclog->ic_next; continue; /* Leave this iclog for @@ -2068,10 +2067,9 @@ * No one else can be here except us. */ s = GRANT_LOCK(log); - ASSERT(XFS_LSN_CMP_ARCH( + ASSERT(XFS_LSN_CMP( log->l_last_sync_lsn, - INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT), - ARCH_NOCONVERT + INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT) )<=0); log->l_last_sync_lsn = INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT); GRANT_UNLOCK(log, s); @@ -2285,7 +2283,7 @@ if (log_offset == 0) { ticket->t_curr_res -= log->l_iclog_hsize; INT_SET(head->h_cycle, ARCH_CONVERT, log->l_curr_cycle); - ASSIGN_LSN(head->h_lsn, log, ARCH_CONVERT); + ASSIGN_LSN(head->h_lsn, log); ASSERT(log->l_curr_block >= 0); } @@ -2427,9 +2425,9 @@ * Otherwise, make sure that the cycles differ by exactly one and * check the byte count. */ - if (CYCLE_LSN(tail_lsn, ARCH_NOCONVERT) != log->l_grant_write_cycle) { - ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn, ARCH_NOCONVERT)); - ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn, ARCH_NOCONVERT))); + if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) { + ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn)); + ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); } #endif xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit"); @@ -2560,9 +2558,9 @@ XLOG_GRANT_ADD_SPACE(log, need_bytes, 'w'); /* we've got enough space */ #ifdef DEBUG tail_lsn = log->l_tail_lsn; - if (CYCLE_LSN(tail_lsn, ARCH_NOCONVERT) != log->l_grant_write_cycle) { - ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn, ARCH_NOCONVERT)); - ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn, ARCH_NOCONVERT))); + if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) { + ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn)); + ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); } #endif @@ -3269,18 +3267,18 @@ { int blocks; - if (CYCLE_LSN(tail_lsn, ARCH_NOCONVERT) == log->l_prev_cycle) { + if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) { blocks = - log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn, ARCH_NOCONVERT)); + log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn)); if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize)) xlog_panic("xlog_verify_tail_lsn: ran out of log space"); } else { - ASSERT(CYCLE_LSN(tail_lsn, ARCH_NOCONVERT)+1 == log->l_prev_cycle); + ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle); - if (BLOCK_LSN(tail_lsn, ARCH_NOCONVERT) == log->l_prev_block) + if (BLOCK_LSN(tail_lsn) == log->l_prev_block) xlog_panic("xlog_verify_tail_lsn: tail wrapped"); - blocks = BLOCK_LSN(tail_lsn, ARCH_NOCONVERT) - log->l_prev_block; + blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block; if (blocks < BTOBB(iclog->ic_offset) + 1) xlog_panic("xlog_verify_tail_lsn: ran out of log space"); } diff -Nru a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h --- a/fs/xfs/xfs_log.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_log.h 2005-03-20 16:43:29 -08:00 @@ -32,20 +32,12 @@ #ifndef __XFS_LOG_H__ #define __XFS_LOG_H__ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define LSN_FIELD_CYCLE(arch) (((arch)==ARCH_NOCONVERT)?1:0) -#define LSN_FIELD_BLOCK(arch) (((arch)==ARCH_NOCONVERT)?0:1) -#else -#define LSN_FIELD_CYCLE(arch) (0) -#define LSN_FIELD_BLOCK(arch) (1) -#endif - /* get lsn fields */ -#define CYCLE_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)], arch)) -#define BLOCK_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch)) +#define CYCLE_LSN(lsn) ((uint)((lsn)>>32)) +#define BLOCK_LSN(lsn) ((uint)(lsn)) /* this is used in a spot where we might otherwise double-endian-flip */ -#define CYCLE_LSN_NOCONV(lsn,arch) (((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)]) +#define CYCLE_LSN_DISK(lsn) (((uint *)&(lsn))[0]) #ifdef __KERNEL__ /* @@ -58,21 +50,18 @@ #else __inline__ #endif -xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch) +xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2) { - if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch)) - return (CYCLE_LSN(lsn1, arch)l_curr_cycle,(log)->l_curr_block,arch); +#define ASSIGN_ANY_LSN_DISK(lsn,cycle,block) \ + { \ + INT_SET(((uint *)&(lsn))[0], ARCH_CONVERT, (cycle)); \ + INT_SET(((uint *)&(lsn))[1], ARCH_CONVERT, (block)); \ + } +#define ASSIGN_LSN(lsn,log) \ + ASSIGN_ANY_LSN_DISK(lsn,(log)->l_curr_cycle,(log)->l_curr_block); #define XLOG_SET(f,b) (((f) & (b)) == (b)) diff -Nru a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c --- a/fs/xfs/xfs_log_recover.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_log_recover.c 2005-03-20 16:43:29 -08:00 @@ -873,7 +873,7 @@ /* find blk_no of tail of log */ rhead = (xlog_rec_header_t *)offset; - *tail_blk = BLOCK_LSN(rhead->h_tail_lsn, ARCH_CONVERT); + *tail_blk = BLOCK_LSN(INT_GET(rhead->h_tail_lsn, ARCH_CONVERT)); /* * Reset log values according to the state of the log when we @@ -940,10 +940,10 @@ * log records will point recovery to after the * current unmount record. */ - ASSIGN_ANY_LSN(log->l_tail_lsn, log->l_curr_cycle, - after_umount_blk, ARCH_NOCONVERT); - ASSIGN_ANY_LSN(log->l_last_sync_lsn, log->l_curr_cycle, - after_umount_blk, ARCH_NOCONVERT); + ASSIGN_ANY_LSN_HOST(log->l_tail_lsn, log->l_curr_cycle, + after_umount_blk); + ASSIGN_ANY_LSN_HOST(log->l_last_sync_lsn, log->l_curr_cycle, + after_umount_blk); *tail_blk = after_umount_blk; } } @@ -1110,8 +1110,8 @@ INT_SET(recp->h_cycle, ARCH_CONVERT, cycle); INT_SET(recp->h_version, ARCH_CONVERT, XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? 2 : 1); - ASSIGN_ANY_LSN(recp->h_lsn, cycle, block, ARCH_CONVERT); - ASSIGN_ANY_LSN(recp->h_tail_lsn, tail_cycle, tail_block, ARCH_CONVERT); + ASSIGN_ANY_LSN_DISK(recp->h_lsn, cycle, block); + ASSIGN_ANY_LSN_DISK(recp->h_tail_lsn, tail_cycle, tail_block); INT_SET(recp->h_fmt, ARCH_CONVERT, XLOG_FMT); memcpy(&recp->h_fs_uuid, &log->l_mp->m_sb.sb_uuid, sizeof(uuid_t)); } @@ -1217,8 +1217,8 @@ int distance; int error; - tail_cycle = CYCLE_LSN(tail_lsn, ARCH_NOCONVERT); - tail_block = BLOCK_LSN(tail_lsn, ARCH_NOCONVERT); + tail_cycle = CYCLE_LSN(tail_lsn); + tail_block = BLOCK_LSN(tail_lsn); head_cycle = log->l_curr_cycle; head_block = log->l_curr_block; @@ -2047,11 +2047,11 @@ errs++; } - if (! errs && !INT_ISZERO(ddq->d_id, ARCH_CONVERT)) { + if (!errs && ddq->d_id) { if (INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT) && INT_GET(ddq->d_bcount, ARCH_CONVERT) >= INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT)) { - if (INT_ISZERO(ddq->d_btimer, ARCH_CONVERT)) { + if (!ddq->d_btimer) { if (flags & XFS_QMOPT_DOWARN) cmn_err(CE_ALERT, "%s : Dquot ID 0x%x (0x%p) " @@ -2064,7 +2064,7 @@ if (INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT) && INT_GET(ddq->d_icount, ARCH_CONVERT) >= INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT)) { - if (INT_ISZERO(ddq->d_itimer, ARCH_CONVERT)) { + if (!ddq->d_itimer) { if (flags & XFS_QMOPT_DOWARN) cmn_err(CE_ALERT, "%s : Dquot ID 0x%x (0x%p) " @@ -2077,7 +2077,7 @@ if (INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT) && INT_GET(ddq->d_rtbcount, ARCH_CONVERT) >= INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT)) { - if (INT_ISZERO(ddq->d_rtbtimer, ARCH_CONVERT)) { + if (!ddq->d_rtbtimer) { if (flags & XFS_QMOPT_DOWARN) cmn_err(CE_ALERT, "%s : Dquot ID 0x%x (0x%p) " @@ -2452,8 +2452,8 @@ /* The core is in in-core format */ xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, - (xfs_dinode_core_t*)item->ri_buf[1].i_addr, - -1, ARCH_CONVERT); + (xfs_dinode_core_t*)item->ri_buf[1].i_addr, -1); + /* the rest is in on-disk format */ if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { memcpy((xfs_caddr_t) dip + sizeof(xfs_dinode_core_t), @@ -3395,7 +3395,7 @@ xlog_pack_data_checksum(log, iclog, size); - cycle_lsn = CYCLE_LSN_NOCONV(iclog->ic_header.h_lsn, ARCH_CONVERT); + cycle_lsn = CYCLE_LSN_DISK(iclog->ic_header.h_lsn); dp = iclog->ic_datap; for (i = 0; i < BTOBB(size) && @@ -3438,7 +3438,7 @@ up++; } if (chksum != INT_GET(rhead->h_chksum, ARCH_CONVERT)) { - if (!INT_ISZERO(rhead->h_chksum, ARCH_CONVERT) || + if (rhead->h_chksum || ((log->l_flags & XLOG_CHKSUM_MISMATCH) == 0)) { cmn_err(CE_DEBUG, "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)", @@ -3501,7 +3501,7 @@ return XFS_ERROR(EFSCORRUPTED); } if (unlikely( - (INT_ISZERO(rhead->h_version, ARCH_CONVERT) || + (!rhead->h_version || (INT_GET(rhead->h_version, ARCH_CONVERT) & (~XLOG_VERSION_OKBITS)) != 0))) { xlog_warn("XFS: %s: unrecognised log version (%d).", @@ -3894,7 +3894,7 @@ /* Convert superblock from on-disk format */ sbp = &log->l_mp->m_sb; - xfs_xlatesb(XFS_BUF_TO_SBP(bp), sbp, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + xfs_xlatesb(XFS_BUF_TO_SBP(bp), sbp, 1, XFS_SB_ALL_BITS); ASSERT(sbp->sb_magicnum == XFS_SB_MAGIC); ASSERT(XFS_SB_GOOD_VERSION(sbp)); xfs_buf_relse(bp); @@ -4073,7 +4073,7 @@ sbbp = xfs_getsb(mp, 0); #ifdef XFS_LOUD_RECOVERY sbp = &mp->m_sb; - xfs_xlatesb(XFS_BUF_TO_SBP(sbbp), sbp, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + xfs_xlatesb(XFS_BUF_TO_SBP(sbbp), sbp, 1, XFS_SB_ALL_BITS); cmn_err(CE_NOTE, "xlog_recover_check_summary: sb_icount %Lu itotal %Lu", sbp->sb_icount, itotal); diff -Nru a/fs/xfs/xfs_macros.c b/fs/xfs/xfs_macros.c --- a/fs/xfs/xfs_macros.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_macros.c 2005-03-20 16:43:29 -08:00 @@ -705,9 +705,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_ASIZE) int -xfs_cfork_asize_arch(xfs_dinode_core_t *dcp, xfs_mount_t *mp, xfs_arch_t arch) +xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, xfs_mount_t *mp) { - return XFS_CFORK_ASIZE_ARCH(dcp, mp, arch); + return XFS_CFORK_ASIZE_DISK(dcp, mp); } int xfs_cfork_asize(xfs_dinode_core_t *dcp, xfs_mount_t *mp) @@ -718,9 +718,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_BOFF) int -xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch) +xfs_cfork_boff_disk(xfs_dinode_core_t *dcp) { - return XFS_CFORK_BOFF_ARCH(dcp, arch); + return XFS_CFORK_BOFF_DISK(dcp); } int xfs_cfork_boff(xfs_dinode_core_t *dcp) @@ -731,9 +731,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_DSIZE) int -xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, xfs_mount_t *mp, xfs_arch_t arch) +xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, xfs_mount_t *mp) { - return XFS_CFORK_DSIZE_ARCH(dcp, mp, arch); + return XFS_CFORK_DSIZE_DISK(dcp, mp); } int xfs_cfork_dsize(xfs_dinode_core_t *dcp, xfs_mount_t *mp) @@ -744,11 +744,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_FMT_SET) void -xfs_cfork_fmt_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch) -{ - XFS_CFORK_FMT_SET_ARCH(dcp, w, n, arch); -} -void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n) { XFS_CFORK_FMT_SET(dcp, w, n); @@ -757,11 +752,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_FORMAT) int -xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch) -{ - return XFS_CFORK_FORMAT_ARCH(dcp, w, arch); -} -int xfs_cfork_format(xfs_dinode_core_t *dcp, int w) { return XFS_CFORK_FORMAT(dcp, w); @@ -770,11 +760,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_NEXT_SET) void -xfs_cfork_next_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch) -{ - XFS_CFORK_NEXT_SET_ARCH(dcp, w, n, arch); -} -void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n) { XFS_CFORK_NEXT_SET(dcp, w, n); @@ -783,9 +768,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_NEXTENTS) int -xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch) +xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w) { - return XFS_CFORK_NEXTENTS_ARCH(dcp, w, arch); + return XFS_CFORK_NEXTENTS_DISK(dcp, w); } int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w) @@ -796,9 +781,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_Q) int -xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch) +xfs_cfork_q_disk(xfs_dinode_core_t *dcp) { - return XFS_CFORK_Q_ARCH(dcp, arch); + return XFS_CFORK_Q_DISK(dcp); } int xfs_cfork_q(xfs_dinode_core_t *dcp) @@ -809,9 +794,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_CFORK_SIZE) int -xfs_cfork_size_arch(xfs_dinode_core_t *dcp, xfs_mount_t *mp, int w, xfs_arch_t arch) +xfs_cfork_size_disk(xfs_dinode_core_t *dcp, xfs_mount_t *mp, int w) { - return XFS_CFORK_SIZE_ARCH(dcp, mp, w, arch); + return XFS_CFORK_SIZE_DISK(dcp, mp, w); } int xfs_cfork_size(xfs_dinode_core_t *dcp, xfs_mount_t *mp, int w) @@ -896,11 +881,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_APTR) char * -xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch) -{ - return XFS_DFORK_APTR_ARCH(dip, arch); -} -char * xfs_dfork_aptr(xfs_dinode_t *dip) { return XFS_DFORK_APTR(dip); @@ -909,11 +889,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_ASIZE) int -xfs_dfork_asize_arch(xfs_dinode_t *dip, xfs_mount_t *mp, xfs_arch_t arch) -{ - return XFS_DFORK_ASIZE_ARCH(dip, mp, arch); -} -int xfs_dfork_asize(xfs_dinode_t *dip, xfs_mount_t *mp) { return XFS_DFORK_ASIZE(dip, mp); @@ -922,11 +897,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_BOFF) int -xfs_dfork_boff_arch(xfs_dinode_t *dip, xfs_arch_t arch) -{ - return XFS_DFORK_BOFF_ARCH(dip, arch); -} -int xfs_dfork_boff(xfs_dinode_t *dip) { return XFS_DFORK_BOFF(dip); @@ -935,11 +905,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_DPTR) char * -xfs_dfork_dptr_arch(xfs_dinode_t *dip, xfs_arch_t arch) -{ - return XFS_DFORK_DPTR_ARCH(dip, arch); -} -char * xfs_dfork_dptr(xfs_dinode_t *dip) { return XFS_DFORK_DPTR(dip); @@ -948,63 +913,14 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_DSIZE) int -xfs_dfork_dsize_arch(xfs_dinode_t *dip, xfs_mount_t *mp, xfs_arch_t arch) -{ - return XFS_DFORK_DSIZE_ARCH(dip, mp, arch); -} -int xfs_dfork_dsize(xfs_dinode_t *dip, xfs_mount_t *mp) { return XFS_DFORK_DSIZE(dip, mp); } #endif -#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_FMT_SET) -void -xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch) -{ - XFS_DFORK_FMT_SET_ARCH(dip, w, n, arch); -} -void -xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n) -{ - XFS_DFORK_FMT_SET(dip, w, n); -} -#endif - -#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_FORMAT) -int -xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch) -{ - return XFS_DFORK_FORMAT_ARCH(dip, w, arch); -} -int -xfs_dfork_format(xfs_dinode_t *dip, int w) -{ - return XFS_DFORK_FORMAT(dip, w); -} -#endif - -#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_NEXT_SET) -void -xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch) -{ - XFS_DFORK_NEXT_SET_ARCH(dip, w, n, arch); -} -void -xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n) -{ - XFS_DFORK_NEXT_SET(dip, w, n); -} -#endif - #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_NEXTENTS) int -xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch) -{ - return XFS_DFORK_NEXTENTS_ARCH(dip, w, arch); -} -int xfs_dfork_nextents(xfs_dinode_t *dip, int w) { return XFS_DFORK_NEXTENTS(dip, w); @@ -1013,11 +929,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_PTR) char * -xfs_dfork_ptr_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch) -{ - return XFS_DFORK_PTR_ARCH(dip, w, arch); -} -char * xfs_dfork_ptr(xfs_dinode_t *dip, int w) { return XFS_DFORK_PTR(dip, w); @@ -1026,11 +937,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_Q) int -xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch) -{ - return XFS_DFORK_Q_ARCH(dip, arch); -} -int xfs_dfork_q(xfs_dinode_t *dip) { return XFS_DFORK_Q(dip); @@ -1039,11 +945,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DFORK_SIZE) int -xfs_dfork_size_arch(xfs_dinode_t *dip, xfs_mount_t *mp, int w, xfs_arch_t arch) -{ - return XFS_DFORK_SIZE_ARCH(dip, mp, w, arch); -} -int xfs_dfork_size(xfs_dinode_t *dip, xfs_mount_t *mp, int w) { return XFS_DFORK_SIZE(dip, mp, w); @@ -1108,11 +1009,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR_SF_GET_DIRINO) void -xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch) -{ - XFS_DIR_SF_GET_DIRINO_ARCH(from, to, arch); -} -void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to) { XFS_DIR_SF_GET_DIRINO(from, to); @@ -1129,11 +1025,6 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR_SF_PUT_DIRINO) void -xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch) -{ - XFS_DIR_SF_PUT_DIRINO_ARCH(from, to, arch); -} -void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to) { XFS_DIR_SF_PUT_DIRINO(from, to); @@ -1142,9 +1033,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_BLOCK_LEAF_P) xfs_dir2_leaf_entry_t * -xfs_dir2_block_leaf_p_arch(xfs_dir2_block_tail_t *btp, xfs_arch_t arch) +xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp) { - return XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch); + return XFS_DIR2_BLOCK_LEAF_P(btp); } #endif @@ -1223,9 +1114,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P) xfs_dir2_data_off_t * -xfs_dir2_data_unused_tag_p_arch(xfs_dir2_data_unused_t *dup, xfs_arch_t arch) +xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup) { - return XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch); + return XFS_DIR2_DATA_UNUSED_TAG_P(dup); } #endif @@ -1298,9 +1189,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_LEAF_BESTS_P) xfs_dir2_data_off_t * -xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch) +xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp) { - return XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, arch); + return XFS_DIR2_LEAF_BESTS_P(ltp); } #endif @@ -1346,17 +1237,17 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_SF_GET_INUMBER) xfs_intino_t -xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from, xfs_arch_t arch) +xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from) { - return XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch); + return XFS_DIR2_SF_GET_INUMBER(sfp, from); } #endif #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_SF_GET_OFFSET) xfs_dir2_data_aoff_t -xfs_dir2_sf_get_offset_arch(xfs_dir2_sf_entry_t *sfep, xfs_arch_t arch) +xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep) { - return XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, arch); + return XFS_DIR2_SF_GET_OFFSET(sfep); } #endif @@ -1386,17 +1277,17 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_SF_PUT_INUMBER) void -xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from, xfs_dir2_inou_t *to, xfs_arch_t arch) +xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from, xfs_dir2_inou_t *to) { - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, from, to, arch); + XFS_DIR2_SF_PUT_INUMBER(sfp, from, to); } #endif #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_DIR2_SF_PUT_OFFSET) void -xfs_dir2_sf_put_offset_arch(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off, xfs_arch_t arch) +xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off) { - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, off, arch); + XFS_DIR2_SF_PUT_OFFSET(sfep, off); } #endif @@ -1755,17 +1646,17 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_CLR_FREE) void -xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch) +xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i) { - XFS_INOBT_CLR_FREE(rp, i, arch); + XFS_INOBT_CLR_FREE(rp, i); } #endif #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_IS_FREE) int -xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch) +xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i) { - return XFS_INOBT_IS_FREE(rp, i, arch); + return XFS_INOBT_IS_FREE(rp, i); } #endif @@ -1821,9 +1712,9 @@ #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_SET_FREE) void -xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch) +xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i) { - XFS_INOBT_SET_FREE(rp, i, arch); + XFS_INOBT_SET_FREE(rp, i); } #endif diff -Nru a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c --- a/fs/xfs/xfs_mount.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_mount.c 2005-03-20 16:43:29 -08:00 @@ -65,8 +65,6 @@ STATIC int xfs_uuid_mount(xfs_mount_t *); STATIC void xfs_uuid_unmount(xfs_mount_t *mp); -void xfs_xlatesb(void *, xfs_sb_t *, int, xfs_arch_t, __int64_t); - static struct { short offset; short type; /* 0 = integer @@ -387,7 +385,6 @@ * sb - a superblock * dir - conversion direction: <0 - convert sb to buf * >0 - convert buf to sb - * arch - architecture to read/write from/to buf * fields - which fields to copy (bitmask) */ void @@ -395,7 +392,6 @@ void *data, xfs_sb_t *sb, int dir, - xfs_arch_t arch, __int64_t fields) { xfs_caddr_t buf_ptr; @@ -420,9 +416,7 @@ ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1); - if (arch == ARCH_NOCONVERT || - size == 1 || - xfs_sb_info[f].type == 1) { + if (size == 1 || xfs_sb_info[f].type == 1) { if (dir > 0) { memcpy(mem_ptr + first, buf_ptr + first, size); } else { @@ -433,16 +427,16 @@ case 2: INT_XLATE(*(__uint16_t*)(buf_ptr+first), *(__uint16_t*)(mem_ptr+first), - dir, arch); + dir, ARCH_CONVERT); break; case 4: INT_XLATE(*(__uint32_t*)(buf_ptr+first), *(__uint32_t*)(mem_ptr+first), - dir, arch); + dir, ARCH_CONVERT); break; case 8: INT_XLATE(*(__uint64_t*)(buf_ptr+first), - *(__uint64_t*)(mem_ptr+first), dir, arch); + *(__uint64_t*)(mem_ptr+first), dir, ARCH_CONVERT); break; default: ASSERT(0); @@ -493,8 +487,7 @@ * But first do some basic consistency checking. */ sbp = XFS_BUF_TO_SBP(bp); - xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, - ARCH_CONVERT, XFS_SB_ALL_BITS); + xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, XFS_SB_ALL_BITS); error = xfs_mount_validate_sb(mp, &(mp->m_sb)); if (error) { @@ -1227,7 +1220,7 @@ /* translate/copy */ - xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), -1, ARCH_CONVERT, fields); + xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), -1, fields); /* find modified range */ diff -Nru a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h --- a/fs/xfs/xfs_mount.h 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_mount.h 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 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 * under the terms of version 2 of the GNU General Public License as @@ -418,6 +418,7 @@ #define XFS_MOUNT_IDELETE 0x00040000 /* delete empty inode clusters*/ #define XFS_MOUNT_SWALLOC 0x00080000 /* turn on stripe width * allocation */ +#define XFS_MOUNT_IHASHSIZE 0x00100000 /* inode hash table size */ /* * Default minimum read and write sizes. @@ -554,8 +555,7 @@ extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int); extern int xfs_syncsub(xfs_mount_t *, int, int, int *); extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t); -extern void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, - __int64_t); +extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t); extern struct vfsops xfs_vfsops; extern struct vnodeops xfs_vnodeops; diff -Nru a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c --- a/fs/xfs/xfs_vfsops.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_vfsops.c 2005-03-20 16:43:29 -08:00 @@ -1,7 +1,7 @@ /* * XFS filesystem operations. * - * Copyright (c) 2000-2004 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 * under the terms of version 2 of the GNU General Public License as @@ -258,11 +258,6 @@ mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP); strcpy(mp->m_fsname, ap->fsname); - /* - * Pull in the 'wsync' and 'ino64' mount options before we do the real - * work of mounting and recovery. The arg pointer will - * be NULL when we are being called from the root mount code. - */ if (ap->flags & XFSMNT_WSYNC) mp->m_flags |= XFS_MOUNT_WSYNC; #if XFS_BIG_INUMS @@ -302,6 +297,10 @@ mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE; mp->m_readio_log = mp->m_writeio_log = ap->iosizelog; } + + if (ap->flags & XFSMNT_IHASHSIZE) + mp->m_flags |= XFS_MOUNT_IHASHSIZE; + if (ap->flags & XFSMNT_IDELETE) mp->m_flags |= XFS_MOUNT_IDELETE; @@ -1742,6 +1741,7 @@ this_char); return EINVAL; } + args->flags |= XFSMNT_IHASHSIZE; args->ihashsize = simple_strtoul(value, &eov, 10); } else if (!strcmp(this_char, MNTOPT_WSYNC)) { args->flags |= XFSMNT_WSYNC; @@ -1869,6 +1869,9 @@ if (mp->m_flags & xfs_infop->flag) seq_puts(m, xfs_infop->str); } + + if (mp->m_flags & XFS_MOUNT_IHASHSIZE) + seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize); if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) seq_printf(m, "," MNTOPT_BIOSIZE "=%d", mp->m_writeio_log); diff -Nru a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c --- a/fs/xfs/xfs_vnodeops.c 2005-03-20 16:43:29 -08:00 +++ b/fs/xfs/xfs_vnodeops.c 2005-03-20 16:43:29 -08:00 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -248,7 +248,7 @@ /* * Convert di_flags to xflags. */ - vap->va_xflags = xfs_dic2xflags(&ip->i_d, ARCH_NOCONVERT); + vap->va_xflags = xfs_ip2xflags(ip); /* * Exit for inode revalidate. See if any of the rest of