Skip to content

Commit

Permalink
xfs: fix the multi-segment log buffer format
Browse files Browse the repository at this point in the history
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: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
  • Loading branch information
Mark Tinguely authored and Ben Myers committed Jan 16, 2013
1 parent 2d0e9df commit 91e4bac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 10 additions & 3 deletions fs/xfs/xfs_buf_item.c
Expand Up @@ -611,7 +611,7 @@ xfs_buf_item_unlock(
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
int aborted;
int aborted, clean, i;
uint hold;

/* Clear the buffer's association with this transaction. */
Expand Down Expand Up @@ -654,8 +654,15 @@ xfs_buf_item_unlock(
* If the buf item isn't tracking any data, free it, otherwise drop the
* reference we hold to it.
*/
if (xfs_bitmap_empty(bip->__bli_format.blf_data_map,
bip->__bli_format.blf_map_size))
clean = 1;
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);
else
atomic_dec(&bip->bli_refcount);
Expand Down
7 changes: 5 additions & 2 deletions fs/xfs/xfs_trans_buf.c
Expand Up @@ -643,6 +643,7 @@ xfs_trans_binval(
xfs_buf_t *bp)
{
xfs_buf_log_item_t *bip = bp->b_fspriv;
int i;

ASSERT(bp->b_transp == tp);
ASSERT(bip != NULL);
Expand Down Expand Up @@ -670,8 +671,10 @@ xfs_trans_binval(
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_CANCEL;
memset((char *)(bip->__bli_format.blf_data_map), 0,
(bip->__bli_format.blf_map_size * sizeof(uint)));
for (i = 0; i < bip->bli_format_count; i++) {
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;
tp->t_flags |= XFS_TRANS_DIRTY;
}
Expand Down

0 comments on commit 91e4bac

Please sign in to comment.