Re: [V3 PATCH 1/2] tmpfs: add fallocate support

From: KAMEZAWA Hiroyuki
Date: Wed Nov 23 2011 - 23:25:15 EST


On Thu, 24 Nov 2011 11:22:34 +0800
Cong Wang <amwang@xxxxxxxxxx> wrote:

> 于 2011年11月24日 11:01, KAMEZAWA Hiroyuki 写道:
> > On Wed, 23 Nov 2011 21:46:39 -0500
> > KOSAKI Motohiro<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> >
> >>>> + while (index< end) {
> >>>> + ret = shmem_getpage(inode, index,&page, SGP_WRITE, NULL);
> >>>
> >>> If the 'page' for index exists before this call, this will return the page without
> >>> allocaton.
> >>>
> >>> Then, the page may not be zero-cleared. I think the page should be zero-cleared.
> >>
> >> No. fallocate shouldn't destroy existing data. It only ensure
> >> subsequent file access don't make ENOSPC error.
> >>
> > FALLOC_FL_KEEP_SIZE
> > This flag allocates and initializes to zero the disk space
> > within the range specified by offset and len. ....
> >
> > just manual is unclear ? it seems that the range [offset, offset+len) is
> > zero cleared after the call.
>
> I think we should fix the man page, because at least ext4 doesn't clear
> the original contents,
>
> % echo hi > /tmp/foobar
> % fallocate -n -l 1 -o 10 /tmp/foobar
> % hexdump -Cv /tmp/foobar
> 00000000 68 69 0a |hi.|
> 00000003
>

thank you for checking. So, at failure path, original data should not be
cleared, either.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/