public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH RESEND v5] fat: editions to support fat_fallocate
Date: Thu, 02 May 2013 16:36:22 +0900	[thread overview]
Message-ID: <87r4hp3kax.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <CAKYAXd8nTUrW04ADyDkhnJWyjUKiniU+r65J5SMhXT-jHTG+UA@mail.gmail.com> (Namjae Jeon's message of "Thu, 2 May 2013 15:12:55 +0900")

Namjae Jeon <linkinjeon@gmail.com> writes:

>> Then, per-file discard fallocate space sounds like wrong. fallocate
>> space probably is inode attribute.
> Since, our preallocation will not be persistent after umount. So, we
> need to free up the space at some point.
> If we consider for normal pre-allocation in ext4, in that case also
> the blocks are removed in ext4_release_file when the last writer
> closes the file.
>
> ext4_release_file()
> {
> ...
> /* if we are the last writer on the inode, drop the block reservation */
> 	if ((filp->f_mode & FMODE_WRITE) &&
> 			(atomic_read(&inode->i_writecount) == 1) &&
> 		        !EXT4_I(inode)->i_reserved_data_blocks)
> 	{
> 		down_write(&EXT4_I(inode)->i_data_sem);
> 		ext4_discard_preallocations(inode);
> 		up_write(&EXT4_I(inode)->i_data_sem);
> 	}
>
> So, we will need to have this per file . May be the condition for
> checking is wrong which can be correct but the correctness points
> should be same. We can give a thought on using "i_writecount" for
> controlling the parallel write in FAT also.
> how do you think ?

AFAIK, preallocation != fallocate. ext*'s preallocation was there at
before fallocation to optimize block allocation for user data blocks.

>>>> I know. Question is, why do we need to initialize twice.
>>>>
>>>> 1) zeroed for uninitialized area, 2) then copy user data area. We need
>>>> only either, right? This seems to be doing both for all fallocated area.
>>> We did not initialize twice. We are using the ‘pos’ as the attribute
>>> to define zeroing length in case of pre-allocation.
>>> Zeroing out occurs till the ‘pos’ while actual write occur after ‘pos’.
>>> If we file size is 100KB and we pre-allocated till 1MB. Next if we try
>>> to write at 500KB,
>>> Then zeroing out will occur only for 100KB->500KB, after that there
>>> will be normal write. There is no duplication for the same space.
>>
>> Ah. Then write_begin() really initialize after i_size until page cache
>> boudary for append write? I wonder if this patch works correctly for
>> mmap.
> Since you already provided me review comments to check truncate and
> mmap, we checked all points for those cases.

cluster size == 512b

1) create new file
2) fallocate 100MB
3) write(2) data for each 512b

With this, write_begin() will be called for each 512b data. When we
allocates new page for this file, write_begin() writes data 0-512. Then,
we have to initialize 512-4096 by zero. Because mmap read maps 0-4096,
even if i_size == 512.

Who is initializing area for 512-4096?

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

  reply	other threads:[~2013-05-02  7:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28  0:08 [PATCH RESEND v5] fat: editions to support fat_fallocate Namjae Jeon
2013-04-29 14:31 ` OGAWA Hirofumi
2013-05-01  4:14   ` Namjae Jeon
2013-05-01  6:42     ` OGAWA Hirofumi
2013-05-02  4:46       ` Namjae Jeon
2013-05-02  5:12         ` OGAWA Hirofumi
2013-05-02  6:12           ` Namjae Jeon
2013-05-02  7:36             ` OGAWA Hirofumi [this message]
2013-05-02  7:43               ` OGAWA Hirofumi
2013-05-02  9:15                 ` Namjae Jeon
2013-05-02  9:34                   ` OGAWA Hirofumi
2013-05-02  9:56                     ` Namjae Jeon
2013-06-18  5:47                       ` Namjae Jeon
2013-06-18 17:33                         ` OGAWA Hirofumi
2013-06-20  6:28                           ` 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=87r4hp3kax.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    /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