diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-03 19:25:58 -0500 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-03 19:25:58 -0500 | 
| commit | 0f3278d14f0255e4cd9e07ccefc33ff12d8bb59c (patch) | |
| tree | 9bbb209cab841f700162a96e158dfa3ecd361f46 /fs/xfs/xfs_dir.c | |
| parent | 06024f217d607369f0ee0071034ebb03071d5fb2 (diff) | |
| parent | 15c84a470116b2a3b58a7353a6cf711c29a91854 (diff) | |
Merge git://oss.sgi.com:8090/oss/git/xfs-2.6
Diffstat (limited to 'fs/xfs/xfs_dir.c')
| -rw-r--r-- | fs/xfs/xfs_dir.c | 70 | 
1 files changed, 33 insertions, 37 deletions
diff --git a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c index ba30bc7682f2..3dd30391f551 100644 --- a/fs/xfs/xfs_dir.c +++ b/fs/xfs/xfs_dir.c  | |||
| @@ -1,59 +1,43 @@ | |||
| 1 | /* | 1 | /* | 
| 2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. | 
| 3 | * All Rights Reserved. | ||
| 3 | * | 4 | * | 
| 4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or | 
| 5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as | 
| 6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. | 
| 7 | * | 8 | * | 
| 8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, | 
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 12 | * GNU General Public License for more details. | ||
| 11 | * | 13 | * | 
| 12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License | 
| 13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, | 
| 14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 
| 15 | * otherwise, applies only to this software file. Patent licenses, if | ||
| 16 | * any, provided herein do not apply to combinations of this program with | ||
| 17 | * other software, or any other product whatsoever. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License along | ||
| 20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
| 21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
| 22 | * | ||
| 23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
| 24 | * Mountain View, CA 94043, or: | ||
| 25 | * | ||
| 26 | * http://www.sgi.com | ||
| 27 | * | ||
| 28 | * For further information regarding this notice, see: | ||
| 29 | * | ||
| 30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
| 31 | */ | 17 | */ | 
| 32 | |||
| 33 | #include "xfs.h" | 18 | #include "xfs.h" | 
| 34 | 19 | #include "xfs_fs.h" | |
| 35 | #include "xfs_macros.h" | ||
| 36 | #include "xfs_types.h" | 20 | #include "xfs_types.h" | 
| 37 | #include "xfs_inum.h" | ||
| 38 | #include "xfs_log.h" | 21 | #include "xfs_log.h" | 
| 22 | #include "xfs_inum.h" | ||
| 39 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" | 
| 40 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" | 
| 41 | #include "xfs_dir.h" | 25 | #include "xfs_dir.h" | 
| 42 | #include "xfs_dir2.h" | 26 | #include "xfs_dir2.h" | 
| 43 | #include "xfs_dmapi.h" | 27 | #include "xfs_dmapi.h" | 
| 44 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" | 
| 45 | #include "xfs_alloc_btree.h" | 29 | #include "xfs_da_btree.h" | 
| 46 | #include "xfs_bmap_btree.h" | 30 | #include "xfs_bmap_btree.h" | 
| 31 | #include "xfs_alloc_btree.h" | ||
| 47 | #include "xfs_ialloc_btree.h" | 32 | #include "xfs_ialloc_btree.h" | 
| 48 | #include "xfs_alloc.h" | 33 | #include "xfs_alloc.h" | 
| 49 | #include "xfs_btree.h" | 34 | #include "xfs_btree.h" | 
| 50 | #include "xfs_attr_sf.h" | ||
| 51 | #include "xfs_dir_sf.h" | 35 | #include "xfs_dir_sf.h" | 
| 52 | #include "xfs_dir2_sf.h" | 36 | #include "xfs_dir2_sf.h" | 
| 37 | #include "xfs_attr_sf.h" | ||
| 53 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" | 
| 54 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" | 
| 55 | #include "xfs_bmap.h" | 40 | #include "xfs_bmap.h" | 
| 56 | #include "xfs_da_btree.h" | ||
| 57 | #include "xfs_dir_leaf.h" | 41 | #include "xfs_dir_leaf.h" | 
| 58 | #include "xfs_error.h" | 42 | #include "xfs_error.h" | 
| 59 | 43 | ||
| @@ -192,11 +176,23 @@ xfs_dir_mount(xfs_mount_t *mp) | |||
| 192 | uint shortcount, leafcount, count; | 176 | uint shortcount, leafcount, count; | 
| 193 | 177 | ||
| 194 | mp->m_dirversion = 1; | 178 | mp->m_dirversion = 1; | 
| 195 | shortcount = (mp->m_attroffset - (uint)sizeof(xfs_dir_sf_hdr_t)) / | 179 | if (mp->m_flags & XFS_MOUNT_COMPAT_ATTR) { | 
| 196 | (uint)sizeof(xfs_dir_sf_entry_t); | 180 | shortcount = (mp->m_attroffset - | 
| 197 | leafcount = (XFS_LBSIZE(mp) - (uint)sizeof(xfs_dir_leaf_hdr_t)) / | 181 | (uint)sizeof(xfs_dir_sf_hdr_t)) / | 
| 198 | ((uint)sizeof(xfs_dir_leaf_entry_t) + | 182 | (uint)sizeof(xfs_dir_sf_entry_t); | 
| 199 | (uint)sizeof(xfs_dir_leaf_name_t)); | 183 | leafcount = (XFS_LBSIZE(mp) - | 
| 184 | (uint)sizeof(xfs_dir_leaf_hdr_t)) / | ||
| 185 | ((uint)sizeof(xfs_dir_leaf_entry_t) + | ||
| 186 | (uint)sizeof(xfs_dir_leaf_name_t)); | ||
| 187 | } else { | ||
| 188 | shortcount = (XFS_BMDR_SPACE_CALC(MINABTPTRS) - | ||
| 189 | (uint)sizeof(xfs_dir_sf_hdr_t)) / | ||
| 190 | (uint)sizeof(xfs_dir_sf_entry_t); | ||
| 191 | leafcount = (XFS_LBSIZE(mp) - | ||
| 192 | (uint)sizeof(xfs_dir_leaf_hdr_t)) / | ||
| 193 | ((uint)sizeof(xfs_dir_leaf_entry_t) + | ||
| 194 | (uint)sizeof(xfs_dir_leaf_name_t)); | ||
| 195 | } | ||
| 200 | count = shortcount > leafcount ? shortcount : leafcount; | 196 | count = shortcount > leafcount ? shortcount : leafcount; | 
| 201 | mp->m_dircook_elog = xfs_da_log2_roundup(count + 1); | 197 | mp->m_dircook_elog = xfs_da_log2_roundup(count + 1); | 
| 202 | ASSERT(mp->m_dircook_elog <= mp->m_sb.sb_blocklog); | 198 | ASSERT(mp->m_dircook_elog <= mp->m_sb.sb_blocklog); | 
