Skip to content

Commit 0dc2bc4

Browse files
Andi Kleenroot
authored andcommitted
direct-io: rearrange fields in dio/dio_submit to avoid holes
Fix most problems reported by pahole. There is still a weird 104 byte hole after map_bh. I'm not sure what causes this. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent cde1ecb commit 0dc2bc4

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎fs/direct-io.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ struct dio_submit {
7373
sector_t block_in_file; /* Current offset into the underlying
7474
file in dio_block units. */
7575
unsigned blocks_available; /* At block_in_file. changes */
76+
int reap_counter; /* rate limit reaping */
7677
sector_t final_block_in_request;/* doesn't change */
7778
unsigned first_block_in_page; /* doesn't change, Used only once */
7879
int boundary; /* prev block is at a boundary */
79-
int reap_counter; /* rate limit reaping */
8080
get_block_t *get_block; /* block mapping function */
8181
dio_submit_t *submit_io; /* IO submition function */
8282

@@ -114,27 +114,26 @@ struct dio_submit {
114114
/* dio_state communicated between submission path and end_io */
115115
struct dio {
116116
int flags; /* doesn't change */
117-
struct inode *inode;
118117
int rw;
118+
struct inode *inode;
119119
loff_t i_size; /* i_size when submitted */
120120
dio_iodone_t *end_io; /* IO completion function */
121-
struct buffer_head map_bh; /* last get_block() result */
122121

123122

124123
/* BIO completion state */
125124
spinlock_t bio_lock; /* protects BIO fields below */
125+
int page_errors; /* errno from get_user_pages() */
126+
int is_async; /* is IO async ? */
127+
int io_error; /* IO error in completion path */
126128
unsigned long refcount; /* direct_io_worker() and bios */
127129
struct bio *bio_list; /* singly linked via bi_private */
128130
struct task_struct *waiter; /* waiting task (NULL if none) */
129131

130132
/* AIO related stuff */
131133
struct kiocb *iocb; /* kiocb */
132-
int is_async; /* is IO async ? */
133-
int io_error; /* IO error in completion path */
134134
ssize_t result; /* IO result */
135135

136-
int page_errors; /* errno from get_user_pages() */
137-
136+
struct buffer_head map_bh; /* last get_block() result */
138137
/*
139138
* pages[] (and any fields placed after it) are not zeroed out at
140139
* allocation time. Don't add new fields after pages[] unless you

0 commit comments

Comments
 (0)