From: Jeff Liu <jeff.liu@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
lsf-pc@lists.linux-foundation.org,
Jim Meyering <jim@meyering.net>
Subject: Re: [LSF/MM TOPIC] [ATTEND] Container disk quota and lseek(2) upon shared extents
Date: Wed, 30 Jan 2013 12:24:24 +0800 [thread overview]
Message-ID: <5108A078.8000108@oracle.com> (raw)
In-Reply-To: <20130130024113.GF7255@disturbed.disaster>
On 01/30/2013 10:41 AM, Dave Chinner wrote:
> On Wed, Jan 30, 2013 at 12:37:08AM +0800, Jeff Liu wrote:
>> On 01/29/2013 11:14 PM, Jan Kara wrote:
>>> On Tue 29-01-13 22:44:24, Jeff Liu wrote:
>>>> I'd like to discuss the following problems on LSF:
> ....
>>>> Still sounds nothing because we have FIEMAP...:( But consider the bad interface
>>>> and error prone when I improving cp(1) through it for sparse files, it will extends
>>>> the ugly tentacles of FIEMAP into du(1) again that the maintainer of coreutils(Jim, CC-ed)
>>>> don't like it at all, and I also want to avoid if possible...
>>>>
>>>> How about if we add a new whence type to lseek(2) for this function? lseek has very clear
>>>> interface and works very well for SEEK_DATA/SEEK_HOLE, most likely could works fine for
>>>> shared extents IMHO.
>>> Well, I can hardly imagine how such lseek(2) interface would look to be
>>> useful for identifying shared extents among different files. Do you have
>>> something particular in mind?
>> lseek(2) is not used for identifying shared extents among files. It would be improved and
>> called to find out and return an desired extent which is reflinked or cloned with a particular
>> whence, the underlying file system should be improved accordingly.
>>
>> To say Btrfs, if we performed btrfs_ioctl_clone from source file A to target B, run du(1)
>> against both files, it would show double space although only 1/2 space is really used/reserved
>> upon COW.
>>
>> If we can mark the cloned extents of file with a special flag(to say EXTENT_MAP_CLONED), then
>> call lseek(fd, offset, SEEK_CLONE or ?), it would return the offset of a cloned extent which is
>> equal or beyond the given offset, so we can find out all the cloned extents upon a file which
>> would be used for the disk space accounting in user space tools.
>
> Why do you need lseek to find this?
I had originally thought to call lseek to get the cloned extents only,
ranther than fetching different kinds of extents, and then call FIEMAP
to get the physical block offset upon the logical.
> Couldn't we just add a filter
> option to fiemap to ensure that it only returns extents in the file
> that match the filter? You could then implement what you want with a
> single call rather than having to indirectly iterate the extent map
> with lseek() and then calling FIEMAP on each of the
> regions discovered by lseek.....
Really a nice point, thank you!
-Jeff
prev parent reply other threads:[~2013-01-30 4:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 14:44 [LSF/MM TOPIC] [ATTEND] Container disk quota and lseek(2) upon shared extents Jeff Liu
2013-01-29 15:14 ` Jan Kara
2013-01-29 16:37 ` Jeff Liu
2013-01-29 19:19 ` Jan Kara
2013-01-30 3:49 ` Jeff Liu
2013-01-30 2:41 ` Dave Chinner
2013-01-30 4:24 ` Jeff Liu [this message]
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=5108A078.8000108@oracle.com \
--to=jeff.liu@oracle.com \
--cc=david@fromorbit.com \
--cc=jack@suse.cz \
--cc=jim@meyering.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lsf-pc@lists.linux-foundation.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 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).