Skip to content

Commit bf50aca

Browse files
adam900710kdave
authored andcommitted
btrfs: remove the unused locked_folio parameter from btrfs_cleanup_ordered_extents()
The function btrfs_cleanup_ordered_extents() is only called in error handling path, and the last caller with a @locked_folio parameter was removed to fix a bug in the btrfs_run_delalloc_range() error handling. There is no need to pass @locked_folio parameter anymore. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 975a6a8 commit bf50aca

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

fs/btrfs/inode.c

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -393,34 +393,13 @@ void btrfs_inode_unlock(struct btrfs_inode *inode, unsigned int ilock_flags)
393393
* extent (btrfs_finish_ordered_io()).
394394
*/
395395
static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
396-
struct folio *locked_folio,
397396
u64 offset, u64 bytes)
398397
{
399398
unsigned long index = offset >> PAGE_SHIFT;
400399
unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT;
401-
u64 page_start = 0, page_end = 0;
402400
struct folio *folio;
403401

404-
if (locked_folio) {
405-
page_start = folio_pos(locked_folio);
406-
page_end = page_start + folio_size(locked_folio) - 1;
407-
}
408-
409402
while (index <= end_index) {
410-
/*
411-
* For locked page, we will call btrfs_mark_ordered_io_finished
412-
* through btrfs_mark_ordered_io_finished() on it
413-
* in run_delalloc_range() for the error handling, which will
414-
* clear page Ordered and run the ordered extent accounting.
415-
*
416-
* Here we can't just clear the Ordered bit, or
417-
* btrfs_mark_ordered_io_finished() would skip the accounting
418-
* for the page range, and the ordered extent will never finish.
419-
*/
420-
if (locked_folio && index == (page_start >> PAGE_SHIFT)) {
421-
index++;
422-
continue;
423-
}
424403
folio = filemap_get_folio(inode->vfs_inode.i_mapping, index);
425404
index++;
426405
if (IS_ERR(folio))
@@ -436,23 +415,6 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
436415
folio_put(folio);
437416
}
438417

439-
if (locked_folio) {
440-
/* The locked page covers the full range, nothing needs to be done */
441-
if (bytes + offset <= page_start + folio_size(locked_folio))
442-
return;
443-
/*
444-
* In case this page belongs to the delalloc range being
445-
* instantiated then skip it, since the first page of a range is
446-
* going to be properly cleaned up by the caller of
447-
* run_delalloc_range
448-
*/
449-
if (page_start >= offset && page_end <= (offset + bytes - 1)) {
450-
bytes = offset + bytes - folio_pos(locked_folio) -
451-
folio_size(locked_folio);
452-
offset = folio_pos(locked_folio) + folio_size(locked_folio);
453-
}
454-
}
455-
456418
return btrfs_mark_ordered_io_finished(inode, NULL, offset, bytes, false);
457419
}
458420

@@ -1128,7 +1090,7 @@ static void submit_uncompressed_range(struct btrfs_inode *inode,
11281090
&wbc, false);
11291091
wbc_detach_inode(&wbc);
11301092
if (ret < 0) {
1131-
btrfs_cleanup_ordered_extents(inode, NULL, start, end - start + 1);
1093+
btrfs_cleanup_ordered_extents(inode, start, end - start + 1);
11321094
if (locked_folio)
11331095
btrfs_folio_end_lock(inode->root->fs_info, locked_folio,
11341096
start, async_extent->ram_size);
@@ -2384,7 +2346,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct folio *locked_fol
23842346

23852347
out:
23862348
if (ret < 0)
2387-
btrfs_cleanup_ordered_extents(inode, NULL, start, end - start + 1);
2349+
btrfs_cleanup_ordered_extents(inode, start, end - start + 1);
23882350
return ret;
23892351
}
23902352

0 commit comments

Comments
 (0)