diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-31 12:22:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 14:41:36 -0400 |
commit | 1d59d61f606547f0712aa6971f91f71154071c99 (patch) | |
tree | cb2fd4b9ce3e3ee9440d566d43ea350221edfc8e /fs/direct-io.c | |
parent | 2d117403b30cd7301af60d7d54b279a9f566d10d (diff) |
NFS: Ensure that setattr and getattr wait for O_DIRECT write completion
Use the same mechanism as the block devices are using, but move the
helper functions from fs/direct-io.c into fs/inode.c to remove the
dependency on CONFIG_BLOCK.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index f4aadd15b613..0c85fae37666 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -145,50 +145,6 @@ struct dio { | |||
145 | 145 | ||
146 | static struct kmem_cache *dio_cache __read_mostly; | 146 | static struct kmem_cache *dio_cache __read_mostly; |
147 | 147 | ||
148 | static void __inode_dio_wait(struct inode *inode) | ||
149 | { | ||
150 | wait_queue_head_t *wq = bit_waitqueue(&inode->i_state, __I_DIO_WAKEUP); | ||
151 | DEFINE_WAIT_BIT(q, &inode->i_state, __I_DIO_WAKEUP); | ||
152 | |||
153 | do { | ||
154 | prepare_to_wait(wq, &q.wait, TASK_UNINTERRUPTIBLE); | ||
155 | if (atomic_read(&inode->i_dio_count)) | ||
156 | schedule(); | ||
157 | } while (atomic_read(&inode->i_dio_count)); | ||
158 | finish_wait(wq, &q.wait); | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * inode_dio_wait - wait for outstanding DIO requests to finish | ||
163 | * @inode: inode to wait for | ||
164 | * | ||
165 | * Waits for all pending direct I/O requests to finish so that we can | ||
166 | * proceed with a truncate or equivalent operation. | ||
167 | * | ||
168 | * Must be called under a lock that serializes taking new references | ||
169 | * to i_dio_count, usually by inode->i_mutex. | ||
170 | */ | ||
171 | void inode_dio_wait(struct inode *inode) | ||
172 | { | ||
173 | if (atomic_read(&inode->i_dio_count)) | ||
174 | __inode_dio_wait(inode); | ||
175 | } | ||
176 | EXPORT_SYMBOL(inode_dio_wait); | ||
177 | |||
178 | /* | ||
179 | * inode_dio_done - signal finish of a direct I/O requests | ||
180 | * @inode: inode the direct I/O happens on | ||
181 | * | ||
182 | * This is called once we've finished processing a direct I/O request, | ||
183 | * and is used to wake up callers waiting for direct I/O to be quiesced. | ||
184 | */ | ||
185 | void inode_dio_done(struct inode *inode) | ||
186 | { | ||
187 | if (atomic_dec_and_test(&inode->i_dio_count)) | ||
188 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); | ||
189 | } | ||
190 | EXPORT_SYMBOL(inode_dio_done); | ||
191 | |||
192 | /* | 148 | /* |
193 | * How many pages are in the queue? | 149 | * How many pages are in the queue? |
194 | */ | 150 | */ |