aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_da_btree.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 18:33:33 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 18:33:33 -0500
commitaa82daa06198b27963fe3d6ee8035855b29f6524 (patch)
tree7c618d365997e8a9a326739f0579b3cc1272e62e /fs/xfs/xfs_da_btree.c
parente8c8b3a79d85c22d3665b97dde843dc4d8d7ae37 (diff)
[XFS] Move some code around to prepare for the upcoming extended
attributes format change (attr2). SGI-PV: 941645 SGI-Modid: xfs-linux:xfs-kern:23833a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_da_btree.c')
-rw-r--r--fs/xfs/xfs_da_btree.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 8b792ddf2164..8e2597b1a029 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -190,9 +190,6 @@ xfs_da_split(xfs_da_state_t *state)
190 */ 190 */
191 switch (oldblk->magic) { 191 switch (oldblk->magic) {
192 case XFS_ATTR_LEAF_MAGIC: 192 case XFS_ATTR_LEAF_MAGIC:
193#ifndef __KERNEL__
194 return(ENOTTY);
195#else
196 error = xfs_attr_leaf_split(state, oldblk, newblk); 193 error = xfs_attr_leaf_split(state, oldblk, newblk);
197 if ((error != 0) && (error != ENOSPC)) { 194 if ((error != 0) && (error != ENOSPC)) {
198 return(error); /* GROT: attr is inconsistent */ 195 return(error); /* GROT: attr is inconsistent */
@@ -218,7 +215,6 @@ xfs_da_split(xfs_da_state_t *state)
218 return(error); /* GROT: attr inconsistent */ 215 return(error); /* GROT: attr inconsistent */
219 addblk = newblk; 216 addblk = newblk;
220 break; 217 break;
221#endif
222 case XFS_DIR_LEAF_MAGIC: 218 case XFS_DIR_LEAF_MAGIC:
223 ASSERT(XFS_DIR_IS_V1(state->mp)); 219 ASSERT(XFS_DIR_IS_V1(state->mp));
224 error = xfs_dir_leaf_split(state, oldblk, newblk); 220 error = xfs_dir_leaf_split(state, oldblk, newblk);
@@ -706,18 +702,12 @@ xfs_da_join(xfs_da_state_t *state)
706 */ 702 */
707 switch (drop_blk->magic) { 703 switch (drop_blk->magic) {
708 case XFS_ATTR_LEAF_MAGIC: 704 case XFS_ATTR_LEAF_MAGIC:
709#ifndef __KERNEL__
710 error = ENOTTY;
711#else
712 error = xfs_attr_leaf_toosmall(state, &action); 705 error = xfs_attr_leaf_toosmall(state, &action);
713#endif
714 if (error) 706 if (error)
715 return(error); 707 return(error);
716 if (action == 0) 708 if (action == 0)
717 return(0); 709 return(0);
718#ifdef __KERNEL__
719 xfs_attr_leaf_unbalance(state, drop_blk, save_blk); 710 xfs_attr_leaf_unbalance(state, drop_blk, save_blk);
720#endif
721 break; 711 break;
722 case XFS_DIR_LEAF_MAGIC: 712 case XFS_DIR_LEAF_MAGIC:
723 ASSERT(XFS_DIR_IS_V1(state->mp)); 713 ASSERT(XFS_DIR_IS_V1(state->mp));
@@ -973,13 +963,11 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path)
973 level = path->active-1; 963 level = path->active-1;
974 blk = &path->blk[ level ]; 964 blk = &path->blk[ level ];
975 switch (blk->magic) { 965 switch (blk->magic) {
976#ifdef __KERNEL__
977 case XFS_ATTR_LEAF_MAGIC: 966 case XFS_ATTR_LEAF_MAGIC:
978 lasthash = xfs_attr_leaf_lasthash(blk->bp, &count); 967 lasthash = xfs_attr_leaf_lasthash(blk->bp, &count);
979 if (count == 0) 968 if (count == 0)
980 return; 969 return;
981 break; 970 break;
982#endif
983 case XFS_DIR_LEAF_MAGIC: 971 case XFS_DIR_LEAF_MAGIC:
984 ASSERT(XFS_DIR_IS_V1(state->mp)); 972 ASSERT(XFS_DIR_IS_V1(state->mp));
985 lasthash = xfs_dir_leaf_lasthash(blk->bp, &count); 973 lasthash = xfs_dir_leaf_lasthash(blk->bp, &count);
@@ -1220,12 +1208,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
1220 blkno = INT_GET(btree->before, ARCH_CONVERT); 1208 blkno = INT_GET(btree->before, ARCH_CONVERT);
1221 } 1209 }
1222 } 1210 }
1223#ifdef __KERNEL__
1224 else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) { 1211 else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_ATTR_LEAF_MAGIC) {
1225 blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); 1212 blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL);
1226 break; 1213 break;
1227 } 1214 }
1228#endif
1229 else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) { 1215 else if (INT_GET(curr->magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) {
1230 blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL); 1216 blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL);
1231 break; 1217 break;
@@ -1252,13 +1238,11 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
1252 retval = xfs_dir2_leafn_lookup_int(blk->bp, args, 1238 retval = xfs_dir2_leafn_lookup_int(blk->bp, args,
1253 &blk->index, state); 1239 &blk->index, state);
1254 } 1240 }
1255#ifdef __KERNEL__
1256 else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { 1241 else if (blk->magic == XFS_ATTR_LEAF_MAGIC) {
1257 retval = xfs_attr_leaf_lookup_int(blk->bp, args); 1242 retval = xfs_attr_leaf_lookup_int(blk->bp, args);
1258 blk->index = args->index; 1243 blk->index = args->index;
1259 args->blkno = blk->blkno; 1244 args->blkno = blk->blkno;
1260 } 1245 }
1261#endif
1262 if (((retval == ENOENT) || (retval == ENOATTR)) && 1246 if (((retval == ENOENT) || (retval == ENOATTR)) &&
1263 (blk->hashval == args->hashval)) { 1247 (blk->hashval == args->hashval)) {
1264 error = xfs_da_path_shift(state, &state->path, 1, 1, 1248 error = xfs_da_path_shift(state, &state->path, 1, 1,
@@ -1268,12 +1252,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
1268 if (retval == 0) { 1252 if (retval == 0) {
1269 continue; 1253 continue;
1270 } 1254 }
1271#ifdef __KERNEL__
1272 else if (blk->magic == XFS_ATTR_LEAF_MAGIC) { 1255 else if (blk->magic == XFS_ATTR_LEAF_MAGIC) {
1273 /* path_shift() gives ENOENT */ 1256 /* path_shift() gives ENOENT */
1274 retval = XFS_ERROR(ENOATTR); 1257 retval = XFS_ERROR(ENOATTR);
1275 } 1258 }
1276#endif
1277 } 1259 }
1278 break; 1260 break;
1279 } 1261 }
@@ -1312,11 +1294,9 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
1312 ASSERT(old_blk->magic == new_blk->magic); 1294 ASSERT(old_blk->magic == new_blk->magic);
1313 1295
1314 switch (old_blk->magic) { 1296 switch (old_blk->magic) {
1315#ifdef __KERNEL__
1316 case XFS_ATTR_LEAF_MAGIC: 1297 case XFS_ATTR_LEAF_MAGIC:
1317 before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp); 1298 before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp);
1318 break; 1299 break;
1319#endif
1320 case XFS_DIR_LEAF_MAGIC: 1300 case XFS_DIR_LEAF_MAGIC:
1321 ASSERT(XFS_DIR_IS_V1(state->mp)); 1301 ASSERT(XFS_DIR_IS_V1(state->mp));
1322 before = xfs_dir_leaf_order(old_blk->bp, new_blk->bp); 1302 before = xfs_dir_leaf_order(old_blk->bp, new_blk->bp);
@@ -1587,12 +1567,10 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
1587 ASSERT(level == path->active-1); 1567 ASSERT(level == path->active-1);
1588 blk->index = 0; 1568 blk->index = 0;
1589 switch(blk->magic) { 1569 switch(blk->magic) {
1590#ifdef __KERNEL__
1591 case XFS_ATTR_LEAF_MAGIC: 1570 case XFS_ATTR_LEAF_MAGIC:
1592 blk->hashval = xfs_attr_leaf_lasthash(blk->bp, 1571 blk->hashval = xfs_attr_leaf_lasthash(blk->bp,
1593 NULL); 1572 NULL);
1594 break; 1573 break;
1595#endif
1596 case XFS_DIR_LEAF_MAGIC: 1574 case XFS_DIR_LEAF_MAGIC:
1597 ASSERT(XFS_DIR_IS_V1(state->mp)); 1575 ASSERT(XFS_DIR_IS_V1(state->mp));
1598 blk->hashval = xfs_dir_leaf_lasthash(blk->bp, 1576 blk->hashval = xfs_dir_leaf_lasthash(blk->bp,
@@ -2200,20 +2178,16 @@ xfs_da_do_buf(
2200 error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); 2178 error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO);
2201 break; 2179 break;
2202 case 1: 2180 case 1:
2203#ifndef __KERNEL__
2204 case 2: 2181 case 2:
2205#endif
2206 bp = NULL; 2182 bp = NULL;
2207 error = xfs_trans_read_buf(mp, trans, mp->m_ddev_targp, 2183 error = xfs_trans_read_buf(mp, trans, mp->m_ddev_targp,
2208 mappedbno, nmapped, 0, &bp); 2184 mappedbno, nmapped, 0, &bp);
2209 break; 2185 break;
2210#ifdef __KERNEL__
2211 case 3: 2186 case 3:
2212 xfs_baread(mp->m_ddev_targp, mappedbno, nmapped); 2187 xfs_baread(mp->m_ddev_targp, mappedbno, nmapped);
2213 error = 0; 2188 error = 0;
2214 bp = NULL; 2189 bp = NULL;
2215 break; 2190 break;
2216#endif
2217 } 2191 }
2218 if (error) { 2192 if (error) {
2219 if (bp) 2193 if (bp)