lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHB1NagYz+BLXdEtUa7C_6-A6DDCT9Q+A7Vg6PXSwm9D7ZyAkQ@mail.gmail.com>
Date: Sat, 27 Sep 2025 16:11:54 +0800
From: Julian Sun <sunjunchao2870@...il.com>
To: Harshad Shirwadkar <harshadshirwadkar@...il.com>
Cc: adilger@...ger.ca, jack@...e.cz, tytso@....edu, 
	Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH v2 3/3] ext4: reimplement ext4_empty_dir() using is_dirent_block_empty

On Sat, Sep 27, 2025 at 4:05 PM Julian Sun <sunjunchao2870@...il.com> wrote:
>
> On Mon, 2020-04-06 at 23:46 -0700, Harshad Shirwadkar wrote:
> > The new function added in this patchset adds an efficient way to
> > check if a dirent block is empty. Based on that, reimplement
> > ext4_empty_dir().
> >
> > This is a new patch added in V2.
> >
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@...il.com>
> > Reviewed-by: Andreas Dilger <adilger@...ger.ca>
> > ---
> >  fs/ext4/namei.c | 39 ++++++++++++++++-----------------------
> >  1 file changed, 16 insertions(+), 23 deletions(-)
> >
> > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> > index 39360c442dad..dae7d15fba5c 100644
> > --- a/fs/ext4/namei.c
> > +++ b/fs/ext4/namei.c
> > @@ -3179,6 +3179,7 @@ bool ext4_empty_dir(struct inode *inode)
> >         struct buffer_head *bh;
> >         struct ext4_dir_entry_2 *de;
> >         struct super_block *sb;
> > +       ext4_lblk_t lblk;
> >
> >         if (ext4_has_inline_data(inode)) {
> >                 int has_inline_data = 1;
> > @@ -3218,34 +3219,26 @@ bool ext4_empty_dir(struct inode *inode)
> >                 brelse(bh);
> >                 return true;
> >         }
> > -       offset += ext4_rec_len_from_disk(de->rec_len, sb-
> > > s_blocksize);
> > -       while (offset < inode->i_size) {
> > -               if (!(offset & (sb->s_blocksize - 1))) {
> > -                       unsigned int lblock;
> > -                       brelse(bh);
> > -                       lblock = offset >> EXT4_BLOCK_SIZE_BITS(sb);
> > -                       bh = ext4_read_dirblock(inode, lblock,
> > EITHER);
> > -                       if (bh == NULL) {
> > -                               offset += sb->s_blocksize;
> > -                               continue;
> > -                       }
> > -                       if (IS_ERR(bh))
> > -                               return true;
> > -               }
> > -               de = (struct ext4_dir_entry_2 *) (bh->b_data +
> > -                                       (offset & (sb->s_blocksize -
> > 1)));
> > -               if (ext4_check_dir_entry(inode, NULL, de, bh,
> > -                                        bh->b_data, bh->b_size,
> > offset)) {
> > -                       offset = (offset | (sb->s_blocksize - 1)) +
> > 1;
> > +       de = ext4_next_entry(de, sb->s_blocksize);
> > +       if (!is_empty_dirent_block(inode, bh, de)) {
> > +               brelse(bh);
> > +               return false;
> > +       }
> > +       brelse(bh);
> > +
> > +       for (lblk = 1; lblk < inode->i_size >>
> > EXT4_BLOCK_SIZE_BITS(sb);
> > +                       lblk++) {
> > +               bh = ext4_read_dirblock(inode, lblk, EITHER);
> > +               if (bh == NULL)
> >                         continue;
> > -               }
> > -               if (le32_to_cpu(de->inode)) {
> > +               if (IS_ERR(bh))
> > +                       return true;
> > +               if (!is_empty_dirent_block(inode, bh, NULL)) {
> >                         brelse(bh);
> >                         return false;
> >                 }
> > -               offset += ext4_rec_len_from_disk(de->rec_len, sb-
> > > s_blocksize);
> > +               brelse(bh);
> >         }
> > -       brelse(bh);
> >         return true;
> >  }
> >
>
> Hi,
>
> I’ve recently been looking into the ext4 directory shrinking problem
> and was considering trying to add this feature myself. To my surprise,
> I found that this patch set had already implemented it and even
> received Reviewed-by. I’m curious whether it was never merged, or if it
> was merged and later reverted?
>
> If possible, is there anything I could do to contribute to moving this
> patch set forward toward being merged?

cc ext4 mail list.
>
> Thanks.
>
>


-- 
Julian Sun <sunjunchao2870@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ