public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Wang Jianjian <wangjianjian0@foxmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] jbd2: Add a comment for incorrect tag size
Date: Wed, 19 Jun 2024 19:36:55 -0400	[thread overview]
Message-ID: <20240619233655.GC981794@mit.edu> (raw)
In-Reply-To: <tencent_1D453DB77B0F2091CB4A68568A77627D4E08@qq.com>

On Thu, Apr 04, 2024 at 09:36:54PM +0800, Wang Jianjian wrote:
> journal_tag_t has already counted the checksum size, however, for
> compatibility reason, we don't fix this bug and keep it as is.
> 
> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>

The csum_v2 layout had a number of problems, which was documented in
commit db9ee220361de:

    jbd2: fix descriptor block size handling errors with journal_csum
    
    It turns out that there are some serious problems with the on-disk
    format of journal checksum v2.  The foremost is that the function to
    calculate descriptor tag size returns sizes that are too big.  This
    causes alignment issues on some architectures and is compounded by the
    fact that some parts of jbd2 use the structure size (incorrectly) to
    determine the presence of a 64bit journal instead of checking the
    feature flags.
    
    Therefore, introduce journal checksum v3, which enlarges the
    descriptor block tag format to allow for full 32-bit checksums of
    journal blocks, fix the journal tag function to return the correct
    sizes, and fix the jbd2 recovery code to use feature flags to
    determine 64bitness.
    
    Add a few function helpers so we don't have to open-code quite so
    many pieces.
    
    Switching to a 16-byte block size was found to increase journal size
    overhead by a maximum of 0.1%, to convert a 32-bit journal with no
    checksumming to a 32-bit journal with checksum v3 enabled.

We switched to using csum_v3 in 2014, in Linux v3.17.  So most recent
LTS kernel which used the v2 csum format was Linux v3.14 which EOL'ed
in 2016 --- a full eight years ago.  So it's probably not worth adding
the comment at this point.

In fact, what we might want to consider is yanking support for the
CSUM_v2 and CSUM_V1 at this point, since *all* currently supported LTS
kernels (4.19, 5.4, 5.10, 5.15, 6.1 and 6.6) will be using CSUM_V3.
It's not actually *that* much code, but what's there is a bit hard to
understand since it very much relies on how the v2 and v3 data
strutures line up with each other, and the fact that the jbd2
structures are stored on disk in big_endian. 

						- Ted

  reply	other threads:[~2024-06-19 23:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 13:36 [PATCH] jbd2: Add a comment for incorrect tag size Wang Jianjian
2024-06-19 23:36 ` Theodore Ts'o [this message]
2024-06-20  3:19   ` wangjianjian (C)
2024-06-27 13:31     ` Theodore Ts'o
2024-06-28  2:15       ` wangjianjian (C)

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=20240619233655.GC981794@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=wangjianjian0@foxmail.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