2020-02-17 18:48:03

by Matthew Wilcox

[permalink] [raw]
Subject: [PATCH v6 06/19] mm: rename readahead loop variable to 'i'

From: "Matthew Wilcox (Oracle)" <[email protected]>

Change the type of page_idx to unsigned long, and rename it -- it's
just a loop counter, not a page index.

Suggested-by: John Hubbard <[email protected]>
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
---
mm/readahead.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/readahead.c b/mm/readahead.c
index 74791b96013f..bdc5759000d3 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -156,7 +156,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
struct inode *inode = mapping->host;
unsigned long end_index; /* The last page we want to read */
LIST_HEAD(page_pool);
- int page_idx;
+ unsigned long i;
loff_t isize = i_size_read(inode);
gfp_t gfp_mask = readahead_gfp_mask(mapping);
struct readahead_control rac = {
@@ -174,7 +174,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
/*
* Preallocate as many pages as we will need.
*/
- for (page_idx = 0; page_idx < nr_to_read; page_idx++) {
+ for (i = 0; i < nr_to_read; i++) {
struct page *page;

if (offset > end_index)
@@ -198,7 +198,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
break;
page->index = offset;
list_add(&page->lru, &page_pool);
- if (page_idx == nr_to_read - lookahead_size)
+ if (i == nr_to_read - lookahead_size)
SetPageReadahead(page);
rac._nr_pages++;
offset++;
--
2.25.0


2020-02-18 23:11:55

by John Hubbard

[permalink] [raw]
Subject: Re: [PATCH v6 06/19] mm: rename readahead loop variable to 'i'

On 2/17/20 10:45 AM, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <[email protected]>
>
> Change the type of page_idx to unsigned long, and rename it -- it's
> just a loop counter, not a page index.
>
> Suggested-by: John Hubbard <[email protected]>
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
> ---
> mm/readahead.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

Looks good,

Reviewed-by: John Hubbard <[email protected]>


thanks,
--
John Hubbard
NVIDIA

> diff --git a/mm/readahead.c b/mm/readahead.c
> index 74791b96013f..bdc5759000d3 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -156,7 +156,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
> struct inode *inode = mapping->host;
> unsigned long end_index; /* The last page we want to read */
> LIST_HEAD(page_pool);
> - int page_idx;
> + unsigned long i;
> loff_t isize = i_size_read(inode);
> gfp_t gfp_mask = readahead_gfp_mask(mapping);
> struct readahead_control rac = {
> @@ -174,7 +174,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
> /*
> * Preallocate as many pages as we will need.
> */
> - for (page_idx = 0; page_idx < nr_to_read; page_idx++) {
> + for (i = 0; i < nr_to_read; i++) {
> struct page *page;
>
> if (offset > end_index)
> @@ -198,7 +198,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
> break;
> page->index = offset;
> list_add(&page->lru, &page_pool);
> - if (page_idx == nr_to_read - lookahead_size)
> + if (i == nr_to_read - lookahead_size)
> SetPageReadahead(page);
> rac._nr_pages++;
> offset++;
>