Commit 91e4bac0 authored by Mark Tinguely's avatar Mark Tinguely Committed by Ben Myers

xfs: fix the multi-segment log buffer format

Per Dave Chinner suggestion, this patch:
 1) Corrects the detection of whether a multi-segment buffer is
    still tracking data.
 2) Clears all the buffer log formats for a multi-segment buffer.
Signed-off-by: default avatarMark Tinguely <tinguely@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 2d0e9df5
...@@ -611,7 +611,7 @@ xfs_buf_item_unlock( ...@@ -611,7 +611,7 @@ xfs_buf_item_unlock(
{ {
struct xfs_buf_log_item *bip = BUF_ITEM(lip); struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf; struct xfs_buf *bp = bip->bli_buf;
int aborted; int aborted, clean, i;
uint hold; uint hold;
/* Clear the buffer's association with this transaction. */ /* Clear the buffer's association with this transaction. */
...@@ -654,8 +654,15 @@ xfs_buf_item_unlock( ...@@ -654,8 +654,15 @@ xfs_buf_item_unlock(
* If the buf item isn't tracking any data, free it, otherwise drop the * If the buf item isn't tracking any data, free it, otherwise drop the
* reference we hold to it. * reference we hold to it.
*/ */
if (xfs_bitmap_empty(bip->__bli_format.blf_data_map, clean = 1;
bip->__bli_format.blf_map_size)) for (i = 0; i < bip->bli_format_count; i++) {
if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map,
bip->bli_formats[i].blf_map_size)) {
clean = 0;
break;
}
}
if (clean)
xfs_buf_item_relse(bp); xfs_buf_item_relse(bp);
else else
atomic_dec(&bip->bli_refcount); atomic_dec(&bip->bli_refcount);
......
...@@ -643,6 +643,7 @@ xfs_trans_binval( ...@@ -643,6 +643,7 @@ xfs_trans_binval(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
xfs_buf_log_item_t *bip = bp->b_fspriv; xfs_buf_log_item_t *bip = bp->b_fspriv;
int i;
ASSERT(bp->b_transp == tp); ASSERT(bp->b_transp == tp);
ASSERT(bip != NULL); ASSERT(bip != NULL);
...@@ -670,8 +671,10 @@ xfs_trans_binval( ...@@ -670,8 +671,10 @@ xfs_trans_binval(
bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY); bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY);
bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF;
bip->__bli_format.blf_flags |= XFS_BLF_CANCEL; bip->__bli_format.blf_flags |= XFS_BLF_CANCEL;
memset((char *)(bip->__bli_format.blf_data_map), 0, for (i = 0; i < bip->bli_format_count; i++) {
(bip->__bli_format.blf_map_size * sizeof(uint))); memset(bip->bli_formats[i].blf_data_map, 0,
(bip->bli_formats[i].blf_map_size * sizeof(uint)));
}
bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
tp->t_flags |= XFS_TRANS_DIRTY; tp->t_flags |= XFS_TRANS_DIRTY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment