]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: remove the alignment check in end_bbio_data_write()
authorQu Wenruo <wqu@suse.com>
Tue, 3 Mar 2026 08:15:09 +0000 (18:45 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:00 +0000 (18:56 +0200)
The check is not necessary because:

- There is already assert_bbio_alignment() at btrfs_submit_bbio()

- There is also btrfs_subpage_assert() for all btrfs_folio_*() helpers

- The original commit mentions the check may go away in the future
  Commit 17a5adccf3fd01 ("btrfs: do away with non-whole_page extent
  I/O") introduced the check first, and in the commit message:

    I've replaced the whole_page computations with warnings, just to be
    sure that we're not issuing partial page reads or writes.  The
    warnings should probably just go away some time.

- No similar check in all other endio functions
  No matter if it's data read, compressed read or write.

- There is no such report for very long
  I do not even remember if there is any such report.

Thus the need to do such check in end_bbio_data_write() is very weak,
and we can just get rid of it.

Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c

index 77dcec8b6b62f00cf7b5f6c9404781dd5da6338f..c7309e8bcc53a260280db8c508e76df908f88809 100644 (file)
@@ -521,7 +521,6 @@ static void end_bbio_data_write(struct btrfs_bio *bbio)
        struct bio *bio = &bbio->bio;
        int error = blk_status_to_errno(bio->bi_status);
        struct folio_iter fi;
-       const u32 sectorsize = fs_info->sectorsize;
        u32 bio_size = 0;
 
        ASSERT(!bio_flagged(bio, BIO_CLONED));
@@ -531,16 +530,6 @@ static void end_bbio_data_write(struct btrfs_bio *bbio)
                u32 len = fi.length;
 
                bio_size += len;
-               /* Our read/write should always be sector aligned. */
-               if (!IS_ALIGNED(fi.offset, sectorsize))
-                       btrfs_err(fs_info,
-               "partial page write in btrfs with offset %zu and length %zu",
-                                 fi.offset, fi.length);
-               else if (!IS_ALIGNED(fi.length, sectorsize))
-                       btrfs_info(fs_info,
-               "incomplete page write with offset %zu and length %zu",
-                                  fi.offset, fi.length);
-
                if (error)
                        mapping_set_error(folio->mapping, error);