-/**
- * gfs2_direct_IO
- *
- * This is called with a shared lock already held for the read path.
- * Currently, no locks are held when the write path is called.
- */
-static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
- const struct iovec *iov, loff_t offset,
- unsigned long nr_segs)
-{
- struct file *file = iocb->ki_filp;
- struct inode *inode = file->f_mapping->host;
- struct gfs2_inode *ip = GFS2_I(inode);
- struct gfs2_sbd *sdp = GFS2_SB(inode);
- int ret;
-
- if (rw == WRITE)
- return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);
-
- if (gfs2_assert_warn(sdp, gfs2_glock_is_locked_by_me(ip->i_gl)) ||
- gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
- return -EINVAL;
-
- mutex_lock(&inode->i_mutex);
- ret = __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
- offset, nr_segs, gfs2_get_block, NULL,
- DIO_OWN_LOCKING);
- mutex_unlock(&inode->i_mutex);
- return ret;
-}
-