diff options
author | Jie Liu <jeff.liu@oracle.com> | 2014-07-24 04:40:43 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-07-24 04:40:43 -0400 |
commit | d4c27348751bffeb57d87fc631f76716e3036c6d (patch) | |
tree | b1cec67c7a33ea66b668cb6acb486957ac0ce145 /fs/xfs | |
parent | 296dfd7fdba3a8b702d9cb47afc9061f52e18656 (diff) |
xfs: fix error handling at xfs_bulkstat
From: Jie Liu <jeff.liu@oracle.com>
We should not ignore the btree operation errors at xfs_bulkstat() but
to propagate them if any. This patch fix two places in this function
and the remaining things will be fixed with code refactoring thereafter.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_itable.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 940eeebaca03..dfc4aa52ff83 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -253,14 +253,8 @@ xfs_bulkstat( | |||
253 | while (XFS_BULKSTAT_UBLEFT(ubleft) && agno < mp->m_sb.sb_agcount) { | 253 | while (XFS_BULKSTAT_UBLEFT(ubleft) && agno < mp->m_sb.sb_agcount) { |
254 | cond_resched(); | 254 | cond_resched(); |
255 | error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp); | 255 | error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp); |
256 | if (error) { | 256 | if (error) |
257 | /* | 257 | break; |
258 | * Skip this allocation group and go to the next one. | ||
259 | */ | ||
260 | agno++; | ||
261 | agino = 0; | ||
262 | continue; | ||
263 | } | ||
264 | agi = XFS_BUF_TO_AGI(agbp); | 258 | agi = XFS_BUF_TO_AGI(agbp); |
265 | /* | 259 | /* |
266 | * Allocate and initialize a btree cursor for ialloc btree. | 260 | * Allocate and initialize a btree cursor for ialloc btree. |
@@ -332,34 +326,15 @@ xfs_bulkstat( | |||
332 | error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &tmp); | 326 | error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &tmp); |
333 | icount = 0; | 327 | icount = 0; |
334 | } | 328 | } |
329 | if (error) | ||
330 | break; | ||
331 | |||
335 | /* | 332 | /* |
336 | * Loop through inode btree records in this ag, | 333 | * Loop through inode btree records in this ag, |
337 | * until we run out of inodes or space in the buffer. | 334 | * until we run out of inodes or space in the buffer. |
338 | */ | 335 | */ |
339 | while (irbp < irbufend && icount < ubcount) { | 336 | while (irbp < irbufend && icount < ubcount) { |
340 | xfs_inobt_rec_incore_t r; | 337 | struct xfs_inobt_rec_incore r; |
341 | |||
342 | /* | ||
343 | * Loop as long as we're unable to read the | ||
344 | * inode btree. | ||
345 | */ | ||
346 | while (error) { | ||
347 | agino += XFS_INODES_PER_CHUNK; | ||
348 | if (XFS_AGINO_TO_AGBNO(mp, agino) >= | ||
349 | be32_to_cpu(agi->agi_length)) | ||
350 | break; | ||
351 | error = xfs_inobt_lookup(cur, agino, | ||
352 | XFS_LOOKUP_GE, &tmp); | ||
353 | cond_resched(); | ||
354 | } | ||
355 | /* | ||
356 | * If ran off the end of the ag either with an error, | ||
357 | * or the normal way, set end and stop collecting. | ||
358 | */ | ||
359 | if (error) { | ||
360 | end_of_ag = 1; | ||
361 | break; | ||
362 | } | ||
363 | 338 | ||
364 | error = xfs_inobt_get_rec(cur, &r, &i); | 339 | error = xfs_inobt_get_rec(cur, &r, &i); |
365 | if (error || i == 0) { | 340 | if (error || i == 0) { |