All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Ravishankar N <cyberax82@gmail.com>,
	Amit Sahrawat <amit.sahrawat83@gmail.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v2] fat: editions to support fat_fallocate()
Date: Tue, 23 Oct 2012 00:10:03 +0900	[thread overview]
Message-ID: <CAKYAXd_TaaL1-wh2UFDTRvqQ8QtWLbuiSPeXrzV_=amoT9YCyg@mail.gmail.com> (raw)
In-Reply-To: <878vazl6tw.fsf@devron.myhome.or.jp>

2012/10/22, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>:
> Namjae Jeon <linkinjeon@gmail.com> writes:
>
>>> The expectation of fallocate() is just for space reservation? If it was
>>> just for space reservation, I'm not sure, why TV applications can't
>>> reserve in userland without any kernel help (I wonder who interrupts TV
>>> application). I feel a bit, it may be more lightweight than fallocate(),
>>> and more reliable than out of spec fallocate().
>>>
>>> I'm still not sure why apps really want fallocate() on FAT.
>> Yes, it is for user space reservation.
>>
>>>From the application perspective it is needed to realize in advance
>> how much space is needed for that file write – so the requirement is
>> precisely that the space reserved is entirely for me and no other I/O
>> operation in that time should consume the space.
>>
>> Of course, as you said, space can be pre-allocated from user space by
>> doing expanding truncate.
>> Main drawbacks for reserving through USER space:
>> 1) If we need to allocate 1GB space -> seek (1GB) and write -> it will
>> ZEROUT the 1GB area (which is very time consuming) just for reserving
>> space.
>> 2) The Application must always be aware of the SEEK OFFSET - otherwise
>> the APPEND WRITE will never occur and file is closed/opened (Append
>> mode) again for writing – it will instead start writing from the end
>> of file which is past the reserved space. So, this will also result in
>> losing space in such case – if application is not keeping track of
>> OFFSET
>> 3) If suppose from user space we are doing expanding truncate of 1GB
>> and suppose it fails after 256MB of allocation - in that case it did
>> allocation of 256MB blocks - did ZEROUT for all these blocks and then
>> returned failure - which is not optimal for just allocation of space.
>>
>> While if we make use of FALLOCATE
>> 1)	It allows reserving the space in advance without any delay.
>> 2)	Since, the space is reserved in advance. So, if suppose space is
>> reserved for 1hour TV recording than any other application in the
>> background cannot cause recording to fail in case of “no free space”
>> left as it already pre-allocated space. Only other Applications will
>> close.
>> 3)	It allows for APPEND write to continue smoothly without actually
>> keeping track of the file state, offset.
>> 4)	Initially when the disk is not fragmented. It allows the
>> possibility to get contiguous blocks and thus reducing fragmentation
>> for that file.
>
> OK.
>
> Should TV recorder make sure it is reserving space with fallocate() for
> each open() (or first open() after mount())?
It is only for first open.

>What fsck is going to do?
> Or how to know fallocated space or corrupted space?
fsck does not know about fallocated space and considers it  corrupted
space due to mismatch between file size and disk usage. So it will
free up the allocated clusters, just like windows driver.

Fsck output for a 100MB prealloacted file.
---------------------------------------------------------------------------------------------------
# fsck.vfat -aw /dev/sdb3
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
/falloc_file
  Bad short file name ( \000\005\016\013\032\022\013./\000\000).
  Auto-renaming it.
  Renamed to FSCK0000.001
/falloc_file
  File size is 6 bytes, cluster chain length is > 4096 bytes.
  Truncating file to 6 bytes.
Free cluster summary wrong (2541163 vs. really 2566762)
  Auto-correcting.
Performing changes.
/dev/sdb3: 5 files, 50565/2617327 clusters
--------------------------------------------------------------------------------------------------------

>
> Does this break the linux fat driver doesn't know about this
> fallocate()?  If so, it sounds like to be easy to break existent
> drivers.
Yes, it will break linux drivers without fallocate support. When we
try to write to fallocated file using old drivers, it will cause write
error and make FS read-only.
When fallocate was implemented in other filesystem, maybe,, was there
similar issue and concern  ?

 Thanks OGAWA!
>
> Thanks.
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>

WARNING: multiple messages have this Message-ID (diff)
From: Namjae Jeon <linkinjeon@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Ravishankar N <cyberax82@gmail.com>,
	Amit Sahrawat <amit.sahrawat83@gmail.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v2] fat: editions to support fat_fallocate()
Date: Tue, 23 Oct 2012 00:10:03 +0900	[thread overview]
Message-ID: <CAKYAXd_TaaL1-wh2UFDTRvqQ8QtWLbuiSPeXrzV_=amoT9YCyg@mail.gmail.com> (raw)
In-Reply-To: <878vazl6tw.fsf@devron.myhome.or.jp>

2012/10/22, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>:
> Namjae Jeon <linkinjeon@gmail.com> writes:
>
>>> The expectation of fallocate() is just for space reservation? If it was
>>> just for space reservation, I'm not sure, why TV applications can't
>>> reserve in userland without any kernel help (I wonder who interrupts TV
>>> application). I feel a bit, it may be more lightweight than fallocate(),
>>> and more reliable than out of spec fallocate().
>>>
>>> I'm still not sure why apps really want fallocate() on FAT.
>> Yes, it is for user space reservation.
>>
>>>From the application perspective it is needed to realize in advance
>> how much space is needed for that file write – so the requirement is
>> precisely that the space reserved is entirely for me and no other I/O
>> operation in that time should consume the space.
>>
>> Of course, as you said, space can be pre-allocated from user space by
>> doing expanding truncate.
>> Main drawbacks for reserving through USER space:
>> 1) If we need to allocate 1GB space -> seek (1GB) and write -> it will
>> ZEROUT the 1GB area (which is very time consuming) just for reserving
>> space.
>> 2) The Application must always be aware of the SEEK OFFSET - otherwise
>> the APPEND WRITE will never occur and file is closed/opened (Append
>> mode) again for writing – it will instead start writing from the end
>> of file which is past the reserved space. So, this will also result in
>> losing space in such case – if application is not keeping track of
>> OFFSET
>> 3) If suppose from user space we are doing expanding truncate of 1GB
>> and suppose it fails after 256MB of allocation - in that case it did
>> allocation of 256MB blocks - did ZEROUT for all these blocks and then
>> returned failure - which is not optimal for just allocation of space.
>>
>> While if we make use of FALLOCATE
>> 1)	It allows reserving the space in advance without any delay.
>> 2)	Since, the space is reserved in advance. So, if suppose space is
>> reserved for 1hour TV recording than any other application in the
>> background cannot cause recording to fail in case of “no free space”
>> left as it already pre-allocated space. Only other Applications will
>> close.
>> 3)	It allows for APPEND write to continue smoothly without actually
>> keeping track of the file state, offset.
>> 4)	Initially when the disk is not fragmented. It allows the
>> possibility to get contiguous blocks and thus reducing fragmentation
>> for that file.
>
> OK.
>
> Should TV recorder make sure it is reserving space with fallocate() for
> each open() (or first open() after mount())?
It is only for first open.

>What fsck is going to do?
> Or how to know fallocated space or corrupted space?
fsck does not know about fallocated space and considers it  corrupted
space due to mismatch between file size and disk usage. So it will
free up the allocated clusters, just like windows driver.

Fsck output for a 100MB prealloacted file.
---------------------------------------------------------------------------------------------------
# fsck.vfat -aw /dev/sdb3
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
/falloc_file
  Bad short file name ( \000\005\016\013\032\022\013./\000\000).
  Auto-renaming it.
  Renamed to FSCK0000.001
/falloc_file
  File size is 6 bytes, cluster chain length is > 4096 bytes.
  Truncating file to 6 bytes.
Free cluster summary wrong (2541163 vs. really 2566762)
  Auto-correcting.
Performing changes.
/dev/sdb3: 5 files, 50565/2617327 clusters
--------------------------------------------------------------------------------------------------------

>
> Does this break the linux fat driver doesn't know about this
> fallocate()?  If so, it sounds like to be easy to break existent
> drivers.
Yes, it will break linux drivers without fallocate support. When we
try to write to fallocated file using old drivers, it will cause write
error and make FS read-only.
When fallocate was implemented in other filesystem, maybe,, was there
similar issue and concern  ?

 Thanks OGAWA!
>
> Thanks.
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-10-22 15:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13 14:31 [PATCH v2] fat: editions to support fat_fallocate() Namjae Jeon
2012-10-14 16:20 ` OGAWA Hirofumi
2012-10-16  4:12   ` Namjae Jeon
2012-10-16 10:14     ` OGAWA Hirofumi
2012-10-17 10:57       ` Namjae Jeon
2012-10-17 10:57         ` Namjae Jeon
2012-10-21 23:54         ` OGAWA Hirofumi
2012-10-22 15:10           ` Namjae Jeon [this message]
2012-10-22 15:10             ` Namjae Jeon
2012-10-23  7:19             ` OGAWA Hirofumi
2012-10-23  7:24               ` Namjae Jeon
2013-02-14  2:40 ` Read support for fat_fallocate()? (was [v2] fat: editions to support fat_fallocate()) Andrew Bartlett
2013-02-14  2:48 ` Andrew Bartlett
2013-02-14  6:44   ` Namjae Jeon
2013-02-14  7:07     ` Andrew Bartlett
2013-02-14  9:52       ` Namjae Jeon
2013-02-15  3:49         ` Andrew Bartlett
2013-02-18 11:36           ` OGAWA Hirofumi
2013-02-18 13:11             ` Andrew Bartlett
2013-02-18 14:25             ` Namjae Jeon
2013-02-18 14:59               ` OGAWA Hirofumi
2013-02-18 15:15                 ` Namjae Jeon

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='CAKYAXd_TaaL1-wh2UFDTRvqQ8QtWLbuiSPeXrzV_=amoT9YCyg@mail.gmail.com' \
    --to=linkinjeon@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amit.sahrawat83@gmail.com \
    --cc=cyberax82@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.