All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Shishkin <edward.shishkin@gmail.com>
To: Daniel Horne <daniel.horne@gmail.com>
Cc: ReiserFS development mailing list <reiserfs-devel@vger.kernel.org>
Subject: Reiser4 fallocate (was Re: Xattr items)
Date: Mon, 27 Mar 2017 00:11:09 +0300	[thread overview]
Message-ID: <58D82E6D.6080205@gmail.com> (raw)
In-Reply-To: <CAJZSrNKSC7kf=26Mmd9+NSOMVch2FnK+Dhb4MJ62vCR5d4twXw@mail.gmail.com>

Yeah, it would be nice. This feature is used by various virtualization
technologies, i.e. is rather important.

I think that existing low-level framework is enough to implement it.
So, we need to implement a ->fallocate() method of the regular file
plugin. Actually it will resemble write and truncate file operations.
E.g. in default mode it will look like something between write and
expanding truncate. Specifically ->write() inserts extents, allocates
pages, charges the transaction manager to allocate disk space and
issue IO requests. Expanding truncate only inserts extents. And
->fallocate() should insert extents and charge the transaction manager
to allocate disk space. That "charge" is made by allocating a jnode
(per block), capturing it, and making it dirty. The problem is that by
default our transaction manager will try to issue a write IO request
against such jnode, so we'll need to mark that jnode by some special
way, and to teach the lowest-level IO issuer
(write_jnodes_to_disk_extent) to not issue a write request, but
instead uncapture that jnode and make it clean. Also we'll need a new
state of extents (besides the three existing ones):
ALLOCATED_HOLE_EXTENT. The trouble is that we don't have a dedicated
field to store this new state on disk. I suggest to store it in the
high bits of the extent's width. Thus, we'll need to modify (with
masking, etc) extent_get_width, extent_set_width, state_of_extent in
reiser4 kernel module and reiser4progs. Blocks pointed by extent of
that new state are "reserved", they contain garbage. Any attempts to
read blocks pointed by such extents should not issue read IO requests:
respective pages should be filled by zeros. Attempts to write to a
block of such extent should "plug an allocated hole", see the function
plug_hole() - if we can not reuse it, then let's create a similar
function plug_allocated_hole().

Basically that is all. It can happen that I missed some minor issues
though. If you find it is too complicated, then we'll find more easy
task.

Thanks,
Edward.

On 03/25/2017 11:46 PM, Daniel Horne wrote:
> On 24 March 2017 at 20:26, Edward Shishkin<edward.shishkin@gmail.com>  wrote:
>> Could you have a look at fallocate / hole-punching  support, if
>> interesting? For beginning I would recommend to implement it for
>> files managed by unix-file plugin and built of extent items.
> Ok, I'll take a look at that.
>
> Thanks,
> DH


           reply	other threads:[~2017-03-26 21:11 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAJZSrNKSC7kf=26Mmd9+NSOMVch2FnK+Dhb4MJ62vCR5d4twXw@mail.gmail.com>]

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=58D82E6D.6080205@gmail.com \
    --to=edward.shishkin@gmail.com \
    --cc=daniel.horne@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    /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.