Whamcloud - gitweb
LU-14289 ptlrpc: move heap.c from libcfs to ptlrpc 29/41129/4
authorMr NeilBrown <neilb@suse.de>
Mon, 23 Nov 2020 02:26:22 +0000 (13:26 +1100)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 21:07:13 +0000 (21:07 +0000)
cfs_binheap is only used by the nrs code in ptlrpc, so move it out of
libcfs to the one place it is used.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I4687d4de0a83e0ce106d4f4cfd5ea95faef27dfc
Reviewed-on: https://review.whamcloud.com/41129
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/Makefile.am
libcfs/include/libcfs/libcfs.h
libcfs/libcfs/Makefile.in
libcfs/libcfs/autoMakefile.am
lustre/include/lustre_nrs.h
lustre/ptlrpc/Makefile.in
lustre/ptlrpc/heap.c [moved from libcfs/libcfs/heap.c with 96% similarity]
lustre/ptlrpc/heap.h [moved from libcfs/include/libcfs/libcfs_heap.h with 91% similarity]
lustre/ptlrpc/ptlrpc_internal.h

index 66d1f73..1e65107 100644 (file)
@@ -14,7 +14,6 @@ EXTRA_DIST = \
        libcfs_debug.h \
        libcfs_fail.h \
        libcfs_hash.h \
-       libcfs_heap.h \
        libcfs_private.h \
        libcfs_string.h \
        libcfs_workitem.h
index 2bbc820..df7234d 100644 (file)
@@ -54,7 +54,6 @@
 #include <libcfs/libcfs_string.h>
 #include <libcfs/libcfs_workitem.h>
 #include <libcfs/libcfs_hash.h>
-#include <libcfs/libcfs_heap.h>
 #include <libcfs/libcfs_fail.h>
 #include "curproc.h"
 
index f8e645e..3587ba6 100644 (file)
@@ -16,7 +16,7 @@ libcfs-crypto-objs := $(addprefix crypto/,$(libcfs-crypto-objs))
 
 libcfs-objs-$(CONFIG_SMP) = libcfs_cpu.o
 libcfs-all-objs := debug.o fail.o module.o tracefile.o \
-                  libcfs_string.o hash.o heap.o \
+                  libcfs_string.o hash.o \
                   workitem.o \
                   libcfs_mem.o libcfs_lock.o \
                   linux-crypto.o linux-crypto-adler.o \
index 7d6553c..d465984 100644 (file)
@@ -60,5 +60,5 @@ endif # MODULES
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ linux/*.o libcfs crypto/*.o
 EXTRA_DIST := $(libcfs-all-objs:%.o=%.c) tracefile.h \
              workitem.c fail.c libcfs_cpu.c \
-             heap.c libcfs_mem.c libcfs_lock.c \
+             libcfs_mem.c libcfs_lock.c \
              linux-crypto.h
index 8223c08..4f08eab 100644 (file)
@@ -672,6 +672,16 @@ enum {
 };
 
 #include <lustre_nrs_fifo.h>
+/**
+ * Binary heap node.
+ *
+ * Objects of this type are embedded into objects of the ordered set that is to
+ * be maintained by a \e struct cfs_binheap instance.
+ */
+struct cfs_binheap_node {
+       /** Index into the binary tree */
+       unsigned int    chn_index;
+};
 #ifdef HAVE_SERVER_SUPPORT
 #include <lustre_nrs_tbf.h>
 #include <lustre_nrs_crr.h>
index aeea155..6eee21f 100644 (file)
@@ -22,7 +22,7 @@ ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o
 ptlrpc_objs += llog_net.o llog_client.o llog_server.o import.o ptlrpcd.o
 ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o
 ptlrpc_objs += sec.o sec_ctx.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o
-ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o nrs_delay.o
+ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o nrs_delay.o heap.o
 ptlrpc_objs += errno.o
 
 nrs_server_objs := nrs_crr.o nrs_orr.o nrs_tbf.o
@@ -54,7 +54,7 @@ barrier.c: @LUSTRE@/target/barrier.c
        ln -sf $< $@
 
 EXTRA_DIST := $(ptlrpc_objs:.o=.c) ptlrpc_internal.h
-EXTRA_DIST += $(nodemap_objs:.o=.c) nodemap_internal.h
+EXTRA_DIST += $(nodemap_objs:.o=.c) nodemap_internal.h heap.h
 EXTRA_DIST += $(nrs_server_objs:.o=.c)
 
 EXTRA_PRE_CFLAGS := -I@LUSTRE@/ldlm -I@LUSTRE@/target
similarity index 96%
rename from libcfs/libcfs/heap.c
rename to lustre/ptlrpc/heap.c
index d625cbc..ddeca8b 100644 (file)
  * GNU General Public License version 2 for more details.  A copy is
  * included in the COPYING file that accompanied this code.
 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
  * GPL HEADER END
  */
 /*
@@ -36,6 +32,8 @@
 #define DEBUG_SUBSYSTEM S_LNET
 
 #include <libcfs/libcfs.h>
+#include <lustre_net.h>
+#include "heap.h"
 
 #define CBH_ALLOC(ptr, h)                                              \
 do {                                                                   \
@@ -51,7 +49,7 @@ do {                                                                  \
                if ((h)->cbh_flags & CBH_FLAG_ATOMIC_GROW)              \
                        LIBCFS_ALLOC_ATOMIC((ptr), CBH_NOB);            \
                else                                                    \
-                       LIBCFS_ALLOC((ptr), CBH_NOB);                   \
+                       LIBCFS_ALLOC((ptr), CBH_NOB);                   \
        }                                                               \
 } while (0)
 
@@ -165,7 +163,7 @@ cfs_binheap_grow(struct cfs_binheap *h)
  */
 struct cfs_binheap *
 cfs_binheap_create(struct cfs_binheap_ops *ops, unsigned int flags,
-                  unsigned count, void *arg, struct cfs_cpt_table *cptab,
+                  unsigned int count, void *arg, struct cfs_cpt_table *cptab,
                   int cptid)
 {
        struct cfs_binheap *h;
@@ -274,8 +272,8 @@ cfs_binheap_pointer(struct cfs_binheap *h, unsigned int idx)
                return &(h->cbh_elements2[idx >> CBH_SHIFT][idx & CBH_MASK]);
 
        idx -= CBH_SIZE * CBH_SIZE;
-       return &(h->cbh_elements3[idx >> (2 * CBH_SHIFT)]\
-                                [(idx >> CBH_SHIFT) & CBH_MASK]\
+       return &(h->cbh_elements3[idx >> (2 * CBH_SHIFT)]
+                                [(idx >> CBH_SHIFT) & CBH_MASK]
                                 [idx & CBH_MASK]);
 }
 
similarity index 91%
rename from libcfs/include/libcfs/libcfs_heap.h
rename to lustre/ptlrpc/heap.h
index 239e9e0..36899a8 100644 (file)
  * GNU General Public License version 2 for more details.  A copy is
  * included in the COPYING file that accompanied this code.
 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
  * GPL HEADER END
  */
 /*
  * @{
  */
 
-/**
- * Binary heap node.
- *
- * Objects of this type are embedded into objects of the ordered set that is to
- * be maintained by a \e struct cfs_binheap instance.
- */
-struct cfs_binheap_node {
-       /** Index into the binary tree */
-       unsigned int    chn_index;
-};
-
 #define CBH_SHIFT      9
 #define CBH_SIZE       (1 << CBH_SHIFT)                    /* # ptrs per level */
 #define CBH_MASK       (CBH_SIZE - 1)
@@ -162,7 +147,7 @@ struct cfs_binheap {
 void cfs_binheap_destroy(struct cfs_binheap *h);
 struct cfs_binheap *
 cfs_binheap_create(struct cfs_binheap_ops *ops, unsigned int flags,
-                  unsigned count, void *arg, struct cfs_cpt_table *cptab,
+                  unsigned int count, void *arg, struct cfs_cpt_table *cptab,
                   int cptid);
 struct cfs_binheap_node *
 cfs_binheap_find(struct cfs_binheap *h, unsigned int idx);
index c702767..04cbabf 100644 (file)
@@ -36,6 +36,7 @@
 #define PTLRPC_INTERNAL_H
 
 #include "../ldlm/ldlm_internal.h"
+#include "heap.h"
 
 struct ldlm_namespace;
 struct obd_import;