* Re: [RFC] gfp flags annotations
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
@ 2005-10-09 1:13 ` Alexey Dobriyan
2005-10-09 1:06 ` Al Viro
2005-10-09 5:32 ` [RFC] gfp flags annotations - part 2 Al Viro
` (5 subsequent siblings)
6 siblings, 1 reply; 36+ messages in thread
From: Alexey Dobriyan @ 2005-10-09 1:13 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Al Viro, linux-kernel
On Sat, Oct 08, 2005 at 04:34:36PM -0700, Linus Torvalds wrote:
> On Thu, 6 Oct 2005, Al Viro wrote:
> > a) typedef unsigned int __nocast gfp_t;
>
> Btw, since you did a typedef, any reason why it isn't marked __bitwise
> too? It would seem that all valid uses of it are bit tests with predefined
> values, ie a __bitwise restriction would seem very natural, no?
See [*] in Al's RFC.
The amount of endian warnings on allmodconfig is in >10K range. gfp_t
ones would simply be lost in noise.
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [RFC] gfp flags annotations
2005-10-09 1:13 ` Alexey Dobriyan
@ 2005-10-09 1:06 ` Al Viro
0 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 1:06 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Linus Torvalds, linux-kernel
On Sun, Oct 09, 2005 at 05:13:15AM +0400, Alexey Dobriyan wrote:
> On Sat, Oct 08, 2005 at 04:34:36PM -0700, Linus Torvalds wrote:
> > On Thu, 6 Oct 2005, Al Viro wrote:
> > > a) typedef unsigned int __nocast gfp_t;
> >
> > Btw, since you did a typedef, any reason why it isn't marked __bitwise
> > too? It would seem that all valid uses of it are bit tests with predefined
> > values, ie a __bitwise restriction would seem very natural, no?
>
> See [*] in Al's RFC.
>
> The amount of endian warnings on allmodconfig is in >10K range. gfp_t
> ones would simply be lost in noise.
I've done that in the latter chunks, will send the next few in about half an
hour...
^ permalink raw reply [flat|nested] 36+ messages in thread
* [RFC] gfp flags annotations - part 2
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
2005-10-09 1:13 ` Alexey Dobriyan
@ 2005-10-09 5:32 ` Al Viro
2005-10-09 5:35 ` [RFC] gfp flags annotations - part 3 (simple parts of mm/*) Al Viro
` (4 subsequent siblings)
6 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 5:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel
- renamed __bitwise to __bitwise__
- made __bitwise conditional on __CHECK_ENDIAN__
- made gfp_t __bitwise__
- added -Wbitwise to CHECKFLAGS
As the result, default sparse run will pick gfp warnings without picking
endianness ones; to get those use CF=-D__CHECK_ENDIAN__.
That allows to do gfp annotations without drowning in endianness ones -
endianness annotations are nowhere near complete and generate too much
noise.
- __GFP_... definitions got a force-cast to gfp_t
- new helper - gfp_zone(gfp) gives zone number.
Impact on the things seen by gcc - none; the only thing that survives
preprocessor is addition of cast to unsigned int on several explicitly
unsigned constants.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN base/Makefile bitwise/Makefile
--- base/Makefile 2005-09-30 20:59:37.000000000 -0400
+++ bitwise/Makefile 2005-10-09 01:20:14.000000000 -0400
@@ -334,7 +334,7 @@
PERL = perl
CHECK = sparse
-CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF)
+CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)
diff -urN base/fs/buffer.c bitwise/fs/buffer.c
--- base/fs/buffer.c 2005-10-08 21:04:47.000000000 -0400
+++ bitwise/fs/buffer.c 2005-10-09 01:20:14.000000000 -0400
@@ -502,7 +502,7 @@
yield();
for_each_pgdat(pgdat) {
- zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones;
+ zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones;
if (*zones)
try_to_free_pages(zones, GFP_NOFS);
}
diff -urN base/include/linux/gfp.h bitwise/include/linux/gfp.h
--- base/include/linux/gfp.h 2005-10-08 21:04:47.000000000 -0400
+++ bitwise/include/linux/gfp.h 2005-10-09 01:20:14.000000000 -0400
@@ -12,8 +12,8 @@
* GFP bitmasks..
*/
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
-#define __GFP_DMA 0x01u
-#define __GFP_HIGHMEM 0x02u
+#define __GFP_DMA ((__force gfp_t)0x01u)
+#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
/*
* Action modifiers - doesn't change the zoning
@@ -26,24 +26,24 @@
*
* __GFP_NORETRY: The VM implementation must not retry indefinitely.
*/
-#define __GFP_WAIT 0x10u /* Can wait and reschedule? */
-#define __GFP_HIGH 0x20u /* Should access emergency pools? */
-#define __GFP_IO 0x40u /* Can start physical IO? */
-#define __GFP_FS 0x80u /* Can call down to low-level FS? */
-#define __GFP_COLD 0x100u /* Cache-cold page required */
-#define __GFP_NOWARN 0x200u /* Suppress page allocation failure warning */
-#define __GFP_REPEAT 0x400u /* Retry the allocation. Might fail */
-#define __GFP_NOFAIL 0x800u /* Retry for ever. Cannot fail */
-#define __GFP_NORETRY 0x1000u /* Do not retry. Might fail */
-#define __GFP_NO_GROW 0x2000u /* Slab internal usage */
-#define __GFP_COMP 0x4000u /* Add compound page metadata */
-#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
-#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
-#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
-#define __GFP_HARDWALL 0x40000u /* Enforce hardwall cpuset memory allocs */
+#define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */
+#define __GFP_HIGH ((__force gfp_t)0x20u) /* Should access emergency pools? */
+#define __GFP_IO ((__force gfp_t)0x40u) /* Can start physical IO? */
+#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */
+#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */
+#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */
+#define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */
+#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */
+#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */
+#define __GFP_NO_GROW ((__force gfp_t)0x2000u)/* Slab internal usage */
+#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */
+#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
+#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
+#define __GFP_NORECLAIM ((__force gfp_t)0x20000u) /* No realy zone reclaim during allocation */
+#define __GFP_HARDWALL ((__force gfp_t)0x40000u) /* Enforce hardwall cpuset memory allocs */
#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
-#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
+#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
/* if you forget to add the bitmask here kernel will crash, period */
#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
@@ -64,6 +64,7 @@
#define GFP_DMA __GFP_DMA
+#define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK))
/*
* There is only one page-allocator function, and two main namespaces to
@@ -94,7 +95,7 @@
return NULL;
return __alloc_pages(gfp_mask, order,
- NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
+ NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
}
#ifdef CONFIG_NUMA
diff -urN base/include/linux/types.h bitwise/include/linux/types.h
--- base/include/linux/types.h 2005-10-08 21:04:47.000000000 -0400
+++ bitwise/include/linux/types.h 2005-10-09 01:20:14.000000000 -0400
@@ -151,7 +151,12 @@
*/
#ifdef __CHECKER__
-#define __bitwise __attribute__((bitwise))
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#ifdef __CHECK_ENDIAN__
+#define __bitwise __bitwise__
#else
#define __bitwise
#endif
@@ -166,7 +171,7 @@
#endif
#ifdef __KERNEL__
-typedef unsigned __nocast gfp_t;
+typedef unsigned __bitwise__ gfp_t;
#endif
struct ustat {
diff -urN base/mm/mempolicy.c bitwise/mm/mempolicy.c
--- base/mm/mempolicy.c 2005-10-08 21:04:47.000000000 -0400
+++ bitwise/mm/mempolicy.c 2005-10-09 01:20:14.000000000 -0400
@@ -700,7 +700,7 @@
case MPOL_BIND:
/* Lower zones don't get a policy applied */
/* Careful: current->mems_allowed might have moved */
- if ((gfp & GFP_ZONEMASK) >= policy_zone)
+ if (gfp_zone(gfp) >= policy_zone)
if (cpuset_zonelist_valid_mems_allowed(policy->v.zonelist))
return policy->v.zonelist;
/*FALL THROUGH*/
@@ -712,7 +712,7 @@
nd = 0;
BUG();
}
- return NODE_DATA(nd)->node_zonelists + (gfp & GFP_ZONEMASK);
+ return NODE_DATA(nd)->node_zonelists + gfp_zone(gfp);
}
/* Do dynamic interleaving for a process */
@@ -757,7 +757,7 @@
struct page *page;
BUG_ON(!node_online(nid));
- zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK);
+ zl = NODE_DATA(nid)->node_zonelists + gfp_zone(gfp);
page = __alloc_pages(gfp, order, zl);
if (page && page_zone(page) == zl->zones[0]) {
zone_pcp(zl->zones[0],get_cpu())->interleave_hit++;
diff -urN base/mm/page_alloc.c bitwise/mm/page_alloc.c
--- base/mm/page_alloc.c 2005-10-08 21:04:47.000000000 -0400
+++ bitwise/mm/page_alloc.c 2005-10-09 01:20:14.000000000 -0400
@@ -1089,7 +1089,7 @@
*/
unsigned int nr_free_buffer_pages(void)
{
- return nr_free_zone_pages(GFP_USER & GFP_ZONEMASK);
+ return nr_free_zone_pages(gfp_zone(GFP_USER));
}
/*
@@ -1097,7 +1097,7 @@
*/
unsigned int nr_free_pagecache_pages(void)
{
- return nr_free_zone_pages(GFP_HIGHUSER & GFP_ZONEMASK);
+ return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER));
}
#ifdef CONFIG_HIGHMEM
^ permalink raw reply [flat|nested] 36+ messages in thread* [RFC] gfp flags annotations - part 3 (simple parts of mm/*)
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
2005-10-09 1:13 ` Alexey Dobriyan
2005-10-09 5:32 ` [RFC] gfp flags annotations - part 2 Al Viro
@ 2005-10-09 5:35 ` Al Viro
2005-10-09 5:36 ` [RFC] gfp flags annotations - part 4 (lib/*) Al Viro
` (3 subsequent siblings)
6 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 5:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel
A bunch of unsigned int -> gfp_t in mm/*. All tricky parts
(zone handling) are left as-is - we'll deal with them later. This
is just the missing annotations.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN bitwise/include/linux/mm.h mm/include/linux/mm.h
--- bitwise/include/linux/mm.h 2005-09-22 14:50:53.000000000 -0400
+++ mm/include/linux/mm.h 2005-10-09 01:20:58.000000000 -0400
@@ -747,7 +747,7 @@
* The callback will be passed nr_to_scan == 0 when the VM is querying the
* cache size, so a fastpath for that case is appropriate.
*/
-typedef int (*shrinker_t)(int nr_to_scan, unsigned int gfp_mask);
+typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask);
/*
* Add an aging callback. The int is the number of 'seeks' it takes
diff -urN bitwise/include/linux/pagemap.h mm/include/linux/pagemap.h
--- bitwise/include/linux/pagemap.h 2005-10-08 21:04:47.000000000 -0400
+++ mm/include/linux/pagemap.h 2005-10-09 01:20:58.000000000 -0400
@@ -69,7 +69,7 @@
extern struct page * find_trylock_page(struct address_space *mapping,
unsigned long index);
extern struct page * find_or_create_page(struct address_space *mapping,
- unsigned long index, unsigned int gfp_mask);
+ unsigned long index, gfp_t gfp_mask);
unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
unsigned int nr_pages, struct page **pages);
unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
@@ -92,9 +92,9 @@
struct list_head *pages, filler_t *filler, void *data);
int add_to_page_cache(struct page *page, struct address_space *mapping,
- unsigned long index, int gfp_mask);
+ unsigned long index, gfp_t gfp_mask);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
- unsigned long index, int gfp_mask);
+ unsigned long index, gfp_t gfp_mask);
extern void remove_from_page_cache(struct page *page);
extern void __remove_from_page_cache(struct page *page);
diff -urN bitwise/include/linux/slab.h mm/include/linux/slab.h
--- bitwise/include/linux/slab.h 2005-10-08 21:04:47.000000000 -0400
+++ mm/include/linux/slab.h 2005-10-09 01:21:04.000000000 -0400
@@ -121,7 +121,7 @@
extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
extern void *kmalloc_node(size_t size, gfp_t flags, int node);
#else
-static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
+static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
{
return kmem_cache_alloc(cachep, flags);
}
diff -urN bitwise/include/linux/swap.h mm/include/linux/swap.h
--- bitwise/include/linux/swap.h 2005-10-08 21:04:47.000000000 -0400
+++ mm/include/linux/swap.h 2005-10-09 01:20:58.000000000 -0400
@@ -171,8 +171,8 @@
extern void swap_setup(void);
/* linux/mm/vmscan.c */
-extern int try_to_free_pages(struct zone **, unsigned int);
-extern int zone_reclaim(struct zone *, unsigned int, unsigned int);
+extern int try_to_free_pages(struct zone **, gfp_t);
+extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
extern int shrink_all_memory(int);
extern int vm_swappiness;
diff -urN bitwise/mm/filemap.c mm/mm/filemap.c
--- bitwise/mm/filemap.c 2005-09-22 14:50:54.000000000 -0400
+++ mm/mm/filemap.c 2005-10-09 01:20:58.000000000 -0400
@@ -377,7 +377,7 @@
* This function does not add the page to the LRU. The caller must do that.
*/
int add_to_page_cache(struct page *page, struct address_space *mapping,
- pgoff_t offset, int gfp_mask)
+ pgoff_t offset, gfp_t gfp_mask)
{
int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
@@ -401,7 +401,7 @@
EXPORT_SYMBOL(add_to_page_cache);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
- pgoff_t offset, int gfp_mask)
+ pgoff_t offset, gfp_t gfp_mask)
{
int ret = add_to_page_cache(page, mapping, offset, gfp_mask);
if (ret == 0)
@@ -591,7 +591,7 @@
* memory exhaustion.
*/
struct page *find_or_create_page(struct address_space *mapping,
- unsigned long index, unsigned int gfp_mask)
+ unsigned long index, gfp_t gfp_mask)
{
struct page *page, *cached_page = NULL;
int err;
@@ -683,7 +683,7 @@
grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
{
struct page *page = find_get_page(mapping, index);
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
if (page) {
if (!TestSetPageLocked(page))
diff -urN bitwise/mm/mempool.c mm/mm/mempool.c
--- bitwise/mm/mempool.c 2005-10-08 21:04:47.000000000 -0400
+++ mm/mm/mempool.c 2005-10-09 01:20:58.000000000 -0400
@@ -205,7 +205,7 @@
void *element;
unsigned long flags;
wait_queue_t wait;
- unsigned int gfp_temp;
+ gfp_t gfp_temp;
might_sleep_if(gfp_mask & __GFP_WAIT);
diff -urN bitwise/mm/shmem.c mm/mm/shmem.c
--- bitwise/mm/shmem.c 2005-10-08 21:04:47.000000000 -0400
+++ mm/mm/shmem.c 2005-10-09 01:20:58.000000000 -0400
@@ -85,7 +85,7 @@
static int shmem_getpage(struct inode *inode, unsigned long idx,
struct page **pagep, enum sgp_type sgp, int *type);
-static inline struct page *shmem_dir_alloc(unsigned int gfp_mask)
+static inline struct page *shmem_dir_alloc(gfp_t gfp_mask)
{
/*
* The above definition of ENTRIES_PER_PAGE, and the use of
@@ -898,7 +898,7 @@
}
static struct page *
-shmem_alloc_page(unsigned long gfp, struct shmem_inode_info *info,
+shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
unsigned long idx)
{
struct vm_area_struct pvma;
diff -urN bitwise/mm/slab.c mm/mm/slab.c
--- bitwise/mm/slab.c 2005-10-08 21:04:47.000000000 -0400
+++ mm/mm/slab.c 2005-10-09 01:20:58.000000000 -0400
@@ -386,7 +386,7 @@
unsigned int gfporder;
/* force GFP flags, e.g. GFP_DMA */
- unsigned int gfpflags;
+ gfp_t gfpflags;
size_t colour; /* cache colouring range */
unsigned int colour_off; /* colour offset */
@@ -2117,7 +2117,7 @@
slabp->free = 0;
}
-static void kmem_flagcheck(kmem_cache_t *cachep, unsigned int flags)
+static void kmem_flagcheck(kmem_cache_t *cachep, gfp_t flags)
{
if (flags & SLAB_DMA) {
if (!(cachep->gfpflags & GFP_DMA))
@@ -2152,7 +2152,7 @@
struct slab *slabp;
void *objp;
size_t offset;
- unsigned int local_flags;
+ gfp_t local_flags;
unsigned long ctor_flags;
struct kmem_list3 *l3;
@@ -2546,7 +2546,7 @@
/*
* A interface to enable slab creation on nodeid
*/
-static void *__cache_alloc_node(kmem_cache_t *cachep, int flags, int nodeid)
+static void *__cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid)
{
struct list_head *entry;
struct slab *slabp;
diff -urN bitwise/mm/vmscan.c mm/mm/vmscan.c
--- bitwise/mm/vmscan.c 2005-09-22 14:50:54.000000000 -0400
+++ mm/mm/vmscan.c 2005-10-09 01:20:58.000000000 -0400
@@ -70,7 +70,7 @@
unsigned int priority;
/* This context's GFP mask */
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
int may_writepage;
@@ -186,7 +186,7 @@
*
* Returns the number of slab objects which we shrunk.
*/
-static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
+static int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
unsigned long lru_pages)
{
struct shrinker *shrinker;
@@ -921,7 +921,7 @@
* holds filesystem locks which prevent writeout this might not work, and the
* allocation attempt will fail.
*/
-int try_to_free_pages(struct zone **zones, unsigned int gfp_mask)
+int try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
{
int priority;
int ret = 0;
@@ -1333,7 +1333,7 @@
/*
* Try to free up some pages from this zone through reclaim.
*/
-int zone_reclaim(struct zone *zone, unsigned int gfp_mask, unsigned int order)
+int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
{
struct scan_control sc;
int nr_pages = 1 << order;
^ permalink raw reply [flat|nested] 36+ messages in thread* [RFC] gfp flags annotations - part 4 (lib/*)
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
` (2 preceding siblings ...)
2005-10-09 5:35 ` [RFC] gfp flags annotations - part 3 (simple parts of mm/*) Al Viro
@ 2005-10-09 5:36 ` Al Viro
2005-10-09 5:38 ` [RFC] gfp flags annotations - part 5 (net/*) Al Viro
` (2 subsequent siblings)
6 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 5:36 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel
missing gfp_t in lib/* and related headers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN mm/include/linux/idr.h lib/include/linux/idr.h
--- mm/include/linux/idr.h 2005-09-22 14:50:53.000000000 -0400
+++ lib/include/linux/idr.h 2005-10-09 01:21:35.000000000 -0400
@@ -71,7 +71,7 @@
*/
void *idr_find(struct idr *idp, int id);
-int idr_pre_get(struct idr *idp, unsigned gfp_mask);
+int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
int idr_get_new(struct idr *idp, void *ptr, int *id);
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
void idr_remove(struct idr *idp, int id);
diff -urN mm/include/linux/kobject.h lib/include/linux/kobject.h
--- mm/include/linux/kobject.h 2005-09-22 14:50:53.000000000 -0400
+++ lib/include/linux/kobject.h 2005-10-09 01:21:35.000000000 -0400
@@ -65,7 +65,7 @@
extern struct kobject * kobject_get(struct kobject *);
extern void kobject_put(struct kobject *);
-extern char * kobject_get_path(struct kobject *, int);
+extern char * kobject_get_path(struct kobject *, gfp_t);
struct kobj_type {
void (*release)(struct kobject *);
diff -urN mm/include/linux/radix-tree.h lib/include/linux/radix-tree.h
--- mm/include/linux/radix-tree.h 2005-10-08 21:04:47.000000000 -0400
+++ lib/include/linux/radix-tree.h 2005-10-09 01:21:35.000000000 -0400
@@ -24,7 +24,7 @@
struct radix_tree_root {
unsigned int height;
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
struct radix_tree_node *rnode;
};
diff -urN mm/include/linux/textsearch.h lib/include/linux/textsearch.h
--- mm/include/linux/textsearch.h 2005-10-08 21:04:47.000000000 -0400
+++ lib/include/linux/textsearch.h 2005-10-09 01:21:35.000000000 -0400
@@ -40,7 +40,7 @@
struct ts_ops
{
const char *name;
- struct ts_config * (*init)(const void *, unsigned int, int);
+ struct ts_config * (*init)(const void *, unsigned int, gfp_t);
unsigned int (*find)(struct ts_config *,
struct ts_state *);
void (*destroy)(struct ts_config *);
@@ -148,7 +148,7 @@
extern int textsearch_register(struct ts_ops *);
extern int textsearch_unregister(struct ts_ops *);
extern struct ts_config *textsearch_prepare(const char *, const void *,
- unsigned int, int, int);
+ unsigned int, gfp_t, int);
extern void textsearch_destroy(struct ts_config *conf);
extern unsigned int textsearch_find_continuous(struct ts_config *,
struct ts_state *,
diff -urN mm/lib/idr.c lib/lib/idr.c
--- mm/lib/idr.c 2005-09-22 14:50:54.000000000 -0400
+++ lib/lib/idr.c 2005-10-09 01:21:35.000000000 -0400
@@ -72,7 +72,7 @@
* If the system is REALLY out of memory this function returns 0,
* otherwise 1.
*/
-int idr_pre_get(struct idr *idp, unsigned gfp_mask)
+int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
{
while (idp->id_free_cnt < IDR_FREE_MAX) {
struct idr_layer *new;
diff -urN mm/lib/kobject.c lib/lib/kobject.c
--- mm/lib/kobject.c 2005-09-22 14:50:54.000000000 -0400
+++ lib/lib/kobject.c 2005-10-09 01:21:35.000000000 -0400
@@ -100,7 +100,7 @@
* @kobj: kobject in question, with which to build the path
* @gfp_mask: the allocation type used to allocate the path
*/
-char *kobject_get_path(struct kobject *kobj, int gfp_mask)
+char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
{
char *path;
int len;
diff -urN mm/lib/kobject_uevent.c lib/lib/kobject_uevent.c
--- mm/lib/kobject_uevent.c 2005-09-22 14:50:54.000000000 -0400
+++ lib/lib/kobject_uevent.c 2005-10-09 01:21:35.000000000 -0400
@@ -62,7 +62,7 @@
* @gfp_mask:
*/
static int send_uevent(const char *signal, const char *obj,
- char **envp, int gfp_mask)
+ char **envp, gfp_t gfp_mask)
{
struct sk_buff *skb;
char *pos;
@@ -98,7 +98,7 @@
}
static int do_kobject_uevent(struct kobject *kobj, enum kobject_action action,
- struct attribute *attr, int gfp_mask)
+ struct attribute *attr, gfp_t gfp_mask)
{
char *path;
char *attrpath;
diff -urN mm/lib/textsearch.c lib/lib/textsearch.c
--- mm/lib/textsearch.c 2005-09-22 14:50:54.000000000 -0400
+++ lib/lib/textsearch.c 2005-10-09 01:21:35.000000000 -0400
@@ -254,7 +254,7 @@
* parameters or a ERR_PTR().
*/
struct ts_config *textsearch_prepare(const char *algo, const void *pattern,
- unsigned int len, int gfp_mask, int flags)
+ unsigned int len, gfp_t gfp_mask, int flags)
{
int err = -ENOENT;
struct ts_config *conf;
^ permalink raw reply [flat|nested] 36+ messages in thread* [RFC] gfp flags annotations - part 5 (net/*)
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
` (3 preceding siblings ...)
2005-10-09 5:36 ` [RFC] gfp flags annotations - part 4 (lib/*) Al Viro
@ 2005-10-09 5:38 ` Al Viro
2005-10-09 5:55 ` [RFC] gfp flags annotations - part 6 (simple parts of fs/*) Al Viro
2005-10-09 6:01 ` [RFC] gfp flags annotations - part 7 (block layer) Al Viro
6 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 5:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel
missing gfp_t in net/* and around
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN lib/include/linux/security.h net/include/linux/security.h
--- lib/include/linux/security.h 2005-10-08 21:04:47.000000000 -0400
+++ net/include/linux/security.h 2005-10-09 01:22:12.000000000 -0400
@@ -1210,7 +1210,7 @@
int (*socket_shutdown) (struct socket * sock, int how);
int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
- int (*sk_alloc_security) (struct sock *sk, int family, int priority);
+ int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
void (*sk_free_security) (struct sock *sk);
#endif /* CONFIG_SECURITY_NETWORK */
};
diff -urN lib/include/net/sock.h net/include/net/sock.h
--- lib/include/net/sock.h 2005-10-08 21:04:47.000000000 -0400
+++ net/include/net/sock.h 2005-10-09 01:22:12.000000000 -0400
@@ -207,7 +207,7 @@
struct sk_buff_head sk_write_queue;
int sk_wmem_queued;
int sk_forward_alloc;
- unsigned int sk_allocation;
+ gfp_t sk_allocation;
int sk_sndbuf;
int sk_route_caps;
unsigned long sk_flags;
diff -urN lib/net/core/sock.c net/net/core/sock.c
--- lib/net/core/sock.c 2005-10-08 21:04:47.000000000 -0400
+++ net/net/core/sock.c 2005-10-09 01:22:12.000000000 -0400
@@ -940,7 +940,7 @@
int noblock, int *errcode)
{
struct sk_buff *skb;
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
long timeo;
int err;
diff -urN lib/net/dccp/output.c net/net/dccp/output.c
--- lib/net/dccp/output.c 2005-09-22 14:50:54.000000000 -0400
+++ net/net/dccp/output.c 2005-10-09 01:22:12.000000000 -0400
@@ -495,7 +495,7 @@
{
struct dccp_sock *dp = dccp_sk(sk);
struct sk_buff *skb;
- const unsigned int prio = active ? GFP_KERNEL : GFP_ATOMIC;
+ const gfp_t prio = active ? GFP_KERNEL : GFP_ATOMIC;
skb = alloc_skb(sk->sk_prot->max_header, prio);
if (skb == NULL)
diff -urN lib/net/netlink/af_netlink.c net/net/netlink/af_netlink.c
--- lib/net/netlink/af_netlink.c 2005-10-08 21:04:47.000000000 -0400
+++ net/net/netlink/af_netlink.c 2005-10-09 01:22:12.000000000 -0400
@@ -827,7 +827,7 @@
int failure;
int congested;
int delivered;
- unsigned int allocation;
+ gfp_t allocation;
struct sk_buff *skb, *skb2;
};
diff -urN lib/security/dummy.c net/security/dummy.c
--- lib/security/dummy.c 2005-09-22 14:50:54.000000000 -0400
+++ net/security/dummy.c 2005-10-09 01:22:12.000000000 -0400
@@ -768,7 +768,7 @@
return -ENOPROTOOPT;
}
-static inline int dummy_sk_alloc_security (struct sock *sk, int family, int priority)
+static inline int dummy_sk_alloc_security (struct sock *sk, int family, gfp_t priority)
{
return 0;
}
diff -urN lib/security/selinux/hooks.c net/security/selinux/hooks.c
--- lib/security/selinux/hooks.c 2005-09-30 20:59:37.000000000 -0400
+++ net/security/selinux/hooks.c 2005-10-09 01:22:12.000000000 -0400
@@ -262,7 +262,7 @@
}
#ifdef CONFIG_SECURITY_NETWORK
-static int sk_alloc_security(struct sock *sk, int family, int priority)
+static int sk_alloc_security(struct sock *sk, int family, gfp_t priority)
{
struct sk_security_struct *ssec;
@@ -3380,7 +3380,7 @@
return err;
}
-static int selinux_sk_alloc_security(struct sock *sk, int family, int priority)
+static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority)
{
return sk_alloc_security(sk, family, priority);
}
^ permalink raw reply [flat|nested] 36+ messages in thread* [RFC] gfp flags annotations - part 6 (simple parts of fs/*)
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
` (4 preceding siblings ...)
2005-10-09 5:38 ` [RFC] gfp flags annotations - part 5 (net/*) Al Viro
@ 2005-10-09 5:55 ` Al Viro
2005-10-09 15:41 ` Tom Zanussi
2005-10-09 6:01 ` [RFC] gfp flags annotations - part 7 (block layer) Al Viro
6 siblings, 1 reply; 36+ messages in thread
From: Al Viro @ 2005-10-09 5:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel, Tom Zanussi
- ->releasepage() annotated (s/int/gfp_t), instances updated
- missing gfp_t in fs/* added
- fixed misannotation from the first part caught by bitwise checks -
XFS used __nocast both for gfp_t and for flags used by XFS allocator. The
latter left with unsigned int __nocast; we might want to add a different
type for those but for now let's leave them alone. That, BTW, is a case
when __nocast use had been actively confusing - it had been used in the
same code for two different and similar types, with no way to catch misuses.
Switch of gfp_t to bitwise had caught that immediately...
One tricky bit is left alone to be dealt with later - mapping->flags
is a mix of gfp_t and error indications. Left alone for now.
A bug had been caught in relayfs code -
mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL);
in fs/relayfs/buffers.c is bogus (the third argument of vmap() is unrelated
to gfp flags). s/GFP_KERNEL/VM_MAP/, presumably? Author Cc'd, code in
question left alone for now.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN net/fs/afs/file.c fs/fs/afs/file.c
--- net/fs/afs/file.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/afs/file.c 2005-10-09 01:23:29.000000000 -0400
@@ -29,7 +29,7 @@
static int afs_file_readpage(struct file *file, struct page *page);
static int afs_file_invalidatepage(struct page *page, unsigned long offset);
-static int afs_file_releasepage(struct page *page, int gfp_flags);
+static int afs_file_releasepage(struct page *page, gfp_t gfp_flags);
static ssize_t afs_file_write(struct file *file, const char __user *buf,
size_t size, loff_t *off);
@@ -279,7 +279,7 @@
/*
* release a page and cleanup its private data
*/
-static int afs_file_releasepage(struct page *page, int gfp_flags)
+static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
{
struct cachefs_page *pageio;
diff -urN net/fs/bio.c fs/fs/bio.c
--- net/fs/bio.c 2005-10-08 21:04:47.000000000 -0400
+++ fs/fs/bio.c 2005-10-09 01:23:29.000000000 -0400
@@ -778,7 +778,7 @@
static struct bio *__bio_map_kern(request_queue_t *q, void *data,
- unsigned int len, unsigned int gfp_mask)
+ unsigned int len, gfp_t gfp_mask)
{
unsigned long kaddr = (unsigned long)data;
unsigned long end = (kaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -825,7 +825,7 @@
* device. Returns an error pointer in case of error.
*/
struct bio *bio_map_kern(request_queue_t *q, void *data, unsigned int len,
- unsigned int gfp_mask)
+ gfp_t gfp_mask)
{
struct bio *bio;
diff -urN net/fs/buffer.c fs/fs/buffer.c
--- net/fs/buffer.c 2005-10-09 01:20:14.000000000 -0400
+++ fs/fs/buffer.c 2005-10-09 01:23:29.000000000 -0400
@@ -1571,7 +1571,7 @@
*
* NOTE: @gfp_mask may go away, and this function may become non-blocking.
*/
-int try_to_release_page(struct page *page, int gfp_mask)
+int try_to_release_page(struct page *page, gfp_t gfp_mask)
{
struct address_space * const mapping = page->mapping;
diff -urN net/fs/dcache.c fs/fs/dcache.c
--- net/fs/dcache.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/dcache.c 2005-10-09 01:23:29.000000000 -0400
@@ -689,7 +689,7 @@
*
* In this case we return -1 to tell the caller that we baled.
*/
-static int shrink_dcache_memory(int nr, unsigned int gfp_mask)
+static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
{
if (nr) {
if (!(gfp_mask & __GFP_FS))
diff -urN net/fs/dquot.c fs/fs/dquot.c
--- net/fs/dquot.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/dquot.c 2005-10-09 01:23:29.000000000 -0400
@@ -500,7 +500,7 @@
* more memory
*/
-static int shrink_dqcache_memory(int nr, unsigned int gfp_mask)
+static int shrink_dqcache_memory(int nr, gfp_t gfp_mask)
{
if (nr) {
spin_lock(&dq_list_lock);
diff -urN net/fs/ext3/inode.c fs/fs/ext3/inode.c
--- net/fs/ext3/inode.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/ext3/inode.c 2005-10-09 01:23:29.000000000 -0400
@@ -1434,7 +1434,7 @@
return journal_invalidatepage(journal, page, offset);
}
-static int ext3_releasepage(struct page *page, int wait)
+static int ext3_releasepage(struct page *page, gfp_t wait)
{
journal_t *journal = EXT3_JOURNAL(page->mapping->host);
diff -urN net/fs/hfs/inode.c fs/fs/hfs/inode.c
--- net/fs/hfs/inode.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/hfs/inode.c 2005-10-09 01:23:29.000000000 -0400
@@ -46,7 +46,7 @@
return generic_block_bmap(mapping, block, hfs_get_block);
}
-static int hfs_releasepage(struct page *page, int mask)
+static int hfs_releasepage(struct page *page, gfp_t mask)
{
struct inode *inode = page->mapping->host;
struct super_block *sb = inode->i_sb;
diff -urN net/fs/hfsplus/inode.c fs/fs/hfsplus/inode.c
--- net/fs/hfsplus/inode.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/hfsplus/inode.c 2005-10-09 01:23:29.000000000 -0400
@@ -40,7 +40,7 @@
return generic_block_bmap(mapping, block, hfsplus_get_block);
}
-static int hfsplus_releasepage(struct page *page, int mask)
+static int hfsplus_releasepage(struct page *page, gfp_t mask)
{
struct inode *inode = page->mapping->host;
struct super_block *sb = inode->i_sb;
diff -urN net/fs/inode.c fs/fs/inode.c
--- net/fs/inode.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/inode.c 2005-10-09 01:23:29.000000000 -0400
@@ -475,7 +475,7 @@
* This function is passed the number of inodes to scan, and it returns the
* total number of remaining possibly-reclaimable inodes.
*/
-static int shrink_icache_memory(int nr, unsigned int gfp_mask)
+static int shrink_icache_memory(int nr, gfp_t gfp_mask)
{
if (nr) {
/*
diff -urN net/fs/jbd/journal.c fs/fs/jbd/journal.c
--- net/fs/jbd/journal.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/jbd/journal.c 2005-10-09 01:23:29.000000000 -0400
@@ -1606,7 +1606,7 @@
* Simple support for retrying memory allocations. Introduced to help to
* debug different VM deadlock avoidance strategies.
*/
-void * __jbd_kmalloc (const char *where, size_t size, int flags, int retry)
+void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry)
{
return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0));
}
diff -urN net/fs/jbd/transaction.c fs/fs/jbd/transaction.c
--- net/fs/jbd/transaction.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/jbd/transaction.c 2005-10-09 01:23:29.000000000 -0400
@@ -1621,7 +1621,7 @@
* while the data is part of a transaction. Yes?
*/
int journal_try_to_free_buffers(journal_t *journal,
- struct page *page, int unused_gfp_mask)
+ struct page *page, gfp_t unused_gfp_mask)
{
struct buffer_head *head;
struct buffer_head *bh;
diff -urN net/fs/jfs/jfs_metapage.c fs/fs/jfs/jfs_metapage.c
--- net/fs/jfs/jfs_metapage.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/jfs/jfs_metapage.c 2005-10-09 01:23:29.000000000 -0400
@@ -198,7 +198,7 @@
}
}
-static inline struct metapage *alloc_metapage(unsigned int gfp_mask)
+static inline struct metapage *alloc_metapage(gfp_t gfp_mask)
{
return mempool_alloc(metapage_mempool, gfp_mask);
}
@@ -534,7 +534,7 @@
return -EIO;
}
-static int metapage_releasepage(struct page *page, int gfp_mask)
+static int metapage_releasepage(struct page *page, gfp_t gfp_mask)
{
struct metapage *mp;
int busy = 0;
diff -urN net/fs/mbcache.c fs/fs/mbcache.c
--- net/fs/mbcache.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/mbcache.c 2005-10-09 01:23:29.000000000 -0400
@@ -116,7 +116,7 @@
* What the mbcache registers as to get shrunk dynamically.
*/
-static int mb_cache_shrink_fn(int nr_to_scan, unsigned int gfp_mask);
+static int mb_cache_shrink_fn(int nr_to_scan, gfp_t gfp_mask);
static inline int
@@ -140,7 +140,7 @@
static inline void
-__mb_cache_entry_forget(struct mb_cache_entry *ce, int gfp_mask)
+__mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask)
{
struct mb_cache *cache = ce->e_cache;
@@ -193,7 +193,7 @@
* Returns the number of objects which are present in the cache.
*/
static int
-mb_cache_shrink_fn(int nr_to_scan, unsigned int gfp_mask)
+mb_cache_shrink_fn(int nr_to_scan, gfp_t gfp_mask)
{
LIST_HEAD(free_list);
struct list_head *l, *ltmp;
diff -urN net/fs/reiserfs/fix_node.c fs/fs/reiserfs/fix_node.c
--- net/fs/reiserfs/fix_node.c 2005-09-22 14:50:51.000000000 -0400
+++ fs/fs/reiserfs/fix_node.c 2005-10-09 01:23:29.000000000 -0400
@@ -2022,7 +2022,7 @@
}
#ifdef CONFIG_REISERFS_CHECK
-void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s)
+void *reiserfs_kmalloc(size_t size, gfp_t flags, struct super_block *s)
{
void *vp;
static size_t malloced;
diff -urN net/fs/reiserfs/inode.c fs/fs/reiserfs/inode.c
--- net/fs/reiserfs/inode.c 2005-09-22 14:50:52.000000000 -0400
+++ fs/fs/reiserfs/inode.c 2005-10-09 01:23:29.000000000 -0400
@@ -2842,7 +2842,7 @@
* even in -o notail mode, we can't be sure an old mount without -o notail
* didn't create files with tails.
*/
-static int reiserfs_releasepage(struct page *page, int unused_gfp_flags)
+static int reiserfs_releasepage(struct page *page, gfp_t unused_gfp_flags)
{
struct inode *inode = page->mapping->host;
struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
diff -urN net/fs/xfs/linux-2.6/kmem.c fs/fs/xfs/linux-2.6/kmem.c
--- net/fs/xfs/linux-2.6/kmem.c 2005-10-08 21:04:47.000000000 -0400
+++ fs/fs/xfs/linux-2.6/kmem.c 2005-10-09 01:23:29.000000000 -0400
@@ -45,11 +45,11 @@
void *
-kmem_alloc(size_t size, gfp_t flags)
+kmem_alloc(size_t size, unsigned int __nocast flags)
{
- int retries = 0;
- unsigned int lflags = kmem_flags_convert(flags);
- void *ptr;
+ int retries = 0;
+ gfp_t lflags = kmem_flags_convert(flags);
+ void *ptr;
do {
if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS)
@@ -67,7 +67,7 @@
}
void *
-kmem_zalloc(size_t size, gfp_t flags)
+kmem_zalloc(size_t size, unsigned int __nocast flags)
{
void *ptr;
@@ -90,7 +90,7 @@
void *
kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
- gfp_t flags)
+ unsigned int __nocast flags)
{
void *new;
@@ -105,11 +105,11 @@
}
void *
-kmem_zone_alloc(kmem_zone_t *zone, gfp_t flags)
+kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
{
- int retries = 0;
- unsigned int lflags = kmem_flags_convert(flags);
- void *ptr;
+ int retries = 0;
+ gfp_t lflags = kmem_flags_convert(flags);
+ void *ptr;
do {
ptr = kmem_cache_alloc(zone, lflags);
@@ -124,7 +124,7 @@
}
void *
-kmem_zone_zalloc(kmem_zone_t *zone, gfp_t flags)
+kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags)
{
void *ptr;
diff -urN net/fs/xfs/linux-2.6/kmem.h fs/fs/xfs/linux-2.6/kmem.h
--- net/fs/xfs/linux-2.6/kmem.h 2005-10-08 21:04:47.000000000 -0400
+++ fs/fs/xfs/linux-2.6/kmem.h 2005-10-09 01:23:29.000000000 -0400
@@ -81,9 +81,9 @@
*(NSTATEP) = *(OSTATEP); \
} while (0)
-static __inline unsigned int kmem_flags_convert(gfp_t flags)
+static __inline gfp_t kmem_flags_convert(unsigned int __nocast flags)
{
- unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */
+ gfp_t lflags = __GFP_NOWARN; /* we'll report problems, if need be */
#ifdef DEBUG
if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) {
@@ -125,16 +125,16 @@
BUG();
}
-extern void *kmem_zone_zalloc(kmem_zone_t *, gfp_t);
-extern void *kmem_zone_alloc(kmem_zone_t *, gfp_t);
+extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
+extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast);
-extern void *kmem_alloc(size_t, gfp_t);
-extern void *kmem_realloc(void *, size_t, size_t, gfp_t);
-extern void *kmem_zalloc(size_t, gfp_t);
+extern void *kmem_alloc(size_t, unsigned int __nocast);
+extern void *kmem_realloc(void *, size_t, size_t, unsigned int __nocast);
+extern void *kmem_zalloc(size_t, unsigned int __nocast);
extern void kmem_free(void *, size_t);
typedef struct shrinker *kmem_shaker_t;
-typedef int (*kmem_shake_func_t)(int, unsigned int);
+typedef int (*kmem_shake_func_t)(int, gfp_t);
static __inline kmem_shaker_t
kmem_shake_register(kmem_shake_func_t sfunc)
@@ -149,7 +149,7 @@
}
static __inline int
-kmem_shake_allow(unsigned int gfp_mask)
+kmem_shake_allow(gfp_t gfp_mask)
{
return (gfp_mask & __GFP_WAIT);
}
diff -urN net/fs/xfs/linux-2.6/xfs_aops.c fs/fs/xfs/linux-2.6/xfs_aops.c
--- net/fs/xfs/linux-2.6/xfs_aops.c 2005-09-22 14:50:52.000000000 -0400
+++ fs/fs/xfs/linux-2.6/xfs_aops.c 2005-10-09 01:23:29.000000000 -0400
@@ -1296,7 +1296,7 @@
STATIC int
linvfs_release_page(
struct page *page,
- int gfp_mask)
+ gfp_t gfp_mask)
{
struct inode *inode = page->mapping->host;
int dirty, delalloc, unmapped, unwritten;
diff -urN net/fs/xfs/linux-2.6/xfs_buf.c fs/fs/xfs/linux-2.6/xfs_buf.c
--- net/fs/xfs/linux-2.6/xfs_buf.c 2005-09-22 14:50:52.000000000 -0400
+++ fs/fs/xfs/linux-2.6/xfs_buf.c 2005-10-09 01:23:29.000000000 -0400
@@ -64,7 +64,7 @@
STATIC kmem_cache_t *pagebuf_zone;
STATIC kmem_shaker_t pagebuf_shake;
-STATIC int xfsbufd_wakeup(int, unsigned int);
+STATIC int xfsbufd_wakeup(int, gfp_t);
STATIC void pagebuf_delwri_queue(xfs_buf_t *, int);
STATIC struct workqueue_struct *xfslogd_workqueue;
@@ -383,7 +383,7 @@
size_t blocksize = bp->pb_target->pbr_bsize;
size_t size = bp->pb_count_desired;
size_t nbytes, offset;
- int gfp_mask = pb_to_gfp(flags);
+ gfp_t gfp_mask = pb_to_gfp(flags);
unsigned short page_count, i;
pgoff_t first;
loff_t end;
@@ -1749,8 +1749,8 @@
STATIC int
xfsbufd_wakeup(
- int priority,
- unsigned int mask)
+ int priority,
+ gfp_t mask)
{
if (xfsbufd_force_sleep)
return 0;
diff -urN net/include/linux/bio.h fs/include/linux/bio.h
--- net/include/linux/bio.h 2005-10-08 21:04:47.000000000 -0400
+++ fs/include/linux/bio.h 2005-10-09 01:23:29.000000000 -0400
@@ -301,7 +301,7 @@
struct sg_iovec *, int, int);
extern void bio_unmap_user(struct bio *);
extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
- unsigned int);
+ gfp_t);
extern void bio_set_pages_dirty(struct bio *bio);
extern void bio_check_pages_dirty(struct bio *bio);
extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
diff -urN net/include/linux/buffer_head.h fs/include/linux/buffer_head.h
--- net/include/linux/buffer_head.h 2005-10-08 21:04:47.000000000 -0400
+++ fs/include/linux/buffer_head.h 2005-10-09 01:23:29.000000000 -0400
@@ -188,7 +188,7 @@
* Generic address_space_operations implementations for buffer_head-backed
* address_spaces.
*/
-int try_to_release_page(struct page * page, int gfp_mask);
+int try_to_release_page(struct page * page, gfp_t gfp_mask);
int block_invalidatepage(struct page *page, unsigned long offset);
int block_write_full_page(struct page *page, get_block_t *get_block,
struct writeback_control *wbc);
diff -urN net/include/linux/fs.h fs/include/linux/fs.h
--- net/include/linux/fs.h 2005-09-22 14:50:53.000000000 -0400
+++ fs/include/linux/fs.h 2005-10-09 01:23:29.000000000 -0400
@@ -320,7 +320,7 @@
/* Unfortunately this kludge is needed for FIBMAP. Don't use it */
sector_t (*bmap)(struct address_space *, sector_t);
int (*invalidatepage) (struct page *, unsigned long);
- int (*releasepage) (struct page *, int);
+ int (*releasepage) (struct page *, gfp_t);
ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
loff_t offset, unsigned long nr_segs);
struct page* (*get_xip_page)(struct address_space *, sector_t,
diff -urN net/include/linux/jbd.h fs/include/linux/jbd.h
--- net/include/linux/jbd.h 2005-10-08 21:04:47.000000000 -0400
+++ fs/include/linux/jbd.h 2005-10-09 01:23:29.000000000 -0400
@@ -69,7 +69,7 @@
#define jbd_debug(f, a...) /**/
#endif
-extern void * __jbd_kmalloc (const char *where, size_t size, int flags, int retry);
+extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry);
#define jbd_kmalloc(size, flags) \
__jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
#define jbd_rep_kmalloc(size, flags) \
@@ -890,7 +890,7 @@
extern void journal_sync_buffer (struct buffer_head *);
extern int journal_invalidatepage(journal_t *,
struct page *, unsigned long);
-extern int journal_try_to_free_buffers(journal_t *, struct page *, int);
+extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
extern int journal_stop(handle_t *);
extern int journal_flush (journal_t *);
extern void journal_lock_updates (journal_t *);
diff -urN net/include/linux/mbcache.h fs/include/linux/mbcache.h
--- net/include/linux/mbcache.h 2005-09-22 14:50:53.000000000 -0400
+++ fs/include/linux/mbcache.h 2005-10-09 01:23:29.000000000 -0400
@@ -22,7 +22,7 @@
};
struct mb_cache_op {
- int (*free)(struct mb_cache_entry *, int);
+ int (*free)(struct mb_cache_entry *, gfp_t);
};
/* Functions on caches */
diff -urN net/include/linux/reiserfs_fs.h fs/include/linux/reiserfs_fs.h
--- net/include/linux/reiserfs_fs.h 2005-09-22 14:50:53.000000000 -0400
+++ fs/include/linux/reiserfs_fs.h 2005-10-09 01:23:29.000000000 -0400
@@ -1972,7 +1972,7 @@
/* fix_nodes.c */
#ifdef CONFIG_REISERFS_CHECK
-void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s);
+void *reiserfs_kmalloc(size_t size, gfp_t flags, struct super_block *s);
void reiserfs_kfree(const void *vp, size_t size, struct super_block *s);
#else
static inline void *reiserfs_kmalloc(size_t size, int flags,
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [RFC] gfp flags annotations - part 6 (simple parts of fs/*)
2005-10-09 5:55 ` [RFC] gfp flags annotations - part 6 (simple parts of fs/*) Al Viro
@ 2005-10-09 15:41 ` Tom Zanussi
0 siblings, 0 replies; 36+ messages in thread
From: Tom Zanussi @ 2005-10-09 15:41 UTC (permalink / raw)
To: Al Viro; +Cc: Linus Torvalds, Alexey Dobriyan, linux-kernel, Tom Zanussi
Al Viro writes:
> A bug had been caught in relayfs code -
> mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL);
> in fs/relayfs/buffers.c is bogus (the third argument of vmap() is unrelated
> to gfp flags). s/GFP_KERNEL/VM_MAP/, presumably? Author Cc'd, code in
> question left alone for now.
>
Yes, looks like a stupid typo that luckily wasn't affecting the
outcome because the GFP_KERNEL value happens to not cause any false
test outcomes in the vmap code. I'll submit a patch momentarily.
Thanks for catching this.
Tom
^ permalink raw reply [flat|nested] 36+ messages in thread
* [RFC] gfp flags annotations - part 7 (block layer)
2005-10-08 23:34 ` [RFC] gfp flags annotations Linus Torvalds
` (5 preceding siblings ...)
2005-10-09 5:55 ` [RFC] gfp flags annotations - part 6 (simple parts of fs/*) Al Viro
@ 2005-10-09 6:01 ` Al Viro
6 siblings, 0 replies; 36+ messages in thread
From: Al Viro @ 2005-10-09 6:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alexey Dobriyan, linux-kernel
missing gfp_t in block layer (ll_rw_blk, elevator and friends).
Individual drivers left alone for now.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
[That's it for tonight; the next chunk (dma-mapping) is trickier and even
if we want it before 2.6.14, I'd rather give it another look before posting
and after I get some sleep. The messy part is in arch/* code - changing
prototypes in include/asm-* has to go with corresponding changes in actual
definitions of functions in question and tracking down the related forest
of defines to make sure that nothing is missed...]
diff -urN fs/drivers/block/as-iosched.c block/drivers/block/as-iosched.c
--- fs/drivers/block/as-iosched.c 2005-09-22 14:50:49.000000000 -0400
+++ block/drivers/block/as-iosched.c 2005-10-09 01:24:16.000000000 -0400
@@ -1807,7 +1807,7 @@
}
static int as_set_request(request_queue_t *q, struct request *rq,
- struct bio *bio, int gfp_mask)
+ struct bio *bio, gfp_t gfp_mask)
{
struct as_data *ad = q->elevator->elevator_data;
struct as_rq *arq = mempool_alloc(ad->arq_pool, gfp_mask);
diff -urN fs/drivers/block/cfq-iosched.c block/drivers/block/cfq-iosched.c
--- fs/drivers/block/cfq-iosched.c 2005-09-22 14:50:49.000000000 -0400
+++ block/drivers/block/cfq-iosched.c 2005-10-09 01:24:16.000000000 -0400
@@ -1422,7 +1422,7 @@
}
static struct cfq_io_context *
-cfq_alloc_io_context(struct cfq_data *cfqd, int gfp_mask)
+cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
{
struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask);
@@ -1517,7 +1517,7 @@
static struct cfq_queue *
cfq_get_queue(struct cfq_data *cfqd, unsigned int key, unsigned short ioprio,
- int gfp_mask)
+ gfp_t gfp_mask)
{
const int hashval = hash_long(key, CFQ_QHASH_SHIFT);
struct cfq_queue *cfqq, *new_cfqq = NULL;
@@ -1578,7 +1578,7 @@
* cfqq, so we don't need to worry about it disappearing
*/
static struct cfq_io_context *
-cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, int gfp_mask)
+cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
{
struct io_context *ioc = NULL;
struct cfq_io_context *cic;
@@ -2075,7 +2075,7 @@
*/
static int
cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio,
- int gfp_mask)
+ gfp_t gfp_mask)
{
struct cfq_data *cfqd = q->elevator->elevator_data;
struct task_struct *tsk = current;
diff -urN fs/drivers/block/deadline-iosched.c block/drivers/block/deadline-iosched.c
--- fs/drivers/block/deadline-iosched.c 2005-09-22 14:50:49.000000000 -0400
+++ block/drivers/block/deadline-iosched.c 2005-10-09 01:24:16.000000000 -0400
@@ -756,7 +756,7 @@
static int
deadline_set_request(request_queue_t *q, struct request *rq, struct bio *bio,
- int gfp_mask)
+ gfp_t gfp_mask)
{
struct deadline_data *dd = q->elevator->elevator_data;
struct deadline_rq *drq;
diff -urN fs/drivers/block/elevator.c block/drivers/block/elevator.c
--- fs/drivers/block/elevator.c 2005-09-22 14:50:49.000000000 -0400
+++ block/drivers/block/elevator.c 2005-10-09 01:24:16.000000000 -0400
@@ -487,7 +487,7 @@
}
int elv_set_request(request_queue_t *q, struct request *rq, struct bio *bio,
- int gfp_mask)
+ gfp_t gfp_mask)
{
elevator_t *e = q->elevator;
diff -urN fs/drivers/block/ll_rw_blk.c block/drivers/block/ll_rw_blk.c
--- fs/drivers/block/ll_rw_blk.c 2005-09-22 14:50:49.000000000 -0400
+++ block/drivers/block/ll_rw_blk.c 2005-10-09 01:24:16.000000000 -0400
@@ -1652,13 +1652,13 @@
static int __make_request(request_queue_t *, struct bio *);
-request_queue_t *blk_alloc_queue(int gfp_mask)
+request_queue_t *blk_alloc_queue(gfp_t gfp_mask)
{
return blk_alloc_queue_node(gfp_mask, -1);
}
EXPORT_SYMBOL(blk_alloc_queue);
-request_queue_t *blk_alloc_queue_node(int gfp_mask, int node_id)
+request_queue_t *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
{
request_queue_t *q;
@@ -1787,7 +1787,7 @@
}
static inline struct request *
-blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, int gfp_mask)
+blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, gfp_t gfp_mask)
{
struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask);
@@ -1885,7 +1885,7 @@
* Returns !NULL on success, with queue_lock *not held*.
*/
static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
- int gfp_mask)
+ gfp_t gfp_mask)
{
struct request *rq = NULL;
struct request_list *rl = &q->rq;
@@ -2019,7 +2019,7 @@
return rq;
}
-struct request *blk_get_request(request_queue_t *q, int rw, int gfp_mask)
+struct request *blk_get_request(request_queue_t *q, int rw, gfp_t gfp_mask)
{
struct request *rq;
@@ -2251,7 +2251,7 @@
* @gfp_mask: memory allocation flags
*/
int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf,
- unsigned int len, unsigned int gfp_mask)
+ unsigned int len, gfp_t gfp_mask)
{
struct bio *bio;
@@ -3393,7 +3393,7 @@
* but since the current task itself holds a reference, the context can be
* used in general code, so long as it stays within `current` context.
*/
-struct io_context *current_io_context(int gfp_flags)
+struct io_context *current_io_context(gfp_t gfp_flags)
{
struct task_struct *tsk = current;
struct io_context *ret;
@@ -3424,7 +3424,7 @@
*
* This is always called in the context of the task which submitted the I/O.
*/
-struct io_context *get_io_context(int gfp_flags)
+struct io_context *get_io_context(gfp_t gfp_flags)
{
struct io_context *ret;
ret = current_io_context(gfp_flags);
diff -urN fs/include/linux/blkdev.h block/include/linux/blkdev.h
--- fs/include/linux/blkdev.h 2005-09-22 14:50:53.000000000 -0400
+++ block/include/linux/blkdev.h 2005-10-09 01:24:16.000000000 -0400
@@ -96,8 +96,8 @@
void put_io_context(struct io_context *ioc);
void exit_io_context(void);
-struct io_context *current_io_context(int gfp_flags);
-struct io_context *get_io_context(int gfp_flags);
+struct io_context *current_io_context(gfp_t gfp_flags);
+struct io_context *get_io_context(gfp_t gfp_flags);
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
@@ -354,7 +354,7 @@
* queue needs bounce pages for pages above this limit
*/
unsigned long bounce_pfn;
- unsigned int bounce_gfp;
+ gfp_t bounce_gfp;
/*
* various queue flags, see QUEUE_* below
@@ -550,7 +550,7 @@
extern void blk_put_request(struct request *);
extern void blk_end_sync_rq(struct request *rq);
extern void blk_attempt_remerge(request_queue_t *, struct request *);
-extern struct request *blk_get_request(request_queue_t *, int, int);
+extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
extern void blk_requeue_request(request_queue_t *, struct request *);
extern void blk_plug_device(request_queue_t *);
@@ -565,7 +565,7 @@
extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int);
extern int blk_rq_unmap_user(struct bio *, unsigned int);
-extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int);
+extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t);
extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
extern int blk_execute_rq(request_queue_t *, struct gendisk *,
struct request *, int);
@@ -654,8 +654,8 @@
extern void blk_finish_queue_drain(request_queue_t *);
int blk_get_queue(request_queue_t *);
-request_queue_t *blk_alloc_queue(int gfp_mask);
-request_queue_t *blk_alloc_queue_node(int,int);
+request_queue_t *blk_alloc_queue(gfp_t);
+request_queue_t *blk_alloc_queue_node(gfp_t, int);
#define blk_put_queue(q) blk_cleanup_queue((q))
/*
diff -urN fs/include/linux/elevator.h block/include/linux/elevator.h
--- fs/include/linux/elevator.h 2005-09-22 14:50:53.000000000 -0400
+++ block/include/linux/elevator.h 2005-10-09 01:24:16.000000000 -0400
@@ -18,7 +18,7 @@
typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *);
-typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, int);
+typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t);
typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
@@ -98,7 +98,7 @@
extern void elv_unregister_queue(request_queue_t *q);
extern int elv_may_queue(request_queue_t *, int, struct bio *);
extern void elv_completed_request(request_queue_t *, struct request *);
-extern int elv_set_request(request_queue_t *, struct request *, struct bio *, int);
+extern int elv_set_request(request_queue_t *, struct request *, struct bio *, gfp_t);
extern void elv_put_request(request_queue_t *, struct request *);
/*
^ permalink raw reply [flat|nested] 36+ messages in thread