Skip to content

Commit 0c30430

Browse files
Liu Bomasoncl
authored andcommitted
Btrfs: remove csum_bytes_left
After commit 8407f55 ("Btrfs: fix data corruption after fast fsync and writeback error"), during wait_ordered_extents(), we wait for ordered extent setting BTRFS_ORDERED_IO_DONE or BTRFS_ORDERED_IOERR, at which point we've already got checksum information, so we don't need to check (csum_bytes_left == 0) in the whole logging path. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
1 parent 39c2d7f commit 0c30430

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

fs/btrfs/ordered-data.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
198198
entry->file_offset = file_offset;
199199
entry->start = start;
200200
entry->len = len;
201-
if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM) &&
202-
!(type == BTRFS_ORDERED_NOCOW))
203-
entry->csum_bytes_left = disk_len;
204201
entry->disk_len = disk_len;
205202
entry->bytes_left = len;
206203
entry->inode = igrab(inode);
@@ -286,10 +283,6 @@ void btrfs_add_ordered_sum(struct inode *inode,
286283
tree = &BTRFS_I(inode)->ordered_tree;
287284
spin_lock_irq(&tree->lock);
288285
list_add_tail(&sum->list, &entry->list);
289-
WARN_ON(entry->csum_bytes_left < sum->len);
290-
entry->csum_bytes_left -= sum->len;
291-
if (entry->csum_bytes_left == 0)
292-
wake_up(&entry->wait);
293286
spin_unlock_irq(&tree->lock);
294287
}
295288

fs/btrfs/ordered-data.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ struct btrfs_ordered_extent {
8989
/* number of bytes that still need writing */
9090
u64 bytes_left;
9191

92-
/* number of bytes that still need csumming */
93-
u64 csum_bytes_left;
94-
9592
/*
9693
* the end of the ordered extent which is behind it but
9794
* didn't update disk_i_size. Please see the comment of

fs/btrfs/tree-log.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3881,12 +3881,6 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans,
38813881
&ordered->flags))
38823882
continue;
38833883

3884-
if (ordered->csum_bytes_left) {
3885-
btrfs_start_ordered_extent(inode, ordered, 0);
3886-
wait_event(ordered->wait,
3887-
ordered->csum_bytes_left == 0);
3888-
}
3889-
38903884
list_for_each_entry(sum, &ordered->list, list) {
38913885
ret = btrfs_csum_file_blocks(trans, log, sum);
38923886
if (ret)

0 commit comments

Comments
 (0)