Skip to contentSkip to conversation

remove the zone_t and zonelist_t typedefs

PATCH In review Andrew Morton 1 participant 1 message Aug 11, 2002

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

PATCH 16/21 remove the zone_t and zonelist_t typedefs

- Remove the zonelist_t typedef. Rename struct zonelist_struct to struct zonelist and use that everywhere.

- Remove the zone_t typedef. Rename struct zone_struct to struct zone and use that everywhere.

 fs/buffer.c                |    2 -
 include/linux/dcache.h     |    2 -
 include/linux/gfp.h        |    2 -
 include/linux/mm.h         |    7 ++----
 include/linux/mmzone.h     |   25 ++++++++++++-----------
 include/linux/page-flags.h |    1 
 include/linux/swap.h       |    4 +--
 mm/filemap.c               |    2 -
 mm/page_alloc.c            |   48 +++++++++++++++++++++++----------------------
 mm/vmscan.c                |   20 ++++++++++--------
 10 files changed, 58 insertions(+), 55 deletions(-)
fs/buffer.c renamed from fs/buffer.c~zone-rename +1 -1
@@ -469,7 +469,7 @@ void __invalidate_buffers(kdev_t dev, in
  */
 static void free_more_memory(void)
 {
-	zone_t *zone;
+	struct zone *zone;
 
 	zone = contig_page_data.node_zonelists[GFP_NOFS & GFP_ZONEMASK].zones[0];
 
include/linux/dcache.h renamed from include/linux/dcache.h~zone-rename +0 -2
@@ -181,8 +181,6 @@ extern void shrink_dcache_parent(struct 
 extern void shrink_dcache_anon(struct list_head *);
 extern int d_invalidate(struct dentry *);
 
-#define shrink_dcache() prune_dcache(0)
-struct zone_struct;
 /* dcache memory management */
 extern int shrink_dcache_memory(int, unsigned int);
 extern void prune_dcache(int);
include/linux/gfp.h renamed from include/linux/gfp.h~zone-rename +1 -1
@@ -40,7 +40,7 @@
  * virtual kernel addresses to the allocated page(s).
  */
 extern struct page * FASTCALL(_alloc_pages(unsigned int gfp_mask, unsigned int order));
-extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_t *zonelist));
+extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, struct zonelist *zonelist));
 extern struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order);
 
 static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order)
include/linux/mm.h renamed from include/linux/mm.h~zone-rename +3 -4
@@ -267,10 +267,10 @@ extern void FASTCALL(__page_cache_releas
 #define NODE_SHIFT 4
 #define ZONE_SHIFT (BITS_PER_LONG - 8)
 
-struct zone_struct;
-extern struct zone_struct *zone_table[];
+struct zone;
+extern struct zone *zone_table[];
 
-static inline zone_t *page_zone(struct page *page)
+static inline struct zone *page_zone(struct page *page)
 {
 	return zone_table[page->flags >> ZONE_SHIFT];
 }
@@ -454,7 +454,6 @@ static inline int can_vma_merge(struct v
 		return 0;
 }
 
-struct zone_t;
 /* filemap.c */
 extern unsigned long page_unuse(struct page *);
 extern void truncate_inode_pages(struct address_space *, loff_t);
include/linux/mmzone.h renamed from include/linux/mmzone.h~zone-rename +13 -12
@@ -34,7 +34,7 @@ struct pglist_data;
  * ZONE_NORMAL	16-896 MB	direct mapped by the kernel
  * ZONE_HIGHMEM	 > 896 MB	only page cache and user processes
  */
-typedef struct zone_struct {
+struct zone {
 	/*
 	 * Commonly accessed fields:
 	 */
@@ -89,7 +89,7 @@ typedef struct zone_struct {
 	 */
 	char			*name;
 	unsigned long		size;
-} zone_t;
+};
 
 #define ZONE_DMA		0
 #define ZONE_NORMAL		1
@@ -107,16 +107,16 @@ typedef struct zone_struct {
  * so despite the zonelist table being relatively big, the cache
  * footprint of this construct is very small.
  */
-typedef struct zonelist_struct {
-	zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited
-} zonelist_t;
+struct zonelist {
+	struct zone *zones[MAX_NR_ZONES+1]; // NULL delimited
+};
 
 #define GFP_ZONEMASK	0x0f
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
  * (mostly NUMA machines?) to denote a higher-level memory zone than the
- * zone_struct denotes.
+ * zone denotes.
  *
  * On NUMA machines, each NUMA node would have a pg_data_t to describe
  * it's memory layout.
@@ -126,8 +126,8 @@ typedef struct zonelist_struct {
  */
 struct bootmem_data;
 typedef struct pglist_data {
-	zone_t node_zones[MAX_NR_ZONES];
-	zonelist_t node_zonelists[GFP_ZONEMASK+1];
+	struct zone node_zones[MAX_NR_ZONES];
+	struct zonelist node_zonelists[GFP_ZONEMASK+1];
 	int nr_zones;
 	struct page *node_mem_map;
 	unsigned long *valid_addr_bitmap;
@@ -142,7 +142,8 @@ typedef struct pglist_data {
 extern int numnodes;
 extern pg_data_t *pgdat_list;
 
-static inline int memclass(zone_t *pgzone, zone_t *classzone)
+static inline int
+memclass(struct zone *pgzone, struct zone *classzone)
 {
 	if (pgzone->zone_pgdat != classzone->zone_pgdat)
 		return 0;
@@ -181,7 +182,7 @@ extern pg_data_t contig_page_data;
  * next_zone - helper magic for for_each_zone()
  * Thanks to William Lee Irwin III for this piece of ingenuity.
  */
-static inline zone_t * next_zone(zone_t * zone)
+static inline struct zone *next_zone(struct zone *zone)
 {
 	pg_data_t *pgdat = zone->zone_pgdat;
 
@@ -198,7 +199,7 @@ static inline zone_t * next_zone(zone_t 
 
 /**
  * for_each_zone - helper macro to iterate over all memory zones
- * @zone - pointer to zone_t variable
+ * @zone - pointer to struct zone variable
  *
  * The user only needs to declare the zone variable, for_each_zone
  * fills it in. This basically means for_each_zone() is an
@@ -206,7 +207,7 @@ static inline zone_t * next_zone(zone_t 
  *
  * for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next)
  * 	for (i = 0; i < MAX_NR_ZONES; ++i) {
- * 		zone_t * z = pgdat->node_zones + i;
+ * 		struct zone * z = pgdat->node_zones + i;
  * 		...
  * 	}
  * }
include/linux/page-flags.h renamed from include/linux/page-flags.h~zone-rename +1 -0
@@ -161,6 +161,7 @@ extern void get_page_state(struct page_s
 #define SetPageActive(page)	set_bit(PG_active, &(page)->flags)
 #define ClearPageActive(page)	clear_bit(PG_active, &(page)->flags)
 #define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags)
+#define TestSetPageActive(page) test_and_set_bit(PG_active, &(page)->flags)
 
 #define PageSlab(page)		test_bit(PG_slab, &(page)->flags)
 #define SetPageSlab(page)	set_bit(PG_slab, &(page)->flags)
include/linux/swap.h renamed from include/linux/swap.h~zone-rename +2 -2
@@ -139,7 +139,7 @@ struct task_struct;
 struct vm_area_struct;
 struct sysinfo;
 struct address_space;
-struct zone_t;
+struct zone;
 struct pagevec;
 
 /* linux/mm/rmap.c */
@@ -166,7 +166,7 @@ extern void swap_setup(void);
 
 /* linux/mm/vmscan.c */
 extern wait_queue_head_t kswapd_wait;
-extern int FASTCALL(try_to_free_pages(zone_t *, unsigned int, unsigned int));
+extern int try_to_free_pages(struct zone *, unsigned int, unsigned int);
 
 /* linux/mm/page_io.c */
 int swap_readpage(struct file *file, struct page *page);
mm/filemap.c renamed from mm/filemap.c~zone-rename +1 -1
@@ -618,7 +618,7 @@ static int page_cache_read(struct file *
  */
 static inline wait_queue_head_t *page_waitqueue(struct page *page)
 {
-	const zone_t *zone = page_zone(page);
+	const struct zone *zone = page_zone(page);
 
 	return &zone->wait_table[hash_ptr(page, zone->wait_table_bits)];
 }
mm/page_alloc.c renamed from mm/page_alloc.c~zone-rename +25 -23

158 lines not on this page · raw message

mm/vmscan.c renamed from mm/vmscan.c~zone-rename +11 -9
@@ -94,8 +94,9 @@ static inline int is_page_cache_freeable
 }
 
 static /* inline */ int
-shrink_list(struct list_head *page_list, int nr_pages, zone_t *classzone,
-		unsigned int gfp_mask, int priority, int *max_scan)
+shrink_list(struct list_head *page_list, int nr_pages,
+		struct zone *classzone, unsigned int gfp_mask,
+		int priority, int *max_scan)
 {
 	struct address_space *mapping;
 	LIST_HEAD(ret_pages);
@@ -276,7 +277,7 @@ keep:
  * in the kernel (apart from the copy_*_user functions).
  */
 static /* inline */ int
-shrink_cache(int nr_pages, zone_t *classzone,
+shrink_cache(int nr_pages, struct zone *classzone,
 		unsigned int gfp_mask, int priority, int max_scan)
 {
 	LIST_HEAD(page_list);
@@ -452,7 +453,7 @@ static /* inline */ void refill_inactive
 }
 
 static /* inline */ int
-shrink_caches(zone_t *classzone, int priority,
+shrink_caches(struct zone *classzone, int priority,
 		unsigned int gfp_mask, int nr_pages)
 {
 	unsigned long ratio;
@@ -502,7 +503,8 @@ shrink_caches(zone_t *classzone, int pri
 	return nr_pages;
 }
 
-int try_to_free_pages(zone_t *classzone, unsigned int gfp_mask, unsigned int order)
+int try_to_free_pages(struct zone *classzone,
+		unsigned int gfp_mask, unsigned int order)
 {
 	int priority = DEF_PRIORITY;
 	int nr_pages = SWAP_CLUSTER_MAX;
@@ -525,9 +527,9 @@ int try_to_free_pages(zone_t *classzone,
 
 DECLARE_WAIT_QUEUE_HEAD(kswapd_wait);
 
-static int check_classzone_need_balance(zone_t * classzone)
+static int check_classzone_need_balance(struct zone *classzone)
 {
-	zone_t * first_classzone;
+	struct zone *first_classzone;
 
 	first_classzone = classzone->zone_pgdat->node_zones;
 	while (classzone >= first_classzone) {
@@ -541,7 +543,7 @@ static int check_classzone_need_balance(
 static int kswapd_balance_pgdat(pg_data_t * pgdat)
 {
 	int need_more_balance = 0, i;
-	zone_t * zone;
+	struct zone *zone;
 
 	for (i = pgdat->nr_zones-1; i >= 0; i--) {
 		zone = pgdat->node_zones + i;
@@ -579,7 +581,7 @@ static void kswapd_balance(void)
 
 static int kswapd_can_sleep_pgdat(pg_data_t * pgdat)
 {
-	zone_t * zone;
+	struct zone *zone;
 	int i;
 
 	for (i = pgdat->nr_zones-1; i >= 0; i--) {

.