From: Marek Behun <marek.behun@nic.cz>
To: Filipe Manana <fdmanana@gmail.com>
Cc: Chris Murphy <lists@colorremedies.com>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: when does btrfs create sparse extents?
Date: Thu, 23 Apr 2020 13:42:48 +0200 [thread overview]
Message-ID: <20200423134248.458cd87c@nic.cz> (raw)
In-Reply-To: <CAL3q7H7eE4wFi95JaTYRPOrTQiihOSEqV-W4hT1t-9-ptUHGrg@mail.gmail.com>
On Thu, 23 Apr 2020 11:49:16 +0100
Filipe Manana <fdmanana@gmail.com> wrote:
> On Wed, Apr 22, 2020 at 10:00 PM Marek Behun <marek.behun@nic.cz> wrote:
> >
> > On Wed, 22 Apr 2020 14:44:46 -0600
> > Chris Murphy <lists@colorremedies.com> wrote:
> >
> > > e.g. from a 10m file created with truncate on two Btrfs file systems
> > >
> > > original holes format (default)
> > >
> > > item 6 key (257 EXTENT_DATA 0) itemoff 15768 itemsize 53
> > > generation 7412 type 1 (regular)
> > > extent data disk byte 0 nr 0
> > > extent data offset 0 nr 10485760 ram 10485760
> > > extent compression 0 (none)
> > >
> > > On a file system with no-holes feature set, this item simply doesn't
> > > exist. I think basically it works by inference. Both kinds of files
> > > have size in the INODE_ITEM, e.g.
> > >
> > > item 4 key (257 INODE_ITEM 0) itemoff 32245 itemsize 160
> > > generation 889509 transid 889509 size 10485760 nbytes 0
> > >
> > > Sparse extents are explicitly stated in the original format with disk
> > > byte 0 in an EXTENT_DATA item; whereas in the newer format, sparse
> > > extents exist whenever EXTENT_DATA items don't completely describe the
> > > file's size.
> >
> > Ok this means that U-Boot currently gained support for the original
> > sparse extents.
>
> To clear any confusion, what you mean by sparse extents is actually holes.
> The concept of sparse files exists (files with holes, regions of a
> file for which there is no allocated extent), but not sparse extents.
>
> >
> > I fear that current u-boot does not handle the new no-holes feature.
>
> The no-holes feature has been around since 2013, not exactly new, but
> it's not the default yet when creating a new filesystem.
>
> As it has been mentioned earlier by Chris, it just removes the need
> for explicitly having metadata representing holes.
> When not using the no-holes feature, there is an explicit file extent
> item pointing to a disk location of 0 (disk_bytenr field has a value
> of 0) for each file hole.
> When using no-holes, there's no such file extent item - btrfs knows
> about the hole by checking that there is a gap between two consecutive
> file extent items (both having a disk_bytenr > 0).
This I already understand. My main question though is: does kernel or
btrfs do checking (at least sometimes) when writing a block of data onto
disk if this block is all zero, and if yes, then this block is written
as a hole (either by writing hole item or not writing anything)?
Or does this happen ONLY when requested by userspace?
Because for the love of god I cannot find why our kernel is being
written this way onto disk - the installer doesn't explicitly request
for PUNCH_HOLES nor anything, as far as I looked.
Marek
Marek
next prev parent reply other threads:[~2020-04-23 11:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 18:52 when does btrfs create sparse extents? Marek Behun
2020-04-22 20:26 ` Chris Murphy
2020-04-22 20:44 ` Marek Behun
2020-04-22 20:44 ` Chris Murphy
2020-04-22 20:58 ` Marek Behun
2020-04-22 21:05 ` Chris Murphy
2020-04-23 10:49 ` Filipe Manana
2020-04-23 11:42 ` Marek Behun [this message]
2020-04-23 11:51 ` Filipe Manana
2020-04-23 12:05 ` Marek Behun
2020-04-23 12:39 ` Filipe Manana
2020-04-23 19:50 ` Chris Murphy
2020-04-23 5:57 ` Andrei Borzenkov
2020-04-23 6:45 ` Marek Behun
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=20200423134248.458cd87c@nic.cz \
--to=marek.behun@nic.cz \
--cc=fdmanana@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=lists@colorremedies.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.