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 v2 5/5] fat: permit to return phy block number by fibmap in fallocated region
Date: Sun, 01 Dec 2013 21:52:47 +0900 [thread overview]
Message-ID: <87wqjod97k.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <1384688316-3003-1-git-send-email-linkinjeon@gmail.com> (Namjae Jeon's message of "Sun, 17 Nov 2013 20:38:35 +0900")
Namjae Jeon <linkinjeon@gmail.com> writes:
> diff --git a/fs/fat/cache.c b/fs/fat/cache.c
> index c56bd7e..7777822 100644
> --- a/fs/fat/cache.c
> +++ b/fs/fat/cache.c
> @@ -312,6 +312,7 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
> const unsigned char blocksize_bits = sb->s_blocksize_bits;
> sector_t last_block;
> int cluster, offset;
> + loff_t i_size = i_size_read(inode);
>
> *phys = 0;
> *mapped_blocks = 0;
> @@ -323,10 +324,20 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
> return 0;
> }
>
> - last_block = (i_size_read(inode) + (blocksize - 1)) >> blocksize_bits;
> + last_block = (i_size + (blocksize - 1)) >> blocksize_bits;
> if (sector >= last_block) {
> - if (!create)
> + if (!create) {
> + /*
> + * to map cluster in case of read request
> + * for a block in fallocated region
> + */
> + if (MSDOS_I(inode)->i_disksize >
> + round_up(i_size, sb->s_blocksize)) {
> + goto out_map_cluster;
> + }
Said on another reply though, we will have to add new flag for
this. Because normal read get_block() operation should not return
mapping beyond ->i_size.
> /* fat_get_cluster() assumes the requested blocknr isn't truncated. */
> - down_read(&MSDOS_I(mapping->host)->truncate_lock);
> + mutex_lock(&mapping->host->i_mutex);
> blocknr = generic_block_bmap(mapping, block, fat_get_block);
> - up_read(&MSDOS_I(mapping->host)->truncate_lock);
> + mutex_unlock(&mapping->host->i_mutex);
>
> return blocknr;
> }
->i_mutex doesn't work for swapfile.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2013-12-01 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-17 11:38 Namjae Jeon
2013-12-01 12:52 ` OGAWA Hirofumi [this message]
2013-12-05 14:20 ` Namjae Jeon
2013-12-05 15:48 ` OGAWA Hirofumi
2013-12-06 14:39 ` 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=87wqjod97k.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
Powered by JetHome