patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>
Cc: Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: [PATCH 3/3] scripts/make-erofs.sh: Avoid unneeded calls to mkdir
Date: Tue, 23 Sep 2025 17:41:39 -0400	[thread overview]
Message-ID: <323ce8e0-8311-417d-8de7-8c8eaf02e78e@gmail.com> (raw)
In-Reply-To: <87h5wtknfq.fsf@alyssa.is>


[-- Attachment #1.1.1: Type: text/plain, Size: 2324 bytes --]

On 9/23/25 14:56, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
> 
>> On 9/23/25 10:35, Alyssa Ross wrote:
>>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>>
>>>> On 9/21/25 14:36, Alyssa Ross wrote:
>>>>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>>>>
>>>>>> Don't call it if the target directory already exists.
>>>>>>
>>>>>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>>>>>> ---
>>>>>>  scripts/make-erofs.sh | 11 ++++++++---
>>>>>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
>>>>>> index ac62a65f53e0b6417b164f475a537960fc5203bc..30b83b0b41cbe7bc4fd7786cfcdddcf10c78cc5a 100755
>>>>>> --- a/scripts/make-erofs.sh
>>>>>> +++ b/scripts/make-erofs.sh
>>>>>> @@ -44,10 +44,15 @@ while read -r arg1; do
>>>>>>  	# a subset of all paths, but this subset includes all of
>>>>>>  	# the ones passed in practice other than /.
>>>>>>  	case $arg2 in
>>>>>> -	(*/*) parent=${arg2%/*};;
>>>>>> -	(*) parent=.;;
>>>>>> +	(*/*)
>>>>>> +		# Make the parent directory if needed
>>>>>> +		parent=$root/${arg2%/*}
>>>>>> +		if [ ! -d "$parent" ]; then mkdir -p -- "$parent"; fi
>>>>>> +		;;
>>>>>> +	(*)
>>>>>> +		# Parent $root which definitely exists
>>>>>> +		;;
>>>>>>  	esac
>>>>>> -	mkdir -p -- "$root/$parent"
>>>>>>  	cp -RT -- "$arg1" "$root/$arg2"
>>>>>>  done
>>>>>
>>>>> I saw a statistically significant speedup in hyperfine. :)
>>>>>
>>>>> Reviewed-by: Alyssa Ross <hi@alyssa.is>
>>>>
>>>> Yay!  This is independent of the rest of the series, so
>>>> feel free to commit.
> 
> It actually doesn't seem to be.  I get a "Permission denied" build
> failure when I apply it on top of 0fcf508 ("scripts/make-erofs.sh: Avoid
> calls to dirname"), but I think I didn't see that failure when I applied
> patch 1 as well.  We can either just keep this in the queue until we've
> figured out what to do about patch 1, or you can investigate and
> resubmit a standalone version of this patch.  Up to you.

I think it is best to include patch 1.  It speeds things up, and
I consider the complexity to not be a serious problem.  The code
that generates the file lists already guarantees this.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2025-09-23 21:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 23:26 [PATCH 0/3] Optimize scripts/make-erofs.sh Demi Marie Obenour
2025-09-19 23:26 ` [PATCH 1/3] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod Demi Marie Obenour
2025-09-21 11:31   ` Alyssa Ross
2025-09-21 15:56     ` Demi Marie Obenour
2025-09-21 16:15       ` Alyssa Ross
2025-09-21 17:12         ` Demi Marie Obenour
2025-09-21 18:06         ` Demi Marie Obenour
2025-09-19 23:26 ` [PATCH 2/3] scripts/make-erofs.sh: Avoid calls to dirname Demi Marie Obenour
2025-09-21 11:40   ` Alyssa Ross
2025-09-23 18:54   ` Alyssa Ross
2025-09-19 23:26 ` [PATCH 3/3] scripts/make-erofs.sh: Avoid unneeded calls to mkdir Demi Marie Obenour
2025-09-21 18:36   ` Alyssa Ross
2025-09-21 18:37     ` Demi Marie Obenour
2025-09-23 14:35       ` Alyssa Ross
2025-09-23 18:06         ` Demi Marie Obenour
2025-09-23 18:56           ` Alyssa Ross
2025-09-23 21:41             ` Demi Marie Obenour [this message]

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=323ce8e0-8311-417d-8de7-8c8eaf02e78e@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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).