aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_leaf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r--fs/xfs/xfs_dir2_leaf.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index fa913e459442..29f484c11b3a 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -38,8 +38,8 @@
38#include "xfs_dir2_leaf.h" 38#include "xfs_dir2_leaf.h"
39#include "xfs_dir2_block.h" 39#include "xfs_dir2_block.h"
40#include "xfs_dir2_node.h" 40#include "xfs_dir2_node.h"
41#include "xfs_dir2_trace.h"
42#include "xfs_error.h" 41#include "xfs_error.h"
42#include "xfs_trace.h"
43 43
44/* 44/*
45 * Local function declarations. 45 * Local function declarations.
@@ -80,7 +80,8 @@ xfs_dir2_block_to_leaf(
80 int needscan; /* need to rescan bestfree */ 80 int needscan; /* need to rescan bestfree */
81 xfs_trans_t *tp; /* transaction pointer */ 81 xfs_trans_t *tp; /* transaction pointer */
82 82
83 xfs_dir2_trace_args_b("block_to_leaf", args, dbp); 83 trace_xfs_dir2_block_to_leaf(args);
84
84 dp = args->dp; 85 dp = args->dp;
85 mp = dp->i_mount; 86 mp = dp->i_mount;
86 tp = args->trans; 87 tp = args->trans;
@@ -188,7 +189,8 @@ xfs_dir2_leaf_addname(
188 xfs_trans_t *tp; /* transaction pointer */ 189 xfs_trans_t *tp; /* transaction pointer */
189 xfs_dir2_db_t use_block; /* data block number */ 190 xfs_dir2_db_t use_block; /* data block number */
190 191
191 xfs_dir2_trace_args("leaf_addname", args); 192 trace_xfs_dir2_leaf_addname(args);
193
192 dp = args->dp; 194 dp = args->dp;
193 tp = args->trans; 195 tp = args->trans;
194 mp = dp->i_mount; 196 mp = dp->i_mount;
@@ -854,6 +856,7 @@ xfs_dir2_leaf_getdents(
854 */ 856 */
855 ra_want = howmany(bufsize + mp->m_dirblksize, 857 ra_want = howmany(bufsize + mp->m_dirblksize,
856 mp->m_sb.sb_blocksize) - 1; 858 mp->m_sb.sb_blocksize) - 1;
859 ASSERT(ra_want >= 0);
857 860
858 /* 861 /*
859 * If we don't have as many as we want, and we haven't 862 * If we don't have as many as we want, and we haven't
@@ -1088,7 +1091,8 @@ xfs_dir2_leaf_getdents(
1088 */ 1091 */
1089 ptr += length; 1092 ptr += length;
1090 curoff += length; 1093 curoff += length;
1091 bufsize -= length; 1094 /* bufsize may have just been a guess; don't go negative */
1095 bufsize = bufsize > length ? bufsize - length : 0;
1092 } 1096 }
1093 1097
1094 /* 1098 /*
@@ -1264,7 +1268,8 @@ xfs_dir2_leaf_lookup(
1264 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1268 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1265 xfs_trans_t *tp; /* transaction pointer */ 1269 xfs_trans_t *tp; /* transaction pointer */
1266 1270
1267 xfs_dir2_trace_args("leaf_lookup", args); 1271 trace_xfs_dir2_leaf_lookup(args);
1272
1268 /* 1273 /*
1269 * Look up name in the leaf block, returning both buffers and index. 1274 * Look up name in the leaf block, returning both buffers and index.
1270 */ 1275 */
@@ -1452,7 +1457,8 @@ xfs_dir2_leaf_removename(
1452 xfs_dir2_data_off_t oldbest; /* old value of best free */ 1457 xfs_dir2_data_off_t oldbest; /* old value of best free */
1453 xfs_trans_t *tp; /* transaction pointer */ 1458 xfs_trans_t *tp; /* transaction pointer */
1454 1459
1455 xfs_dir2_trace_args("leaf_removename", args); 1460 trace_xfs_dir2_leaf_removename(args);
1461
1456 /* 1462 /*
1457 * Lookup the leaf entry, get the leaf and data blocks read in. 1463 * Lookup the leaf entry, get the leaf and data blocks read in.
1458 */ 1464 */
@@ -1584,7 +1590,8 @@ xfs_dir2_leaf_replace(
1584 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1590 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1585 xfs_trans_t *tp; /* transaction pointer */ 1591 xfs_trans_t *tp; /* transaction pointer */
1586 1592
1587 xfs_dir2_trace_args("leaf_replace", args); 1593 trace_xfs_dir2_leaf_replace(args);
1594
1588 /* 1595 /*
1589 * Look up the entry. 1596 * Look up the entry.
1590 */ 1597 */
@@ -1764,7 +1771,9 @@ xfs_dir2_node_to_leaf(
1764 if (state->path.active > 1) 1771 if (state->path.active > 1)
1765 return 0; 1772 return 0;
1766 args = state->args; 1773 args = state->args;
1767 xfs_dir2_trace_args("node_to_leaf", args); 1774
1775 trace_xfs_dir2_node_to_leaf(args);
1776
1768 mp = state->mp; 1777 mp = state->mp;
1769 dp = args->dp; 1778 dp = args->dp;
1770 tp = args->trans; 1779 tp = args->trans;