Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: decrease indenting problems in xfs_dabuf_map

Refactor the code that complains when a dir/attr mapping doesn't exist
but the caller requires a mapping. This small restructuring helps us to
reduce the indenting level.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

+23 -19
+23 -19
fs/xfs/libxfs/xfs_da_btree.c
··· 2567 2567 } 2568 2568 2569 2569 if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) { 2570 - error = mappedbno == -2 ? -1 : -EFSCORRUPTED; 2571 - if (unlikely(error == -EFSCORRUPTED)) { 2572 - if (xfs_error_level >= XFS_ERRLEVEL_LOW) { 2573 - int i; 2574 - xfs_alert(mp, "%s: bno %lld dir: inode %lld", 2575 - __func__, (long long)bno, 2576 - (long long)dp->i_ino); 2577 - for (i = 0; i < *nmaps; i++) { 2578 - xfs_alert(mp, 2579 - "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d", 2580 - i, 2581 - (long long)irecs[i].br_startoff, 2582 - (long long)irecs[i].br_startblock, 2583 - (long long)irecs[i].br_blockcount, 2584 - irecs[i].br_state); 2585 - } 2586 - } 2587 - XFS_ERROR_REPORT("xfs_da_do_buf(1)", 2588 - XFS_ERRLEVEL_LOW, mp); 2570 + /* Caller ok with no mapping. */ 2571 + if (mappedbno == -2) { 2572 + error = -1; 2573 + goto out; 2589 2574 } 2575 + 2576 + /* Caller expected a mapping, so abort. */ 2577 + if (xfs_error_level >= XFS_ERRLEVEL_LOW) { 2578 + int i; 2579 + 2580 + xfs_alert(mp, "%s: bno %lld dir: inode %lld", __func__, 2581 + (long long)bno, (long long)dp->i_ino); 2582 + for (i = 0; i < *nmaps; i++) { 2583 + xfs_alert(mp, 2584 + "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d", 2585 + i, 2586 + (long long)irecs[i].br_startoff, 2587 + (long long)irecs[i].br_startblock, 2588 + (long long)irecs[i].br_blockcount, 2589 + irecs[i].br_state); 2590 + } 2591 + } 2592 + XFS_ERROR_REPORT("xfs_da_do_buf(1)", XFS_ERRLEVEL_LOW, mp); 2593 + error = -EFSCORRUPTED; 2590 2594 goto out; 2591 2595 } 2592 2596 error = xfs_buf_map_from_irec(mp, map, nmaps, irecs, nirecs);