diff options
author | jvrao <jvrao@linux.vnet.ibm.com> | 2010-08-24 11:43:28 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-10-28 10:08:45 -0400 |
commit | 3e24ad2ff9d477f949acd0982cf12e58812210cb (patch) | |
tree | f234e6df673e7d2a6e394949dbe7f98ed6032a8c /fs/9p | |
parent | 4f7ebe807242898ee08ed732d56982874442c304 (diff) |
9p: Add a Direct IO support for non-cached operations.
The presence of v9fs_direct_IO() in the address space ops vector
allowes open() O_DIRECT flags which would have failed otherwise.
In the non-cached mode, we shunt off direct read and write requests before
the VFS gets them, so this method should never be called.
Direct IO is not 'yet' supported in the cached mode. Hence when
this routine is called through generic_file_aio_read(), the read/write fails
with an error.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/vfs_addr.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 90e38449f4b3..b7f2a8e3863e 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -154,10 +154,40 @@ static int v9fs_launder_page(struct page *page) | |||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | /** | ||
158 | * v9fs_direct_IO - 9P address space operation for direct I/O | ||
159 | * @rw: direction (read or write) | ||
160 | * @iocb: target I/O control block | ||
161 | * @iov: array of vectors that define I/O buffer | ||
162 | * @pos: offset in file to begin the operation | ||
163 | * @nr_segs: size of iovec array | ||
164 | * | ||
165 | * The presence of v9fs_direct_IO() in the address space ops vector | ||
166 | * allowes open() O_DIRECT flags which would have failed otherwise. | ||
167 | * | ||
168 | * In the non-cached mode, we shunt off direct read and write requests before | ||
169 | * the VFS gets them, so this method should never be called. | ||
170 | * | ||
171 | * Direct IO is not 'yet' supported in the cached mode. Hence when | ||
172 | * this routine is called through generic_file_aio_read(), the read/write fails | ||
173 | * with an error. | ||
174 | * | ||
175 | */ | ||
176 | ssize_t v9fs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | ||
177 | loff_t pos, unsigned long nr_segs) | ||
178 | { | ||
179 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) " | ||
180 | "off/no(%lld/%lu) EINVAL\n", | ||
181 | iocb->ki_filp->f_path.dentry->d_name.name, | ||
182 | (long long) pos, nr_segs); | ||
183 | |||
184 | return -EINVAL; | ||
185 | } | ||
157 | const struct address_space_operations v9fs_addr_operations = { | 186 | const struct address_space_operations v9fs_addr_operations = { |
158 | .readpage = v9fs_vfs_readpage, | 187 | .readpage = v9fs_vfs_readpage, |
159 | .readpages = v9fs_vfs_readpages, | 188 | .readpages = v9fs_vfs_readpages, |
160 | .releasepage = v9fs_release_page, | 189 | .releasepage = v9fs_release_page, |
161 | .invalidatepage = v9fs_invalidate_page, | 190 | .invalidatepage = v9fs_invalidate_page, |
162 | .launder_page = v9fs_launder_page, | 191 | .launder_page = v9fs_launder_page, |
192 | .direct_IO = v9fs_direct_IO, | ||
163 | }; | 193 | }; |