From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: Re: [PATCH v2 5/7] btrfs-progs: check/lowmem mode: Check inline extent size
Date: Tue, 13 Mar 2018 10:39:35 +0200 [thread overview]
Message-ID: <b357d3ce-50f3-03e7-5d57-396be9c35565@suse.com> (raw)
In-Reply-To: <20180313015616.6574-6-wqu@suse.com>
On 13.03.2018 03:56, Qu Wenruo wrote:
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> check/mode-lowmem.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> index 62bcf3d2e126..0d19b373c7af 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -1417,6 +1417,8 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_key *fkey,
> u64 csum_found; /* In byte size, sectorsize aligned */
> u64 search_start; /* Logical range start we search for csum */
> u64 search_len; /* Logical range len we search for csum */
> + u32 max_inline_extent_size = min_t(u32, root->fs_info->sectorsize - 1,
> + BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info));
> unsigned int extent_type;
> unsigned int is_hole;
> int compressed = 0;
> @@ -1440,6 +1442,32 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_key *fkey,
> root->objectid, fkey->objectid, fkey->offset);
> err |= FILE_EXTENT_ERROR;
> }
> + if (compressed) {
> + if (extent_num_bytes > root->fs_info->sectorsize) {
> + error(
> +"root %llu EXTENT_DATA[%llu %llu] too large inline extent ram size, have %llu, max: %u",
> + root->objectid, fkey->objectid,
> + fkey->offset, extent_num_bytes,
> + root->fs_info->sectorsize);
nit: shouldn't this really be sectorsize - 1 ?
> + err |= FILE_EXTENT_ERROR;
> + }
> + if (item_inline_len > max_inline_extent_size) {
> + error(
> +"root %llu EXTENT_DATA[%llu %llu] too large inline extent on-disk size, have %u, max: %u",
> + root->objectid, fkey->objectid,
> + fkey->offset, item_inline_len,
> + max_inline_extent_size);
> + err |= FILE_EXTENT_ERROR;
> + }
> + } else {
> + if (extent_num_bytes > max_inline_extent_size) {
> + error(
> + "root %llu EXTENT_DATA[%llu %llu] too large inline extent size, have %llu, max: %u",
> + root->objectid, fkey->objectid, fkey->offset,
> + extent_num_bytes, max_inline_extent_size);
> + err |= FILE_EXTENT_ERROR;
> + }
> + }
> if (!compressed && extent_num_bytes != item_inline_len) {
> error(
> "root %llu EXTENT_DATA[%llu %llu] wrong inline size, have: %llu, expected: %u",
>
next prev parent reply other threads:[~2018-03-13 8:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 1:56 [PATCH v2 0/7] Fix long standing -EOPNOTSUPP problem caused by large inline extent Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 1/7] btrfs-progs: convert/ext2: Fix inline extent creation check Qu Wenruo
2018-03-19 13:20 ` David Sterba
2018-03-13 1:56 ` [PATCH v2 2/7] btrfs-progs: convert/reiserfs: Fix inline file " Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 3/7] btrfs-progs: mkfs/rootdir: Fix inline " Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 4/7] btrfs-progs: check/original mode: Check inline extent size Qu Wenruo
2018-03-13 8:40 ` Nikolay Borisov
2018-03-13 9:06 ` Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 5/7] btrfs-progs: check/lowmem " Qu Wenruo
2018-03-13 8:39 ` Nikolay Borisov [this message]
2018-03-13 9:04 ` Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 6/7] btrfs-progs: test/convert: Add test case for invalid large inline data extent Qu Wenruo
2018-03-13 1:56 ` [PATCH v2 7/7] btrfs-progs: test/mkfs: Add test case for rootdir inline extent size Qu Wenruo
2018-03-19 13:25 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b357d3ce-50f3-03e7-5d57-396be9c35565@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).