From: Andreas Dilger <adilger@dilger.ca>
To: Tahsin Erdogan <tahsin@google.com>
Cc: "Theodore Y . Ts'o" <tytso@mit.edu>,
Ext4 Developers List <linux-ext4@vger.kernel.org>,
Jan Kara <jack@suse.cz>
Subject: Re: More thoughts about xattrs, journal credits, and their location
Date: Fri, 14 Jul 2017 15:13:27 -0700 [thread overview]
Message-ID: <3B21155F-4426-413C-AF16-84E594812530@dilger.ca> (raw)
In-Reply-To: <522BF129-AE45-4722-BCC3-0DDC6A078EB8@dilger.ca>
[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]
On Jul 9, 2017, at 14:01, Tahsin Erdogan <tahsin@google.com> wrote:
>> What we could do is have ext4_new_inode check to see if there are
>> enough credits to do add the xattr's (if necessary) in a single
>> commit. If not, what we could do is to add the inode to the orphan
>> list, and then set an inode state flag indicating we have done this.
>> At this point, we *can* break the ext4_new_inode() operation into
>> multiple commits, because if we crash in the middle the inode will be
>> cleaned up when we do the orphan list processing.
>
> This makes sense. Also, we currently add the worst case credit
> estimates of individual set xattr ops and start a journal handle with
> the sum of it. A slight optimization is to do this lazily.
> We can start with enough credits that can get us to a point where it
> is safe to start a new transaction (safe because of orphan addition).
> Then opportunistically extend the credits to get us to the next safe
> point, if that doesn't work, do the orphan add operation and start a
> new transaction. This should handle the worst case scenario and also
> optimize for common case. Also this should in general reduce the
> amount of allocated-but-unused credits which helps parallelism.
What about accumulating the total xattr size in the credits calculation? In
most cases we know the xattr sizes in advance, and if the transaction handle
tracks the total xattr size it can make a good estimate whether the xattrs
will fit in the inode or not rather than using worst-case credits all the time.
>> The downsides of this approach is that it causes the orphan list to be
>> a bottleneck. So we would definitely not want to do this all time.
>
> Yes and I think lazy extend/restart should mitigate this.
Jan had a patch to improve the orphan list performance that never made it
into the kernel by having a per-CPU orphan list or similar.
It recall it got hung up on running out of reserved inodes or similar, which
is an issue we should fix in any case.
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2017-07-14 22:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 2:38 [PATCH 1/2] ext4: skip ext4_init_security() and encryption on ea_inodes Tahsin Erdogan
2017-07-06 2:38 ` [PATCH 2/2] ext4: fix __ext4_new_inode() journal credits calculation Tahsin Erdogan
2017-07-08 5:09 ` Theodore Ts'o
2017-07-08 15:30 ` More thoughts about xattrs, journal credits, and their location Theodore Ts'o
2017-07-09 20:01 ` Tahsin Erdogan
2017-07-10 15:32 ` Theodore Ts'o
[not found] ` <522BF129-AE45-4722-BCC3-0DDC6A078EB8@dilger.ca>
2017-07-14 22:13 ` Andreas Dilger [this message]
2017-07-17 14:42 ` 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=3B21155F-4426-413C-AF16-84E594812530@dilger.ca \
--to=adilger@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tahsin@google.com \
--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).