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
| ||
|
Message-ID: <3lhwbxlfcqt5ou3z2xzo7o7zdvpmgldju33cd2wqnvsszfhnaf@i2qkwhrja7be> Date: Wed, 2 Jul 2025 16:34:24 +0200 From: Jan Kara <jack@...e.cz> To: Zhang Yi <yi.zhang@...weicloud.com> Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz, ojaswin@...ux.ibm.com, sashal@...nel.org, yi.zhang@...wei.com, libaokun1@...wei.com, yukuai3@...wei.com, yangerkun@...wei.com Subject: Re: [PATCH v3 08/10] ext4: reserved credits for one extent during the folio writeback On Tue 01-07-25 21:06:33, Zhang Yi wrote: > From: Zhang Yi <yi.zhang@...wei.com> > > After ext4 supports large folios, reserving journal credits for one > maximum-ordered folio based on the worst case cenario during the > writeback process can easily exceed the maximum transaction credits. > Additionally, reserving journal credits for one page is also no > longer appropriate. > > Currently, the folio writeback process can either extend the journal > credits or initiate a new transaction if the currently reserved journal > credits are insufficient. Therefore, it can be modified to reserve > credits for only one extent at the outset. In most cases involving > continuous mapping, these credits are generally adequate, and we may > only need to perform some basic credit expansion. However, in extreme > cases where the block size and folio size differ significantly, or when > the folios are sufficiently discontinuous, it may be necessary to > restart a new transaction and resubmit the folios. > > Suggested-by: Jan Kara <jack@...e.cz> > Signed-off-by: Zhang Yi <yi.zhang@...wei.com> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@...e.cz> Honza > --- > fs/ext4/inode.c | 25 ++++++++----------------- > 1 file changed, 8 insertions(+), 17 deletions(-) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 3230734a3014..ceaede80d791 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -2546,21 +2546,6 @@ static int mpage_map_and_submit_extent(handle_t *handle, > return err; > } > > -/* > - * Calculate the total number of credits to reserve for one writepages > - * iteration. This is called from ext4_writepages(). We map an extent of > - * up to MAX_WRITEPAGES_EXTENT_LEN blocks and then we go on and finish mapping > - * the last partial page. So in total we can map MAX_WRITEPAGES_EXTENT_LEN + > - * bpp - 1 blocks in bpp different extents. > - */ > -static int ext4_da_writepages_trans_blocks(struct inode *inode) > -{ > - int bpp = ext4_journal_blocks_per_folio(inode); > - > - return ext4_meta_trans_blocks(inode, > - MAX_WRITEPAGES_EXTENT_LEN + bpp - 1, bpp); > -} > - > static int ext4_journal_folio_buffers(handle_t *handle, struct folio *folio, > size_t len) > { > @@ -2917,8 +2902,14 @@ static int ext4_do_writepages(struct mpage_da_data *mpd) > * not supported by delalloc. > */ > BUG_ON(ext4_should_journal_data(inode)); > - needed_blocks = ext4_da_writepages_trans_blocks(inode); > - > + /* > + * Calculate the number of credits needed to reserve for one > + * extent of up to MAX_WRITEPAGES_EXTENT_LEN blocks. It will > + * attempt to extend the transaction or start a new iteration > + * if the reserved credits are insufficient. > + */ > + needed_blocks = ext4_chunk_trans_blocks(inode, > + MAX_WRITEPAGES_EXTENT_LEN); > /* start a new transaction */ > handle = ext4_journal_start_with_reserve(inode, > EXT4_HT_WRITE_PAGE, needed_blocks, rsv_blocks); > -- > 2.46.1 > -- Jan Kara <jack@...e.com> SUSE Labs, CR
Powered by blists - more mailing lists