Commit 3e24ad2ff9d477f949acd0982cf12e58812210cb

Authored by jvrao
Committed by Eric Van Hensbergen
1 parent 4f7ebe8072

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>

Showing 1 changed file with 30 additions and 0 deletions Side-by-side Diff

... ... @@ -154,11 +154,41 @@
154 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 186 const struct address_space_operations v9fs_addr_operations = {
158 187 .readpage = v9fs_vfs_readpage,
159 188 .readpages = v9fs_vfs_readpages,
160 189 .releasepage = v9fs_release_page,
161 190 .invalidatepage = v9fs_invalidate_page,
162 191 .launder_page = v9fs_launder_page,
  192 + .direct_IO = v9fs_direct_IO,
163 193 };