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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHB1NahE1K--Ym_hUxW7yzXcrbTQjjXDNV9MViNsRf8c=JqiZA@mail.gmail.com>
Date: Tue, 7 Jan 2025 10:58:44 +0800
From: Julian Sun <sunjunchao2870@...il.com>
To: Jan Kara <jack@...e.cz>
Cc: linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org, tytso@....edu, 
	adilger.kernel@...ger.ca, boyu.mt@...bao.com, tm@....ma
Subject: Re: [PATCH 5/7] ext4: Refactor out ext4_da_write_inline_data_begin()

Jan Kara <jack@...e.cz> 于2025年1月6日周一 23:39写道:
>
> On Fri 20-12-24 23:16:23, Julian Sun wrote:
> > Refactor ext4_da_write_inline_data_begin() to simplify its
> > implementation by directly invoking ext4_generic_write_inline_data().
> >
> > Signed-off-by: Julian Sun <sunjunchao2870@...il.com>
> > ---
> >  fs/ext4/inline.c | 74 ++----------------------------------------------
> >  1 file changed, 2 insertions(+), 72 deletions(-)
> >
> > diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> > index 7eaa578e1021..5dd91524b2ca 100644
> > --- a/fs/ext4/inline.c
> > +++ b/fs/ext4/inline.c
> > @@ -979,78 +979,8 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
> >                                   struct folio **foliop,
> >                                   void **fsdata)
> >  {
>
> Since there's a single caller of this function, I guess there's no point
> for this wrapper now. Just call ext4_generic_write_inline_data() directly
> from the call site. Otherwise the patch looks good.

Reasonable. I will fix it in the next version. Thanks!
>
>                                                                 Honza
>
> > -     int ret;
> > -     handle_t *handle;
> > -     struct folio *folio;
> > -     struct ext4_iloc iloc;
> > -     int retries = 0;
> > -
> > -     ret = ext4_get_inode_loc(inode, &iloc);
> > -     if (ret)
> > -             return ret;
> > -
> > -retry_journal:
> > -     handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
> > -     if (IS_ERR(handle)) {
> > -             ret = PTR_ERR(handle);
> > -             goto out;
> > -     }
> > -
> > -     ret = ext4_prepare_inline_data(handle, inode, pos + len);
> > -     if (ret && ret != -ENOSPC)
> > -             goto out_journal;
> > -
> > -     if (ret == -ENOSPC) {
> > -             ext4_journal_stop(handle);
> > -             ret = ext4_da_convert_inline_data_to_extent(mapping,
> > -                                                         inode,
> > -                                                         fsdata);
> > -             if (ret == -ENOSPC &&
> > -                 ext4_should_retry_alloc(inode->i_sb, &retries))
> > -                     goto retry_journal;
> > -             goto out;
> > -     }
> > -
> > -     /*
> > -      * We cannot recurse into the filesystem as the transaction
> > -      * is already started.
> > -      */
> > -     folio = __filemap_get_folio(mapping, 0, FGP_WRITEBEGIN | FGP_NOFS,
> > -                                     mapping_gfp_mask(mapping));
> > -     if (IS_ERR(folio)) {
> > -             ret = PTR_ERR(folio);
> > -             goto out_journal;
> > -     }
> > -
> > -     down_read(&EXT4_I(inode)->xattr_sem);
> > -     if (!ext4_has_inline_data(inode)) {
> > -             ret = 0;
> > -             goto out_release_page;
> > -     }
> > -
> > -     if (!folio_test_uptodate(folio)) {
> > -             ret = ext4_read_inline_folio(inode, folio);
> > -             if (ret < 0)
> > -                     goto out_release_page;
> > -     }
> > -     ret = ext4_journal_get_write_access(handle, inode->i_sb, iloc.bh,
> > -                                         EXT4_JTR_NONE);
> > -     if (ret)
> > -             goto out_release_page;
> > -
> > -     up_read(&EXT4_I(inode)->xattr_sem);
> > -     *foliop = folio;
> > -     brelse(iloc.bh);
> > -     return 1;
> > -out_release_page:
> > -     up_read(&EXT4_I(inode)->xattr_sem);
> > -     folio_unlock(folio);
> > -     folio_put(folio);
> > -out_journal:
> > -     ext4_journal_stop(handle);
> > -out:
> > -     brelse(iloc.bh);
> > -     return ret;
> > +     return ext4_generic_write_inline_data(mapping, inode, pos, len,
> > +                                           foliop, fsdata, true);
> >  }
> >
> >  #ifdef INLINE_DIR_DEBUG
> > --
> > 2.39.5
> >
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ