All of lore.kernel.org
 help / color / mirror / Atom feed
From: hehuiwen <huiwen.he@linux.dev>
To: Steve French <smfrench@gmail.com>
Cc: linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, senozhatsky@chromium.org,
	dhowells@redhat.com, metze@samba.org, chenxiaosong@kylinos.cn,
	linux-cifs@vger.kernel.org
Subject: Re: [PATCH v2 3/9] smb/client: handle smb2_set_sparse() failure in EOF-extending fallocate
Date: Wed, 24 Jun 2026 12:04:24 +0800	[thread overview]
Message-ID: <392ac41f-7f54-465f-a514-0293300747d6@linux.dev> (raw)
In-Reply-To: <CAH2r5mtLZTXGcCGy5y24CH_uDRr6tPq21i6wS4SZHhqHn7o13w@mail.gmail.com>

Hi Steve,

Yes, that is possible. I checked ext4, XFS and btrfs with examples like:

         truncate -s 1M file
         fallocate -n -o 2M -l 1M file
         filefrag -v file

and:

         truncate -s 1M file
         fallocate -o 2M -l 1M file
         filefrag -v file

With FALLOC_FL_KEEP_SIZE, the file size stays at 1M while the range
[2M, 3M) is preallocated. Without FALLOC_FL_KEEP_SIZE, the file size 
grows to 3M, but the filesystems still only allocate the requested
range [2M, 3M). Holes before that range are not removed.

Patch 3 only changes the error handling around the existing
smb2_set_sparse(..., false) call. I agree that clearing the sparse
attribute is not a general byte-range allocation mechanism.

Patch 9 handles the sparse EOF-adjacent case differently: small ranges 
are allocated by writing zeroes only to the requested range, and larger 
ranges remain unsupported. That avoids clearing the sparse attribute
for this case.

Thanks,
Huiwen


在 2026/6/24 10:48, Steve French 写道:
> Would it be possible in Linux to have a sparse file but still with
> space reserved beyond end of file?  In other words are there cases
> where you could have a file with holes in it in Linux which still
> fallocated beyond end of file.  What happens to ext4, xfs, btrfs if
> you try that?  Does fallocate beyond of file remove all holes in a
> (sparse) file?


  reply	other threads:[~2026-06-24  4:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24  2:15 [PATCH v2 0/9] smb/client: fix mode 0 fallocate handling Huiwen He
2026-06-24  2:15 ` [PATCH v2 1/9] smb/client: name the default fallocate mode Huiwen He
2026-06-24  2:15 ` [PATCH v2 2/9] smb/client: preserve errors from smb2_set_sparse() Huiwen He
2026-06-24  2:15 ` [PATCH v2 3/9] smb/client: handle smb2_set_sparse() failure in EOF-extending fallocate Huiwen He
2026-06-24  2:48   ` Steve French
2026-06-24  4:04     ` hehuiwen [this message]
2026-06-24  2:15 ` [PATCH v2 4/9] smb/client: handle smb2_set_sparse() failure in non-extending fallocate Huiwen He
2026-06-24  2:15 ` [PATCH v2 5/9] smb/client: do not account EOF extension as allocation Huiwen He
2026-06-24  2:15 ` [PATCH v2 6/9] smb/client: verify allocation after EOF-extending fallocate Huiwen He
2026-06-24  2:15 ` [PATCH v2 7/9] smb/client: handle overlapping allocated ranges in fallocate Huiwen He
2026-06-24  2:15 ` [PATCH v2 8/9] smb/client: reduce fallocate zero buffer allocation Huiwen He
2026-06-24  2:15 ` [PATCH v2 9/9] smb/client: emulate small sparse fallocate ranges at EOF Huiwen He

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=392ac41f-7f54-465f-a514-0293300747d6@linux.dev \
    --to=huiwen.he@linux.dev \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=dhowells@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.