On 11/15/16 1:38 PM, Bart Van Assche wrote:
Remove superfluous #include directives from the include/target/*.h
files. Add missing #include directives to other *.h and *.c files.
Use forward declarations for structures where possible. This
change reduces the build time for make M=drivers/target on my
laptop from 27.1s to 18.7s or by about 30%. This patch has been
compile tested by building the Linux kernel with a config in which
all target drivers except ibmvscsi_tgt were enabled.
Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Bryant G. Ly <bryantly@xxxxxxxxxxxxxxxxxx>
---
<SNIP>
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -1,8 +1,14 @@
#ifndef TARGET_CORE_BACKEND_H
#define TARGET_CORE_BACKEND_H
+#include <linux/types.h>
+#include <target/target_core_base.h>
+
#define TRANSPORT_FLAG_PASSTHROUGH 1
+struct request_queue;
+struct scatterlist;
+
struct target_backend_ops {
char name[16];
char inquiry_prod[16];
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index c211900..ca8ec72 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -1,14 +1,10 @@
#ifndef TARGET_CORE_BASE_H
#define TARGET_CORE_BASE_H
-#include <linux/in.h>
-#include <linux/configfs.h>
-#include <linux/dma-mapping.h>
-#include <linux/blkdev.h>
-#include <linux/percpu_ida.h>
-#include <linux/t10-pi.h>
-#include <net/sock.h>
-#include <net/tcp.h>
+#include <linux/configfs.h> /* struct config_group */
+#include <linux/dma-direction.h> /* enum dma_data_direction */
+#include <linux/percpu_ida.h> /* struct percpu_ida */
+#include <linux/semaphore.h> /* struct semaphore */
#define TARGET_CORE_VERSION "v5.0"
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 5cd6faa..358041b 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -1,6 +1,10 @@
#ifndef TARGET_CORE_FABRIC_H
#define TARGET_CORE_FABRIC_H
+#include <linux/configfs.h>
+#include <linux/types.h>
+#include <target/target_core_base.h>
+
struct target_core_fabric_ops {
struct module *module;
const char *name;
When I pulled target/master with your patch set and compiled I get:
drivers/target/target_core_user.c: In function ‘tcmu_flush_dcache_range’:
drivers/target/target_core_user.c:200:3: error: implicit declaration of
function ‘flush_dcache_page’ [-Werror=implicit-function-declaration]
flush_dcache_page(virt_to_page(vaddr));
^
drivers/target/target_core_user.c: In function
‘alloc_and_scatter_data_area’:
drivers/target/target_core_user.c:270:10: error: implicit declaration of
function ‘kmap_atomic’ [-Werror=implicit-function-declaration]
from = kmap_atomic(sg_page(sg)) + sg->offset;
^
drivers/target/target_core_user.c:270:8: warning: assignment makes
pointer from integer without a cast [-Wint-conversion]
from = kmap_atomic(sg_page(sg)) + sg->offset;
^
drivers/target/target_core_user.c:299:3: error: implicit declaration of
function ‘kunmap_atomic’ [-Werror=implicit-function-declaration]
kunmap_atomic(from - sg->offset);
^
drivers/target/target_core_user.c: In function ‘gather_data_area’:
drivers/target/target_core_user.c:320:6: warning: assignment makes
pointer from integer without a cast [-Wint-conversion]
to = kmap_atomic(sg_page(sg)) + sg->offset;
Also with your changes, I'll need these changes for ibmvscsi_tgt:
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index c9fa356..2583e8b 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -30,6 +30,7 @@
#include <linux/types.h>
#include <linux/list.h>
#include <linux/string.h>
+#include <linux/delay.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
index 98b0ca7..4b940cd 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
@@ -26,6 +26,8 @@
#ifndef __H_IBMVSCSI_TGT
#define __H_IBMVSCSI_TGT
+#include <linux/interrupt.h>
+
#include "libsrp.h"
#define SYS_ID_NAME_LEN 64
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html