From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: harshad shirwadkar <harshadshirwadkar@gmail.com>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: attempt to shrink directory on dentry removal
Date: Sun, 25 Aug 2019 23:19:26 -0400 [thread overview]
Message-ID: <20190826031926.GC4918@mit.edu> (raw)
In-Reply-To: <CAD+ocbyrJDbUFtQdq087iJCc=41CNACeAA2U_KQG-B4w19Soqw@mail.gmail.com>
On Sun, Aug 25, 2019 at 07:46:50PM -0700, harshad shirwadkar wrote:
> If last is an intermediate dx node, is there a way to find out if it
> actually is an intermediate dx node? Because an empty dirent block and
> an intermediate dx block look the same. Unless we do dx_probe() there
> is no way to know if a block is an intermediate dx block. Is that
> right or am I missing something?
You can simply look at the first hash value in the intermediate
dx_node (remember, an empty intermediate node is not allowed), and
then do a dx_probe to search from the root and validate that we find
our way back to the last block.
> Looking at your following comment, if metadata_csum feature is
> enabled, then we can distinguish if a block is an empty dirent block
> or an index block based on dentry->rec_len. If metadata csum is
> enabled, then for index blocks, fake_dentry->rec_len is set to
> blocksize while for a dirent not dentry->rec_len is set to blocksize -
> sizeof(ext4_dir_entry_tail). Is my understanding correct?
Yes. Although even if the metadata_csum feature is enabled, it's a
good idea to search from the root to make sure this really is the
intermediate dx node block that you are looking for. You need to do
the dx_probe() to find its parent block anyway, in order to update it.
And if you don't find a pointer to that intermediate node, then it
must not be an a dx node --- or the htree pointers are corrupted. In
the case of metadata_csum and a dx_tail, that sequence should never
occur normally, so if you don't find an entry for that block when
doing a dx_probe(), it's likely the directory structures have gotten
corrupted.
- Ted
next prev parent reply other threads:[~2019-08-26 3:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 18:27 [PATCH] ext4: attempt to shrink directory on dentry removal Harshad Shirwadkar
2019-08-24 2:31 ` Theodore Y. Ts'o
2019-08-26 2:46 ` harshad shirwadkar
2019-08-26 3:19 ` Theodore Y. Ts'o [this message]
2019-08-26 5:07 ` Andreas Dilger
2019-08-26 21:46 ` harshad shirwadkar
2019-08-27 2:38 ` Theodore Y. Ts'o
2019-08-27 20:53 ` Andreas Dilger
2019-08-27 2:27 ` Theodore Y. Ts'o
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=20190826031926.GC4918@mit.edu \
--to=tytso@mit.edu \
--cc=harshadshirwadkar@gmail.com \
--cc=linux-ext4@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.