Re: [PATCH 08/33] readahead: common macros

Andrew Morton
2006-05-25T16:34:51Z

Wu Fengguang <wfg@mail.ustc.edu.cn> wrote:
>
> Define some common used macros for the read-ahead logics.
>
> Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
> ---
>
> mm/readahead.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
>
> --- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
> +++ linux-2.6.17-rc4-mm3/mm/readahead.c
> @@ -5,6 +5,8 @@
> *
> * 09Apr2002 akpm@zip.com.au
> * Initial version.
> + * 21May2006 Wu Fengguang <wfg@mail.ustc.edu.cn>
> + * Adaptive read-ahead framework.
> */
>
> #include <linux/kernel.h>
> @@ -14,6 +16,14 @@
> #include <linux/blkdev.h>
> #include <linux/backing-dev.h>
> #include <linux/pagevec.h>
> +#include <linux/writeback.h>
> +#include <linux/nfsd/const.h>

Why on earth are we including that file?

Whatever goodies it contains should be moved into fs.h or mm.h or something.

> +
> +#define PAGES_BYTE(size) (((size) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
> +#define PAGES_KB(size) PAGES_BYTE((size)*1024)

These aren't proving popular.

> +#define next_page(pg) (list_entry((pg)->lru.prev, struct page, lru))
> +#define prev_page(pg) (list_entry((pg)->lru.next, struct page, lru))

hm. Makes sense I guess, but normally we'll be iterating across lists with
the list_for_each*() helpers, so I'm a little surprised that the above are
needed.