diff options
author | Qu Wenruo <wqu@suse.com> | 2021-09-27 10:22:00 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-10-26 20:08:04 +0300 |
commit | bbbff01a47bfe1b7733c5ccac6a78ff6d7a8954f (patch) | |
tree | f4826766c519b22683fb9222f949d127d9113a80 /fs | |
parent | 4c162778d63eb8822492f715dbe06970d242b4fd (diff) | |
download | linux-bbbff01a47bfe1b7733c5ccac6a78ff6d7a8954f.tar.xz |
btrfs: subpage: make btrfs_submit_compressed_write() compatible
There is a WARN_ON() checking if @start is aligned to PAGE_SIZE, not
sectorsize, which will cause false alert for subpage. Fix it to check
against sectorsize.
Furthermore:
- Use ASSERT() to do the check
So that in the future we may skip the check for production build
- Also check alignment for @len
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/compression.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 1debdfeee90f..ab2eb936975f 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -513,7 +513,8 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, const bool use_append = btrfs_use_zone_append(inode, disk_start); const unsigned int bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE; - WARN_ON(!PAGE_ALIGNED(start)); + ASSERT(IS_ALIGNED(start, fs_info->sectorsize) && + IS_ALIGNED(len, fs_info->sectorsize)); cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); if (!cb) return BLK_STS_RESOURCE; |