mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
Cc: linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fat: preallocate space before expanding in fat_cont_expand()
Date: Sat, 24 Oct 2026 00:44:04 +0900	[thread overview]
Message-ID: <87ld7oqv5n.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <87wlr8j2gs.fsf@mail.parknet.co.jp>

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

>>  static int fat_cont_expand(struct inode *inode, loff_t size)
>>  {
>>  	struct address_space *mapping = inode->i_mapping;
>>  	loff_t start = inode->i_size, count = size - inode->i_size;
>>  	int err;
>>  
>> -	err = generic_cont_expand_simple(inode, size);
>> +	/*
>> +	 * Preallocating space here is more efficient than during
>> +	 * generic_cont_expand_simple() because of batching.
>> +	 */
>> +	err = inode_newsize_ok(inode, size);
>>  	if (err)
>>  		goto out;
>> +	err = fat_preallocate(inode, size);
>> +	if (err)
>> +		goto out;
>> +	err = generic_cont_expand_simple(inode, size);
>> +	if (err) {
>> +		down_write(&MSDOS_I(inode)->truncate_lock);
>> +		fat_truncate_blocks(inode, inode->i_size);
>> +		up_write(&MSDOS_I(inode)->truncate_lock);
>
> Is this fat_truncate_blocks() really required?
>
>> +		goto out;
>> +	}

And maybe this will change the user visible behavior for ENOSPC. (I'm
not sure if it is ok for now)

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2026-10-23 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 15:40 Matheus Alves de Almeida
2026-10-23  7:33 ` OGAWA Hirofumi
2026-10-23 15:44   ` OGAWA Hirofumi [this message]
2026-10-23 21:23     ` Matheus Alves de Almeida
2026-10-24  0:06       ` OGAWA Hirofumi
2026-10-23 21:21   ` Matheus Alves de Almeida
2026-10-23 23:48     ` OGAWA Hirofumi

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=87ld7oqv5n.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matheus.aalmeida@inf.ufrgs.br \
    /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

all inboxes | Powered by JetHome®