Skip to content

Commit 91e4bac

Browse files
Mark TinguelyBen Myers
authored andcommitted
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: 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>
1 parent 2d0e9df commit 91e4bac

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

fs/xfs/xfs_buf_item.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ xfs_buf_item_unlock(
611611
{
612612
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
613613
struct xfs_buf *bp = bip->bli_buf;
614-
int aborted;
614+
int aborted, clean, i;
615615
uint hold;
616616

617617
/* Clear the buffer's association with this transaction. */
@@ -654,8 +654,15 @@ xfs_buf_item_unlock(
654654
* If the buf item isn't tracking any data, free it, otherwise drop the
655655
* reference we hold to it.
656656
*/
657-
if (xfs_bitmap_empty(bip->__bli_format.blf_data_map,
658-
bip->__bli_format.blf_map_size))
657+
clean = 1;
658+
for (i = 0; i < bip->bli_format_count; i++) {
659+
if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map,
660+
bip->bli_formats[i].blf_map_size)) {
661+
clean = 0;
662+
break;
663+
}
664+
}
665+
if (clean)
659666
xfs_buf_item_relse(bp);
660667
else
661668
atomic_dec(&bip->bli_refcount);

fs/xfs/xfs_trans_buf.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ xfs_trans_binval(
643643
xfs_buf_t *bp)
644644
{
645645
xfs_buf_log_item_t *bip = bp->b_fspriv;
646+
int i;
646647

647648
ASSERT(bp->b_transp == tp);
648649
ASSERT(bip != NULL);
@@ -670,8 +671,10 @@ xfs_trans_binval(
670671
bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY);
671672
bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF;
672673
bip->__bli_format.blf_flags |= XFS_BLF_CANCEL;
673-
memset((char *)(bip->__bli_format.blf_data_map), 0,
674-
(bip->__bli_format.blf_map_size * sizeof(uint)));
674+
for (i = 0; i < bip->bli_format_count; i++) {
675+
memset(bip->bli_formats[i].blf_data_map, 0,
676+
(bip->bli_formats[i].blf_map_size * sizeof(uint)));
677+
}
675678
bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
676679
tp->t_flags |= XFS_TRANS_DIRTY;
677680
}

0 commit comments

Comments
 (0)