linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Efficient handling of sparse files
Date: Mon, 28 Feb 2005 20:40:57 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.60.0502282037110.27293@hermes-1.csi.cam.ac.uk> (raw)
In-Reply-To: <20050228174149.GA28741@parcelfarce.linux.theplanet.co.uk>

On Mon, 28 Feb 2005, Matthew Wilcox wrote:
> This problem came up with the systemimager program which uses rsync to
> install files from a master server to many clients.  Red Hat has a system
> user with uid 2^32-1 which causes lastlog to grow to 1.2GB in size.
> rsync does understand the concept of sparse files (with the -S flag), but
> it has to read every block to discover that it is indeed empty.  This sucks.
> 
> I was wondering if we could introduce a new system call (or ioctl?) that,
> given an fd would find the next block with data in it.  We could use the
> ->bmap method ... except that has dire warnings about adding new callers
> and viro may soon be in testicle-gouging range.
> 
> One system interface hack would be to introduce lseek(fd, 0, SEEK_DATA)
> ... but without permission to reuse ->bmap for this purpose, it's
> pointless to discuss user interfaces.
> 
> Suggestions?

Please keep one thing in mind and that is that there are file systems 
where ->bmap actually makes no sense whatsoever - for example NTFS where 
you can have compressed or encrypted file in both of which you do not have 
any blocks on disk where you can read/write the actual data and in 
addition to those you also have resident files where the file content 
itself is stored inside the on-disk inode (at a variable and unaligned 
offset) so here again there is no block a ->bmap could return that would 
only contain the file data - it would also contain metadata and the data 
would certainly not start at a block boundary.

This is one of the reasons why noone should be using ->bmap.  It is a 
stupid interface that only fits very particular sets of file systems and 
cannot be applied generically.

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

  parent reply	other threads:[~2005-02-28 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-28 17:41 Efficient handling of sparse files Matthew Wilcox
2005-02-28 17:44 ` Jeremy Allison
2005-02-28 20:13   ` Bryan Henderson
2005-02-28 21:49     ` Jamie Lokier
2005-03-01 18:37       ` Bryan Henderson
2005-02-28 18:57 ` Szakacsits Szabolcs
2005-02-28 19:55 ` Zach Brown
2005-02-28 20:40 ` Anton Altaparmakov [this message]
2005-02-28 20:53   ` Zach Brown
2005-03-01  7:50     ` Anton Altaparmakov

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=Pine.LNX.4.60.0502282037110.27293@hermes-1.csi.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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).