Пример #1
0
STATIC_INLINE ssize_t
__xfs_file_write(
	struct kiocb		*iocb,
	const struct iovec	*iov,
	unsigned long		nr_segs,
	int			ioflags,
	loff_t			pos)
{
	struct file	*file = iocb->ki_filp;

	BUG_ON(iocb->ki_pos != pos);
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;
	return xfs_write(XFS_I(file->f_mapping->host), iocb, iov, nr_segs,
				&iocb->ki_pos, ioflags);
}
Пример #2
0
STATIC_INLINE ssize_t
__xfs_file_write(
	struct kiocb		*iocb,
	const char		__user *buf,
	int			ioflags,
	size_t			count,
	loff_t			pos)
{
	struct iovec	iov = {(void __user *)buf, count};
	struct file	*file = iocb->ki_filp;

	BUG_ON(iocb->ki_pos != pos);
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;
	return xfs_write(XFS_I(file->f_mapping->host), iocb, &iov, 1,
				&iocb->ki_pos, ioflags);
}
Пример #3
0
STATIC ssize_t
xfs_file_aio_write(
	struct kiocb		*iocb,
	const struct iovec	*iov,
	unsigned long		nr_segs,
	loff_t			pos)
{
	struct file		*file = iocb->ki_filp;
	int			ioflags = IO_ISAIO;

	BUG_ON(iocb->ki_pos != pos);
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;
	if (file->f_mode & FMODE_NOCMTIME)
		ioflags |= IO_INVIS;
	return xfs_write(XFS_I(file->f_mapping->host), iocb, iov, nr_segs,
				&iocb->ki_pos, ioflags);
}
Пример #4
0
STATIC_INLINE ssize_t
__xfs_file_writev(
	struct file		*file,
	const struct iovec	*iov,
	int			ioflags,
	unsigned long		nr_segs,
	loff_t			*ppos)
{
	struct kiocb	kiocb;
	ssize_t		rval;

	init_sync_kiocb(&kiocb, file);
	kiocb.ki_pos = *ppos;
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;

	rval = xfs_write(XFS_I(file->f_mapping->host), &kiocb, iov, nr_segs,
			 &kiocb.ki_pos, ioflags);

	*ppos = kiocb.ki_pos;
	return rval;
}
Пример #5
0
static int
_xfs_write(struct vop_write_args /* {
		struct vnode *a_vp;
		struct uio *a_uio;
		int  a_ioflag;
		struct ucred *a_cred;
	} */ *ap)
{
	struct vnode *vp = ap->a_vp;
	struct uio *uio = ap->a_uio;
	int ioflag = ap->a_ioflag;
	int error;

	xfs_vnode_t *xvp = (xfs_vnode_t *)vp->v_data;

	error = xfs_write(xvp->v_bh.bh_first, uio, ioflag, ap->a_cred);

	if (error < 0) {
		printf("Xfs_write got error %d\n",error);
		return -error;
	}
	return 0;
}