Commit 637c36634029e4e7c81112796dafc32d56355b4a

Authored by Nadia Derbey
Committed by Linus Torvalds
1 parent 7748dbfaa0

ipc: remove the ipc_get() routine

This is a trivial patch that removes the ipc_get() routine: it is replaced
by a call to idr_find().

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 13 additions and 23 deletions Side-by-side Diff

... ... @@ -63,8 +63,6 @@
63 63 ((struct shmid_kernel*)ipc_lock(&shm_ids(ns),id))
64 64 #define shm_unlock(shp) \
65 65 ipc_unlock(&(shp)->shm_perm)
66   -#define shm_get(ns, id) \
67   - ((struct shmid_kernel*)ipc_get(&shm_ids(ns),id))
68 66 #define shm_buildid(ns, id, seq) \
69 67 ipc_buildid(&shm_ids(ns), id, seq)
70 68  
... ... @@ -563,7 +561,19 @@
563 561 struct shmid_kernel *shp;
564 562 struct inode *inode;
565 563  
566   - shp = shm_get(ns, next_id);
  564 + /*
  565 + * idr_find() is called via shm_get(), so with shm_ids.mutex
  566 + * locked. Since ipc_addid() is also called with
  567 + * shm_ids.mutex down, there is no need to add read barriers
  568 + * here to gurantee the writes in ipc_addid() are seen in
  569 + * order here (for Alpha).
  570 + * However idr_find() itself does not necessary require
  571 + * ipc_ids.mutex down. So if idr_find() is used by other
  572 + * places without ipc_ids.mutex down, then it needs read
  573 + * read memory barriers as ipc_lock() does.
  574 + */
  575 +
  576 + shp = idr_find(&shm_ids(ns).ipcs_idr, next_id);
567 577 if (shp == NULL)
568 578 continue;
569 579  
... ... @@ -669,25 +669,6 @@
669 669 out->seq = in->seq;
670 670 }
671 671  
672   -/*
673   - * So far only shm_get_stat() calls ipc_get() via shm_get(), so ipc_get()
674   - * is called with shm_ids.mutex locked. Since grow_ary() is also called with
675   - * shm_ids.mutex down(for Shared Memory), there is no need to add read
676   - * barriers here to gurantee the writes in grow_ary() are seen in order
677   - * here (for Alpha).
678   - *
679   - * However ipc_get() itself does not necessary require ipc_ids.mutex down. So
680   - * if in the future ipc_get() is used by other places without ipc_ids.mutex
681   - * down, then ipc_get() needs read memery barriers as ipc_lock() does.
682   - */
683   -struct kern_ipc_perm *ipc_get(struct ipc_ids *ids, int id)
684   -{
685   - struct kern_ipc_perm *out;
686   - int lid = id % SEQ_MULTIPLIER;
687   - out = idr_find(&ids->ipcs_idr, lid);
688   - return out;
689   -}
690   -
691 672 struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
692 673 {
693 674 struct kern_ipc_perm *out;
... ... @@ -103,7 +103,6 @@
103 103 void ipc_rcu_getref(void *ptr);
104 104 void ipc_rcu_putref(void *ptr);
105 105  
106   -struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id);
107 106 struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id);
108 107 void ipc_lock_by_ptr(struct kern_ipc_perm *ipcp);
109 108 void ipc_unlock(struct kern_ipc_perm* perm);