From: Jan Kara <jack@suse.cz>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Jan Kara <jack@suse.cz>, Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH 4/4] ext4: Improve scalability of ext4 orphan file handling
Date: Thu, 8 Jul 2021 20:30:22 +0200 [thread overview]
Message-ID: <20210708183022.GB11179@quack2.suse.cz> (raw)
In-Reply-To: <20210630134635.fcdlsase45iotavs@work>
On Wed 30-06-21 15:46:35, Lukas Czerner wrote:
> On Wed, Jun 16, 2021 at 12:56:55PM +0200, Jan Kara wrote:
> > @@ -28,28 +42,24 @@ static int ext4_orphan_file_add(handle_t *handle, struct inode *inode)
> > */
> > return -ENOSPC;
> > }
> > - oi->of_binfo[i].ob_free_entries--;
> > - spin_unlock(&oi->of_lock);
> >
> > - /*
> > - * Get access to orphan block. We have dropped of_lock but since we
> > - * have decremented number of free entries we are guaranteed free entry
> > - * in our block.
> > - */
> > ret = ext4_journal_get_write_access(handle, inode->i_sb,
> > oi->of_binfo[i].ob_bh, EXT4_JTR_ORPHAN_FILE);
> > if (ret)
> > return ret;
> >
> > bdata = (__le32 *)(oi->of_binfo[i].ob_bh->b_data);
> > - spin_lock(&oi->of_lock);
> > /* Find empty slot in a block */
> > - for (j = 0; j < inodes_per_ob && bdata[j]; j++);
> > - BUG_ON(j == inodes_per_ob);
> > - bdata[j] = cpu_to_le32(inode->i_ino);
> > + j = 0;
> > + do {
> > + while (bdata[j]) {
> > + if (++j >= inodes_per_ob)
> > + j = 0;
> > + }
> > + } while (cmpxchg(&bdata[j], 0, cpu_to_le32(inode->i_ino)) != 0);
>
> In case there is any sort of corruption on disk or in memory we can
> potentially get stuck here forever right ? Not sure if that matters
> all that much.
>
> Other than that it looks good and negates some of my comments on the
> previous patch, sorry about that ;)
>
> You can add
>
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Good point. I've added some limitations (and cond_resched()) to the loop so
that we cannot loop indefinitely. Thanks for review!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-07-08 18:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 10:56 [PATCH 0/4 v3] ext4: Speedup orphan file handling Jan Kara
2021-06-16 10:56 ` [PATCH 1/4] ext4: Support for checksumming from journal triggers Jan Kara
2021-06-16 19:56 ` Andreas Dilger
2021-06-17 8:24 ` Jan Kara
2021-06-16 10:56 ` [PATCH 2/4] ext4: Move orphan inode handling into a separate file Jan Kara
2021-06-17 3:24 ` Andreas Dilger
2021-06-17 6:56 ` kernel test robot
2021-06-17 12:40 ` kernel test robot
2021-06-16 10:56 ` [PATCH 3/4] ext4: Speedup ext4 orphan inode handling Jan Kara
2021-06-17 7:44 ` Andreas Dilger
2021-06-17 8:22 ` Jan Kara
2021-06-30 13:25 ` Lukas Czerner
2021-06-30 15:54 ` Darrick J. Wong
2021-06-16 10:56 ` [PATCH 4/4] ext4: Improve scalability of ext4 orphan file handling Jan Kara
2021-06-30 13:46 ` Lukas Czerner
2021-07-08 18:30 ` Jan Kara [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-22 11:21 [PATCH 0/3 v2] ext4: Speedup " Jan Kara
2015-05-22 11:21 ` [PATCH 4/4] ext4: Improve scalability of ext4 " Jan Kara
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=20210708183022.GB11179@quack2.suse.cz \
--to=jack@suse.cz \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).