Skip to content

Commit 8dcf07b

Browse files
author
Bart Van Assche
committed
target: Minimize #include directives
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%. Signed-off-by: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Bryant G. Ly <[email protected]>
1 parent f504572 commit 8dcf07b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+187
-25
lines changed

drivers/target/iscsi/iscsi_target.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include <linux/module.h>
2424
#include <linux/vmalloc.h>
2525
#include <linux/idr.h>
26+
#include <linux/delay.h>
2627
#include <asm/unaligned.h>
28+
#include <net/ipv6.h>
2729
#include <scsi/scsi_proto.h>
2830
#include <scsi/iscsi_proto.h>
2931
#include <scsi/scsi_tcq.h>

drivers/target/iscsi/iscsi_target.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#ifndef ISCSI_TARGET_H
22
#define ISCSI_TARGET_H
33

4+
#include <linux/types.h>
5+
#include <linux/spinlock.h>
6+
7+
struct iscsi_cmd;
8+
struct iscsi_conn;
9+
struct iscsi_np;
10+
struct iscsi_portal_group;
11+
struct iscsi_session;
12+
struct iscsi_tpg_np;
13+
struct kref;
14+
struct sockaddr_storage;
15+
416
extern struct iscsi_tiqn *iscsit_get_tiqn_for_login(unsigned char *);
517
extern struct iscsi_tiqn *iscsit_get_tiqn(unsigned char *, int);
618
extern void iscsit_put_tiqn_for_login(struct iscsi_tiqn *);

drivers/target/iscsi/iscsi_target_auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <linux/kernel.h>
2121
#include <linux/string.h>
2222
#include <linux/err.h>
23+
#include <linux/random.h>
2324
#include <linux/scatterlist.h>
24-
2525
#include <target/iscsi/iscsi_target_core.h>
2626
#include "iscsi_target_nego.h"
2727
#include "iscsi_target_auth.h"

drivers/target/iscsi/iscsi_target_auth.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _ISCSI_CHAP_H_
22
#define _ISCSI_CHAP_H_
33

4+
#include <linux/types.h>
5+
46
#define CHAP_DIGEST_UNKNOWN 0
57
#define CHAP_DIGEST_MD5 5
68
#define CHAP_DIGEST_SHA 6
@@ -18,6 +20,9 @@
1820
#define CHAP_STAGE_CLIENT_NRIC 4
1921
#define CHAP_STAGE_SERVER_NR 5
2022

23+
struct iscsi_node_auth;
24+
struct iscsi_conn;
25+
2126
extern u32 chap_main_loop(struct iscsi_conn *, struct iscsi_node_auth *, char *, char *,
2227
int *, int *);
2328

drivers/target/iscsi/iscsi_target_configfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
#include <linux/ctype.h>
2222
#include <linux/export.h>
2323
#include <linux/inet.h>
24+
#include <linux/module.h>
25+
#include <net/ipv6.h>
2426
#include <target/target_core_base.h>
2527
#include <target/target_core_fabric.h>
2628
#include <target/iscsi/iscsi_transport.h>
27-
2829
#include <target/iscsi/iscsi_target_core.h>
2930
#include "iscsi_target_parameters.h"
3031
#include "iscsi_target_device.h"

drivers/target/iscsi/iscsi_target_datain_values.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* GNU General Public License for more details.
1717
******************************************************************************/
1818

19+
#include <linux/slab.h>
1920
#include <scsi/iscsi_proto.h>
20-
2121
#include <target/iscsi/iscsi_target_core.h>
2222
#include "iscsi_target_seq_pdu_list.h"
2323
#include "iscsi_target_erl1.h"

drivers/target/iscsi/iscsi_target_datain_values.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#ifndef ISCSI_TARGET_DATAIN_VALUES_H
22
#define ISCSI_TARGET_DATAIN_VALUES_H
33

4+
struct iscsi_cmd;
5+
struct iscsi_datain;
6+
47
extern struct iscsi_datain_req *iscsit_allocate_datain_req(void);
58
extern void iscsit_attach_datain_req(struct iscsi_cmd *, struct iscsi_datain_req *);
69
extern void iscsit_free_datain_req(struct iscsi_cmd *, struct iscsi_datain_req *);

drivers/target/iscsi/iscsi_target_device.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#ifndef ISCSI_TARGET_DEVICE_H
22
#define ISCSI_TARGET_DEVICE_H
33

4+
struct iscsi_cmd;
5+
struct iscsi_session;
6+
47
extern void iscsit_determine_maxcmdsn(struct iscsi_session *);
58
extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
69

drivers/target/iscsi/iscsi_target_erl0.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef ISCSI_TARGET_ERL0_H
22
#define ISCSI_TARGET_ERL0_H
33

4+
#include <linux/types.h>
5+
6+
struct iscsi_cmd;
7+
struct iscsi_conn;
8+
struct iscsi_session;
9+
410
extern void iscsit_set_dataout_sequence_values(struct iscsi_cmd *);
511
extern int iscsit_check_pre_dataout(struct iscsi_cmd *, unsigned char *);
612
extern int iscsit_check_post_dataout(struct iscsi_cmd *, unsigned char *, u8);

drivers/target/iscsi/iscsi_target_erl1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
******************************************************************************/
1818

1919
#include <linux/list.h>
20+
#include <linux/slab.h>
2021
#include <scsi/iscsi_proto.h>
2122
#include <target/target_core_base.h>
2223
#include <target/target_core_fabric.h>

0 commit comments

Comments
 (0)