diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-07-26 03:21:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 11:25:28 -0400 |
commit | 9a18540915faaaadd7f71c16fa877a0c19675923 (patch) | |
tree | d7c8d0e44c7f680e77b50bda457925d5d25d826d | |
parent | 67935df49dae836fa86621861979fafdfd37ae59 (diff) |
[PATCH 2/2] proc: switch inode number allocation to IDA
proc doesn't use "associate pointer with id" feature of IDR, so switch
to IDA.
NOTE, NOTE, NOTE:
Do not apply if release_inode_number() still mantions MAX_ID_MASK!
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/proc/generic.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index b85e36e153ba..4fb81e9c94e3 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -300,7 +300,7 @@ out: | |||
300 | return rtn; | 300 | return rtn; |
301 | } | 301 | } |
302 | 302 | ||
303 | static DEFINE_IDR(proc_inum_idr); | 303 | static DEFINE_IDA(proc_inum_ida); |
304 | static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */ | 304 | static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */ |
305 | 305 | ||
306 | #define PROC_DYNAMIC_FIRST 0xF0000000U | 306 | #define PROC_DYNAMIC_FIRST 0xF0000000U |
@@ -315,11 +315,11 @@ static unsigned int get_inode_number(void) | |||
315 | int error; | 315 | int error; |
316 | 316 | ||
317 | retry: | 317 | retry: |
318 | if (idr_pre_get(&proc_inum_idr, GFP_KERNEL) == 0) | 318 | if (ida_pre_get(&proc_inum_ida, GFP_KERNEL) == 0) |
319 | return 0; | 319 | return 0; |
320 | 320 | ||
321 | spin_lock(&proc_inum_lock); | 321 | spin_lock(&proc_inum_lock); |
322 | error = idr_get_new(&proc_inum_idr, NULL, &i); | 322 | error = ida_get_new(&proc_inum_ida, &i); |
323 | spin_unlock(&proc_inum_lock); | 323 | spin_unlock(&proc_inum_lock); |
324 | if (error == -EAGAIN) | 324 | if (error == -EAGAIN) |
325 | goto retry; | 325 | goto retry; |
@@ -328,7 +328,7 @@ retry: | |||
328 | 328 | ||
329 | if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { | 329 | if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { |
330 | spin_lock(&proc_inum_lock); | 330 | spin_lock(&proc_inum_lock); |
331 | idr_remove(&proc_inum_idr, i); | 331 | ida_remove(&proc_inum_ida, i); |
332 | spin_unlock(&proc_inum_lock); | 332 | spin_unlock(&proc_inum_lock); |
333 | } | 333 | } |
334 | return PROC_DYNAMIC_FIRST + i; | 334 | return PROC_DYNAMIC_FIRST + i; |
@@ -337,7 +337,7 @@ retry: | |||
337 | static void release_inode_number(unsigned int inum) | 337 | static void release_inode_number(unsigned int inum) |
338 | { | 338 | { |
339 | spin_lock(&proc_inum_lock); | 339 | spin_lock(&proc_inum_lock); |
340 | idr_remove(&proc_inum_idr, inum - PROC_DYNAMIC_FIRST); | 340 | ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); |
341 | spin_unlock(&proc_inum_lock); | 341 | spin_unlock(&proc_inum_lock); |
342 | } | 342 | } |
343 | 343 | ||