linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Bob Peterson <rpeterso@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: Add hooks for get_hole_size to generic_block_fiemap
Date: Wed, 13 Aug 2014 09:03:36 +1000	[thread overview]
Message-ID: <20140812230336.GM26465@dastard> (raw)
In-Reply-To: <526123861.4943408.1407776464284.JavaMail.zimbra@redhat.com>

On Mon, Aug 11, 2014 at 01:01:04PM -0400, Bob Peterson wrote:
> Hi,
> 
> I'm just tossing this proof-of-concept patch out there to get some feedback
> from the community. The problem relates to the performance of fiemap on
> sparse files.
> 
> If you have a very big sparse file with huge holes, when those holes are
> encountered, function __generic_block_fiemap iterates for every block
> with "start_blk++;". This is extremely slow, inefficient and time consuming.
> A simple command like:
> 
>    dd if=/dev/zero of=/mnt/gfs2/filler-P bs=1 count=1 seek=1P
> 
> will cause some file systems to run continuously for days or weeks given
> a filefrag command, even though the file contains only a single byte.
> I encountered it with GFS2.
> 
> Sure, GFS2 does not need to call the generic fiemap. I can (and did)
> easily implement a GFS2-specific block_fiemap that detects and skips holes.
> My question is: Does it make sense to extend this to other file systems?
> 
> This patch just adds a hook in function generic_block_fiemap to call a
> fs-specific function to return a hole size. That way, the function
> doesn't have to do a block-by-block search when a hole is encountered.

Perhaps it would be better to create a new helper that can return
the hole size rather than extend the helper everyone is using. The
implementation can be shared, but then other filesystems can make
the choice of which implementation they use and you don't need to
touch them at all here. i.e. add generic_block_fiemap_holesize()
rather than modify the generic_block_fiemap() API.

> I realize not all file systems can make use of this concept, so I don't
> know if this is valuable or not. I thought I'd toss it out there to see
> what people think.

If you make it a separate interface, it doesn't matter whether other
filesystems can make use of it or not ;)

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2014-08-12 23:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <998022701.4933159.1407775414413.JavaMail.zimbra@redhat.com>
2014-08-11 17:01 ` [PATCH] fs: Add hooks for get_hole_size to generic_block_fiemap Bob Peterson
2014-08-12 23:03   ` Dave Chinner [this message]
2014-08-13 17:53   ` [PATCH][TRY #2] fs: Add hooks for get_hole_size to __generic_block_fiemap Bob Peterson

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=20140812230336.GM26465@dastard \
    --to=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rpeterso@redhat.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 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).