bug#6131: [PATCH]: fiemap support for efficient sparse file copy (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Eric Sandeen |
---|---|
Subject: | bug#6131: [PATCH]: fiemap support for efficient sparse file copy |
Date: | Fri, 11 Jun 2010 09:03:29 -0500 |
User-agent: | Thunderbird 2.0.0.24 (Macintosh/20100228) |
jeff.liu wrote:
Sunil Mushran wrote: > On 06/10/2010 04:47 PM, Paul Eggert wrote: >> On 06/09/2010 11:56 PM, jeff.liu wrote: >> >>> Yeah, I just realized that the behaviour I observed is caused by the >>> delay allocation mechanism of >>> the particular FS. >>> >> If the file system is using delayed allocation, then can >> the fiemap ioctl tell us that a file contains a hole (because nothing >> has been >> allocated there), but read() would tell us that the file contains >> nonzero data at the same location >> (because it's sitting in a buffer somewhere)? If so, we'd need to do >> something like invoke >> fdatasync() on the file before issuing the fiemap ioctl, to force >> allocation; or perhaps >> there's another ioctl that will do the allocation without having to >> actually do a sync. >> > I guess we'll have to use FIEMAPFLAGSYNC. Hi Sunil,
Thanks for the comments. So we can ensure the source file synced before mapping in this way.
Hi Jim and Paul,
How about the tiny patch below?
I agree that this is needed, thanks.
-Eric
From d6d619a169ff68a9a310a69d8089b9fbf83b5f91 Mon Sep 17 00:00:00 2001 From: Jie Liu <address@hidden> Date: Fri, 11 Jun 2010 16:29:02 +0800 Subject: [PATCH 1/1] copy.c: add FIEMAPFLAGSYNC to fiemap ioctl
* src/copy.c (fiemapcopy): Force kernel to sync the source file before mapping.
Signed-off-by: Jie Liu <address@hidden> --- src/copy.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/copy.c b/src/copy.c index f149be4..f48c74d 100644 --- a/src/copy.c +++ b/src/copy.c @@ -191,6 +191,7 @@ fiemapcopy (int srcfd, int destfd, sizet bufsize, do { fiemap->fmlength = FIEMAPMAXOFFSET; + fiemap->fmflags = FIEMAPFLAGSYNC; fiemap->fmextentcount = count;
/* When ioctl(2) fails, fall back to the normal copy only if it
- bug#6131: [PATCH]: fiemap support for efficient sparse file copy, (continued)
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Joel Becker, 2010/06/16
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Pádraig Brady, 2010/06/16
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Joel Becker, 2010/06/15
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, jeff.liu, 2010/06/16
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Joel Becker, 2010/06/16
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Tao Ma, 2010/06/16
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Sunil Mushran, 2010/06/10
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, jeff.liu, 2010/06/11
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Jim Meyering, 2010/06/11
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Jim Meyering, 2010/06/13
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy,Eric Sandeen <=
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, jeff.liu, 2010/06/12
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Paul Eggert, 2010/06/15
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Paul Eggert, 2010/06/15
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Joel Becker, 2010/06/10
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Jim Meyering, 2010/06/11
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Paul Eggert, 2010/06/08
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, Jim Meyering, 2010/06/09
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, jeff.liu, 2010/06/09
* bug#6131: [PATCH]: fiemap support for efficient sparse file copy, jeff.liu, 2010/06/09
- Prev by Date:bug#6402: [PATCH] rm: added --directory (-d) option
- Next by Date:bug#6405: cp from -MM to -M
- Previous by thread:bug#6131: [PATCH]: fiemap support for efficient sparse file copy
- Next by thread:bug#6131: [PATCH]: fiemap support for efficient sparse file copy
- Index(es):