2013-03-18 05:53:02

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 13/19] f2fs: fix return value of releasepage for node and data

If the return value of releasepage is equal to zero, the page cannot be reclaimed.
Instead, we should return 1 in order to reclaim clean pages.

Signed-off-by: Jaegeuk Kim <[email protected]>
---
fs/f2fs/data.c | 4 +++-
fs/f2fs/node.c | 13 +++----------
2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 6616137..cd6b2cc 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page *page, unsigned long offset)

static int f2fs_release_data_page(struct page *page, gfp_t wait)
{
+ if (PageWriteback(page))
+ return 0;
ClearPagePrivate(page);
- return 0;
+ return 1;
}

static int f2fs_set_data_page_dirty(struct page *page)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 94951d9..c60919f 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -933,7 +933,6 @@ struct page *get_node_page_ra(struct page *parent, int start)
if (!nid)
return ERR_PTR(-ENOENT);

-repeat:
page = grab_cache_page(mapping, nid);
if (!page)
return ERR_PTR(-ENOMEM);
@@ -961,12 +960,6 @@ page_hit:
f2fs_put_page(page, 1);
return ERR_PTR(-EIO);
}
-
- /* Has the page been truncated? */
- if (page->mapping != mapping) {
- f2fs_put_page(page, 1);
- goto repeat;
- }
mark_page_accessed(page);
return page;
}
@@ -1188,8 +1181,10 @@ static void f2fs_invalidate_node_page(struct page *page, unsigned long offset)

static int f2fs_release_node_page(struct page *page, gfp_t wait)
{
+ if (PageWriteback(page))
+ return 0;
ClearPagePrivate(page);
- return 0;
+ return 1;
}

/*
@@ -1630,8 +1625,6 @@ flush_now:
write_lock(&nm_i->nat_tree_lock);
__del_from_nat_cache(nm_i, ne);
write_unlock(&nm_i->nat_tree_lock);
-
- /* We can reuse this freed nid at this point */
add_free_nid(NM_I(sbi), nid);
} else {
write_lock(&nm_i->nat_tree_lock);
--
1.8.1.3.566.gaa39828


2013-03-18 11:39:19

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH 13/19] f2fs: fix return value of releasepage for node and data

2013/3/18, Jaegeuk Kim <[email protected]>:
> If the return value of releasepage is equal to zero, the page cannot be
> reclaimed.
> Instead, we should return 1 in order to reclaim clean pages.
>
> Signed-off-by: Jaegeuk Kim <[email protected]>
> ---
> fs/f2fs/data.c | 4 +++-
> fs/f2fs/node.c | 13 +++----------
> 2 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 6616137..cd6b2cc 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page
> *page, unsigned long offset)
>
> static int f2fs_release_data_page(struct page *page, gfp_t wait)
> {
> + if (PageWriteback(page))
> + return 0;
> ClearPagePrivate(page);
> - return 0;
> + return 1;
> }
I have a question.
Although PageWriteback is already checked in try_to_release_page,
we need to check it again in f2fs_release_data_page ?

Thanks.


> 1.8.1.3.566.gaa39828
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2013-03-18 11:59:49

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH 13/19] f2fs: fix return value of releasepage for node and data

2013-03-18 (월), 20:39 +0900, Namjae Jeon:
> 2013/3/18, Jaegeuk Kim <[email protected]>:
> > If the return value of releasepage is equal to zero, the page cannot be
> > reclaimed.
> > Instead, we should return 1 in order to reclaim clean pages.
> >
> > Signed-off-by: Jaegeuk Kim <[email protected]>
> > ---
> > fs/f2fs/data.c | 4 +++-
> > fs/f2fs/node.c | 13 +++----------
> > 2 files changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 6616137..cd6b2cc 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page
> > *page, unsigned long offset)
> >
> > static int f2fs_release_data_page(struct page *page, gfp_t wait)
> > {
> > + if (PageWriteback(page))
> > + return 0;
> > ClearPagePrivate(page);
> > - return 0;
> > + return 1;
> > }
> I have a question.
> Although PageWriteback is already checked in try_to_release_page,
> we need to check it again in f2fs_release_data_page ?

Oh, I made a mistake.
No need to check that.
Thanks,

>
> Thanks.
>
>
> > 1.8.1.3.566.gaa39828
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Jaegeuk Kim
Samsung


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2013-03-18 12:02:26

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH 13/19] f2fs: fix return value of releasepage for node and data

2013/3/18, Jaegeuk Kim <[email protected]>:
> 2013-03-18 (월), 20:39 +0900, Namjae Jeon:
>> 2013/3/18, Jaegeuk Kim <[email protected]>:
>> > If the return value of releasepage is equal to zero, the page cannot be
>> > reclaimed.
>> > Instead, we should return 1 in order to reclaim clean pages.
>> >
>> > Signed-off-by: Jaegeuk Kim <[email protected]>
>> > ---
>> > fs/f2fs/data.c | 4 +++-
>> > fs/f2fs/node.c | 13 +++----------
>> > 2 files changed, 6 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> > index 6616137..cd6b2cc 100644
>> > --- a/fs/f2fs/data.c
>> > +++ b/fs/f2fs/data.c
>> > @@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page
>> > *page, unsigned long offset)
>> >
>> > static int f2fs_release_data_page(struct page *page, gfp_t wait)
>> > {
>> > + if (PageWriteback(page))
>> > + return 0;
>> > ClearPagePrivate(page);
>> > - return 0;
>> > + return 1;
>> > }
>> I have a question.
>> Although PageWriteback is already checked in try_to_release_page,
>> we need to check it again in f2fs_release_data_page ?
>
> Oh, I made a mistake.
> No need to check that.
> Thanks,
You can add
Reviewed-by: Namjae Jeon <[email protected]>

Thanks :)
>