From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 3/3] f2fs: load largest extent all the time
Date: Tue, 29 Dec 2015 16:59:56 -0800 [thread overview]
Message-ID: <20151230005956.GF13809@jaegeuk.local> (raw)
In-Reply-To: <00ce01d1421a$bebd3970$3c37ac50$@samsung.com>
Hi Chao,
On Tue, Dec 29, 2015 at 05:23:55PM +0800, Chao Yu wrote:
> 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 3/3] f2fs: load largest extent all the time
> >
> > Otherwise, we can get mismatched largest extent information.
> >
> > One example is:
> > 1. mount f2fs w/ extent_cache
> > 2. make a small extent
> > 3. umount
> > 4. mount f2fs w/o extent_cache
> > 5. update the largest extent
> > 6. umount
> > 7. mount f2fs w/ extent_cache
> > 8. get the old extent made by #2
>
> Good catch!
>
> It's a pity to drop it since it may provide some help if we
> can reuse it.
Indeed, but I expect it's not a common case.
Thanks,
>
> Thanks,
>
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/extent_cache.c | 18 +++++++++++++-----
> > fs/f2fs/f2fs.h | 2 +-
> > fs/f2fs/inode.c | 3 ++-
> > 3 files changed, 16 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
> > index e7b6548..23e7c82 100644
> > --- a/fs/f2fs/extent_cache.c
> > +++ b/fs/f2fs/extent_cache.c
> > @@ -166,20 +166,27 @@ static void __drop_largest_extent(struct inode *inode,
> > largest->len = 0;
> > }
> >
> > -void f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext)
> > +/* return true, if inode page is changed */
> > +bool f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext)
> > {
> > struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> > struct extent_tree *et;
> > struct extent_node *en;
> > struct extent_info ei;
> >
> > - if (!f2fs_may_extent_tree(inode))
> > - return;
> > + if (!f2fs_may_extent_tree(inode)) {
> > + /* drop largest extent */
> > + if (i_ext && i_ext->len) {
> > + i_ext->len = 0;
> > + return true;
> > + }
> > + return false;
> > + }
> >
> > et = __grab_extent_tree(inode);
> >
> > - if (!i_ext || le32_to_cpu(i_ext->len) < F2FS_MIN_EXTENT_LEN)
> > - return;
> > + if (!i_ext || !i_ext->len)
> > + return false;
> >
> > set_extent_info(&ei, le32_to_cpu(i_ext->fofs),
> > le32_to_cpu(i_ext->blk), le32_to_cpu(i_ext->len));
> > @@ -196,6 +203,7 @@ void f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext)
> > }
> > out:
> > write_unlock(&et->lock);
> > + return false;
> > }
> >
> > static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index e04b2be..a339508 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -2083,7 +2083,7 @@ void f2fs_leave_shrinker(struct f2fs_sb_info *);
> > * extent_cache.c
> > */
> > unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
> > -void f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
> > +bool f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
> > unsigned int f2fs_destroy_extent_node(struct inode *);
> > void f2fs_destroy_extent_tree(struct inode *);
> > bool f2fs_lookup_extent_cache(struct inode *, pgoff_t, struct extent_info *);
> > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> > index ec3fb32..e955008 100644
> > --- a/fs/f2fs/inode.c
> > +++ b/fs/f2fs/inode.c
> > @@ -138,7 +138,8 @@ static int do_read_inode(struct inode *inode)
> > fi->i_pino = le32_to_cpu(ri->i_pino);
> > fi->i_dir_level = ri->i_dir_level;
> >
> > - f2fs_init_extent_tree(inode, &ri->i_ext);
> > + if (f2fs_init_extent_tree(inode, &ri->i_ext))
> > + set_page_dirty(node_page);
> >
> > get_inline_info(fi, ri);
> >
> > --
> > 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-30 0:59 UTC|newest]
Thread overview: 13+ 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-28 23:31 ` Jaegeuk Kim
2015-12-29 9:18 ` [f2fs-dev] " Chao Yu
2015-12-30 0:53 ` Jaegeuk Kim
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-28 23:31 ` Jaegeuk Kim
2015-12-29 9:23 ` [f2fs-dev] " Chao Yu
2015-12-30 0:59 ` Jaegeuk Kim [this message]
2015-12-29 1:52 ` [PATCH 1/3] f2fs: early check broken symlink length in the encrypted case Chao Yu
2015-12-29 1:52 ` [f2fs-dev] " 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=20151230005956.GF13809@jaegeuk.local \
--to=jaegeuk@kernel.org \
--cc=chao2.yu@samsung.com \
--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 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.