diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2005-10-07 02:46:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-08 18:00:57 -0400 |
commit | dd0fc66fb33cd610bc1a5db8a5e232d34879b4d7 (patch) | |
tree | 51f96a9db96293b352e358f66032e1f4ff79fafb /fs | |
parent | 3b0e77bd144203a507eb191f7117d2c5004ea1de (diff) |
[PATCH] gfp flags annotations - part 1
- added typedef unsigned int __nocast gfp_t;
- replaced __nocast uses for gfp flags with gfp_t - it gives exactly
the same warnings as far as sparse is concerned, doesn't change
generated code (from gcc point of view we replaced unsigned int with
typedef) and documents what's going on far better.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 10 | ||||
-rw-r--r-- | fs/buffer.c | 2 | ||||
-rw-r--r-- | fs/mpage.c | 2 | ||||
-rw-r--r-- | fs/ntfs/malloc.h | 2 | ||||
-rw-r--r-- | fs/posix_acl.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 10 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 13 |
7 files changed, 22 insertions, 23 deletions
@@ -75,7 +75,7 @@ struct bio_set { | |||
75 | */ | 75 | */ |
76 | static struct bio_set *fs_bio_set; | 76 | static struct bio_set *fs_bio_set; |
77 | 77 | ||
78 | static inline struct bio_vec *bvec_alloc_bs(unsigned int __nocast gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) | 78 | static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) |
79 | { | 79 | { |
80 | struct bio_vec *bvl; | 80 | struct bio_vec *bvl; |
81 | struct biovec_slab *bp; | 81 | struct biovec_slab *bp; |
@@ -155,7 +155,7 @@ inline void bio_init(struct bio *bio) | |||
155 | * allocate bio and iovecs from the memory pools specified by the | 155 | * allocate bio and iovecs from the memory pools specified by the |
156 | * bio_set structure. | 156 | * bio_set structure. |
157 | **/ | 157 | **/ |
158 | struct bio *bio_alloc_bioset(unsigned int __nocast gfp_mask, int nr_iovecs, struct bio_set *bs) | 158 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) |
159 | { | 159 | { |
160 | struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask); | 160 | struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask); |
161 | 161 | ||
@@ -181,7 +181,7 @@ out: | |||
181 | return bio; | 181 | return bio; |
182 | } | 182 | } |
183 | 183 | ||
184 | struct bio *bio_alloc(unsigned int __nocast gfp_mask, int nr_iovecs) | 184 | struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs) |
185 | { | 185 | { |
186 | struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); | 186 | struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); |
187 | 187 | ||
@@ -277,7 +277,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src) | |||
277 | * | 277 | * |
278 | * Like __bio_clone, only also allocates the returned bio | 278 | * Like __bio_clone, only also allocates the returned bio |
279 | */ | 279 | */ |
280 | struct bio *bio_clone(struct bio *bio, unsigned int __nocast gfp_mask) | 280 | struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) |
281 | { | 281 | { |
282 | struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); | 282 | struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); |
283 | 283 | ||
@@ -1078,7 +1078,7 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors) | |||
1078 | return bp; | 1078 | return bp; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | static void *bio_pair_alloc(unsigned int __nocast gfp_flags, void *data) | 1081 | static void *bio_pair_alloc(gfp_t gfp_flags, void *data) |
1082 | { | 1082 | { |
1083 | return kmalloc(sizeof(struct bio_pair), gfp_flags); | 1083 | return kmalloc(sizeof(struct bio_pair), gfp_flags); |
1084 | } | 1084 | } |
diff --git a/fs/buffer.c b/fs/buffer.c index 6cbfceabd95d..1216c0d3c8ce 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -3045,7 +3045,7 @@ static void recalc_bh_state(void) | |||
3045 | buffer_heads_over_limit = (tot > max_buffer_heads); | 3045 | buffer_heads_over_limit = (tot > max_buffer_heads); |
3046 | } | 3046 | } |
3047 | 3047 | ||
3048 | struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags) | 3048 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) |
3049 | { | 3049 | { |
3050 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); | 3050 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); |
3051 | if (ret) { | 3051 | if (ret) { |
diff --git a/fs/mpage.c b/fs/mpage.c index bb9aebe93862..c5adcdddf3cc 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -102,7 +102,7 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio) | |||
102 | static struct bio * | 102 | static struct bio * |
103 | mpage_alloc(struct block_device *bdev, | 103 | mpage_alloc(struct block_device *bdev, |
104 | sector_t first_sector, int nr_vecs, | 104 | sector_t first_sector, int nr_vecs, |
105 | unsigned int __nocast gfp_flags) | 105 | gfp_t gfp_flags) |
106 | { | 106 | { |
107 | struct bio *bio; | 107 | struct bio *bio; |
108 | 108 | ||
diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h index 006946efca8c..590887b943f5 100644 --- a/fs/ntfs/malloc.h +++ b/fs/ntfs/malloc.h | |||
@@ -40,7 +40,7 @@ | |||
40 | * Depending on @gfp_mask the allocation may be guaranteed to succeed. | 40 | * Depending on @gfp_mask the allocation may be guaranteed to succeed. |
41 | */ | 41 | */ |
42 | static inline void *__ntfs_malloc(unsigned long size, | 42 | static inline void *__ntfs_malloc(unsigned long size, |
43 | unsigned int __nocast gfp_mask) | 43 | gfp_t gfp_mask) |
44 | { | 44 | { |
45 | if (likely(size <= PAGE_SIZE)) { | 45 | if (likely(size <= PAGE_SIZE)) { |
46 | BUG_ON(!size); | 46 | BUG_ON(!size); |
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 296480e96dd5..6c8dcf7613fd 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c | |||
@@ -35,7 +35,7 @@ EXPORT_SYMBOL(posix_acl_permission); | |||
35 | * Allocate a new ACL with the specified number of entries. | 35 | * Allocate a new ACL with the specified number of entries. |
36 | */ | 36 | */ |
37 | struct posix_acl * | 37 | struct posix_acl * |
38 | posix_acl_alloc(int count, unsigned int __nocast flags) | 38 | posix_acl_alloc(int count, gfp_t flags) |
39 | { | 39 | { |
40 | const size_t size = sizeof(struct posix_acl) + | 40 | const size_t size = sizeof(struct posix_acl) + |
41 | count * sizeof(struct posix_acl_entry); | 41 | count * sizeof(struct posix_acl_entry); |
@@ -51,7 +51,7 @@ posix_acl_alloc(int count, unsigned int __nocast flags) | |||
51 | * Clone an ACL. | 51 | * Clone an ACL. |
52 | */ | 52 | */ |
53 | struct posix_acl * | 53 | struct posix_acl * |
54 | posix_acl_clone(const struct posix_acl *acl, unsigned int __nocast flags) | 54 | posix_acl_clone(const struct posix_acl *acl, gfp_t flags) |
55 | { | 55 | { |
56 | struct posix_acl *clone = NULL; | 56 | struct posix_acl *clone = NULL; |
57 | 57 | ||
@@ -185,7 +185,7 @@ posix_acl_equiv_mode(const struct posix_acl *acl, mode_t *mode_p) | |||
185 | * Create an ACL representing the file mode permission bits of an inode. | 185 | * Create an ACL representing the file mode permission bits of an inode. |
186 | */ | 186 | */ |
187 | struct posix_acl * | 187 | struct posix_acl * |
188 | posix_acl_from_mode(mode_t mode, unsigned int __nocast flags) | 188 | posix_acl_from_mode(mode_t mode, gfp_t flags) |
189 | { | 189 | { |
190 | struct posix_acl *acl = posix_acl_alloc(3, flags); | 190 | struct posix_acl *acl = posix_acl_alloc(3, flags); |
191 | if (!acl) | 191 | if (!acl) |
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 4b184559f231..d2653b589b1c 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | 46 | ||
47 | void * | 47 | void * |
48 | kmem_alloc(size_t size, unsigned int __nocast flags) | 48 | kmem_alloc(size_t size, gfp_t flags) |
49 | { | 49 | { |
50 | int retries = 0; | 50 | int retries = 0; |
51 | unsigned int lflags = kmem_flags_convert(flags); | 51 | unsigned int lflags = kmem_flags_convert(flags); |
@@ -67,7 +67,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | void * | 69 | void * |
70 | kmem_zalloc(size_t size, unsigned int __nocast flags) | 70 | kmem_zalloc(size_t size, gfp_t flags) |
71 | { | 71 | { |
72 | void *ptr; | 72 | void *ptr; |
73 | 73 | ||
@@ -90,7 +90,7 @@ kmem_free(void *ptr, size_t size) | |||
90 | 90 | ||
91 | void * | 91 | void * |
92 | kmem_realloc(void *ptr, size_t newsize, size_t oldsize, | 92 | kmem_realloc(void *ptr, size_t newsize, size_t oldsize, |
93 | unsigned int __nocast flags) | 93 | gfp_t flags) |
94 | { | 94 | { |
95 | void *new; | 95 | void *new; |
96 | 96 | ||
@@ -105,7 +105,7 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize, | |||
105 | } | 105 | } |
106 | 106 | ||
107 | void * | 107 | void * |
108 | kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) | 108 | kmem_zone_alloc(kmem_zone_t *zone, gfp_t flags) |
109 | { | 109 | { |
110 | int retries = 0; | 110 | int retries = 0; |
111 | unsigned int lflags = kmem_flags_convert(flags); | 111 | unsigned int lflags = kmem_flags_convert(flags); |
@@ -124,7 +124,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void * | 126 | void * |
127 | kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags) | 127 | kmem_zone_zalloc(kmem_zone_t *zone, gfp_t flags) |
128 | { | 128 | { |
129 | void *ptr; | 129 | void *ptr; |
130 | 130 | ||
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index 109fcf27e256..ee7010f085bc 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -81,7 +81,7 @@ typedef unsigned long xfs_pflags_t; | |||
81 | *(NSTATEP) = *(OSTATEP); \ | 81 | *(NSTATEP) = *(OSTATEP); \ |
82 | } while (0) | 82 | } while (0) |
83 | 83 | ||
84 | static __inline unsigned int kmem_flags_convert(unsigned int __nocast flags) | 84 | static __inline unsigned int kmem_flags_convert(gfp_t flags) |
85 | { | 85 | { |
86 | unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ | 86 | unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ |
87 | 87 | ||
@@ -125,13 +125,12 @@ kmem_zone_destroy(kmem_zone_t *zone) | |||
125 | BUG(); | 125 | BUG(); |
126 | } | 126 | } |
127 | 127 | ||
128 | extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); | 128 | extern void *kmem_zone_zalloc(kmem_zone_t *, gfp_t); |
129 | extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast); | 129 | extern void *kmem_zone_alloc(kmem_zone_t *, gfp_t); |
130 | 130 | ||
131 | extern void *kmem_alloc(size_t, unsigned int __nocast); | 131 | extern void *kmem_alloc(size_t, gfp_t); |
132 | extern void *kmem_realloc(void *, size_t, size_t, | 132 | extern void *kmem_realloc(void *, size_t, size_t, gfp_t); |
133 | unsigned int __nocast); | 133 | extern void *kmem_zalloc(size_t, gfp_t); |
134 | extern void *kmem_zalloc(size_t, unsigned int __nocast); | ||
135 | extern void kmem_free(void *, size_t); | 134 | extern void kmem_free(void *, size_t); |
136 | 135 | ||
137 | typedef struct shrinker *kmem_shaker_t; | 136 | typedef struct shrinker *kmem_shaker_t; |