From: Chao Yu <chao2.yu@samsung.com>
To: "'Jaegeuk Kim'" <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: RE: [f2fs-dev] [PATCH 2/3] f2fs: use i_size_read to get i_size
Date: Tue, 29 Dec 2015 17:18:19 +0800 [thread overview]
Message-ID: <00cd01d14219$f6d317e0$e47947a0$@samsung.com> (raw)
In-Reply-To: <1451345497-65784-2-git-send-email-jaegeuk@kernel.org>
Hi Jaegeuk,
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, December 29, 2015 7:32 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 2/3] f2fs: use i_size_read to get i_size
>
> We need to use i_size_read() to get inode->i_size.
All callers of f2fs_write_failed should be protected by i_mutex, so no
one can change i_size, do we really need to use i_size_read here?
Thanks,
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/data.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index f34f42a..8a89810 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1386,10 +1386,11 @@ skip_write:
> static void f2fs_write_failed(struct address_space *mapping, loff_t to)
> {
> struct inode *inode = mapping->host;
> + loff_t i_size = i_size_read(inode);
>
> - if (to > inode->i_size) {
> - truncate_pagecache(inode, inode->i_size);
> - truncate_blocks(inode, inode->i_size, true);
> + if (to > i_size) {
> + truncate_pagecache(inode, i_size);
> + truncate_blocks(inode, i_size, true);
> }
> }
>
> --
> 2.5.4 (Apple Git-61)
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2015-12-29 9:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-28 23:31 [PATCH 1/3] f2fs: early check broken symlink length in the encrypted case Jaegeuk Kim
2015-12-28 23:31 ` [PATCH 2/3] f2fs: use i_size_read to get i_size Jaegeuk Kim
2015-12-29 9:18 ` Chao Yu [this message]
2015-12-30 0:53 ` [f2fs-dev] " Jaegeuk Kim
2015-12-28 23:31 ` [PATCH 3/3] f2fs: load largest extent all the time Jaegeuk Kim
2015-12-29 9:23 ` [f2fs-dev] " Chao Yu
2015-12-30 0:59 ` Jaegeuk Kim
2015-12-29 1:52 ` [f2fs-dev] [PATCH 1/3] f2fs: early check broken symlink length in the encrypted case Chao Yu
2015-12-30 0:45 ` Jaegeuk Kim
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='00cd01d14219$f6d317e0$e47947a0$@samsung.com' \
--to=chao2.yu@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox