You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (59 commits) [XFS] eagerly remove vmap mappings to avoid upsetting Xen [XFS] simplify validata_fields [XFS] no longer using io_vnode, as was remaining from 23 cherrypick [XFS] Remove STATIC which was missing from prior manual merge [XFS] Put back the QUEUE_ORDERED_NONE test in the barrier check. [XFS] Turn off XBF_ASYNC flag before re-reading superblock. [XFS] avoid race in sync_inodes() that can fail to write out all dirty data [XFS] This fix prevents bulkstat from spinning in an infinite loop. [XFS] simplify xfs_create/mknod/symlink prototype [XFS] avoid xfs_getattr in XFS_IOC_FSGETXATTR ioctl [XFS] get_bulkall() could return incorrect inode state [XFS] Kill unused IOMAP_EOF flag [XFS] fix when DMAPI mount option processing happens [XFS] ensure file size is logged on synchronous writes [XFS] growlock should be a mutex [XFS] replace some large xfs_log_priv.h macros by proper functions [XFS] kill struct bhv_vfs [XFS] move syncing related members from struct bhv_vfs to struct xfs_mount [XFS] kill the vfs_flags member in struct bhv_vfs [XFS] kill the vfs_fsid and vfs_altfsid members in struct bhv_vfs ...
This commit is contained in:
@@ -49,7 +49,6 @@ xfs-y += xfs_alloc.o \
|
||||
xfs_alloc_btree.o \
|
||||
xfs_attr.o \
|
||||
xfs_attr_leaf.o \
|
||||
xfs_behavior.o \
|
||||
xfs_bit.o \
|
||||
xfs_bmap.o \
|
||||
xfs_bmap_btree.o \
|
||||
@@ -108,13 +107,11 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
|
||||
xfs_iops.o \
|
||||
xfs_lrw.o \
|
||||
xfs_super.o \
|
||||
xfs_vfs.o \
|
||||
xfs_vnode.o)
|
||||
|
||||
# Objects in support/
|
||||
xfs-y += $(addprefix support/, \
|
||||
debug.o \
|
||||
move.o \
|
||||
uuid.o)
|
||||
|
||||
xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
|
||||
|
||||
+27
-30
@@ -37,6 +37,7 @@
|
||||
#include "xfs_error.h"
|
||||
#include "xfs_rw.h"
|
||||
#include "xfs_iomap.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
#include <linux/mpage.h>
|
||||
#include <linux/pagevec.h>
|
||||
#include <linux/writeback.h>
|
||||
@@ -139,9 +140,11 @@ xfs_destroy_ioend(
|
||||
next = bh->b_private;
|
||||
bh->b_end_io(bh, !ioend->io_error);
|
||||
}
|
||||
if (unlikely(ioend->io_error))
|
||||
vn_ioerror(ioend->io_vnode, ioend->io_error, __FILE__,__LINE__);
|
||||
vn_iowake(ioend->io_vnode);
|
||||
if (unlikely(ioend->io_error)) {
|
||||
vn_ioerror(XFS_I(ioend->io_inode), ioend->io_error,
|
||||
__FILE__,__LINE__);
|
||||
}
|
||||
vn_iowake(XFS_I(ioend->io_inode));
|
||||
mempool_free(ioend, xfs_ioend_pool);
|
||||
}
|
||||
|
||||
@@ -156,14 +159,10 @@ STATIC void
|
||||
xfs_setfilesize(
|
||||
xfs_ioend_t *ioend)
|
||||
{
|
||||
xfs_inode_t *ip;
|
||||
xfs_inode_t *ip = XFS_I(ioend->io_inode);
|
||||
xfs_fsize_t isize;
|
||||
xfs_fsize_t bsize;
|
||||
|
||||
ip = xfs_vtoi(ioend->io_vnode);
|
||||
if (!ip)
|
||||
return;
|
||||
|
||||
ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
|
||||
ASSERT(ioend->io_type != IOMAP_READ);
|
||||
|
||||
@@ -181,7 +180,7 @@ xfs_setfilesize(
|
||||
ip->i_d.di_size = isize;
|
||||
ip->i_update_core = 1;
|
||||
ip->i_update_size = 1;
|
||||
mark_inode_dirty_sync(vn_to_inode(ioend->io_vnode));
|
||||
mark_inode_dirty_sync(ioend->io_inode);
|
||||
}
|
||||
|
||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
||||
@@ -227,12 +226,12 @@ xfs_end_bio_unwritten(
|
||||
{
|
||||
xfs_ioend_t *ioend =
|
||||
container_of(work, xfs_ioend_t, io_work);
|
||||
bhv_vnode_t *vp = ioend->io_vnode;
|
||||
xfs_off_t offset = ioend->io_offset;
|
||||
size_t size = ioend->io_size;
|
||||
|
||||
if (likely(!ioend->io_error)) {
|
||||
bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL);
|
||||
xfs_bmap(XFS_I(ioend->io_inode), offset, size,
|
||||
BMAPI_UNWRITTEN, NULL, NULL);
|
||||
xfs_setfilesize(ioend);
|
||||
}
|
||||
xfs_destroy_ioend(ioend);
|
||||
@@ -275,10 +274,10 @@ xfs_alloc_ioend(
|
||||
ioend->io_error = 0;
|
||||
ioend->io_list = NULL;
|
||||
ioend->io_type = type;
|
||||
ioend->io_vnode = vn_from_inode(inode);
|
||||
ioend->io_inode = inode;
|
||||
ioend->io_buffer_head = NULL;
|
||||
ioend->io_buffer_tail = NULL;
|
||||
atomic_inc(&ioend->io_vnode->v_iocount);
|
||||
atomic_inc(&XFS_I(ioend->io_inode)->i_iocount);
|
||||
ioend->io_offset = 0;
|
||||
ioend->io_size = 0;
|
||||
|
||||
@@ -302,12 +301,13 @@ xfs_map_blocks(
|
||||
xfs_iomap_t *mapp,
|
||||
int flags)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_inode_t *ip = XFS_I(inode);
|
||||
int error, nmaps = 1;
|
||||
|
||||
error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps);
|
||||
error = xfs_bmap(ip, offset, count,
|
||||
flags, mapp, &nmaps);
|
||||
if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
|
||||
VMODIFY(vp);
|
||||
xfs_iflags_set(ip, XFS_IMODIFIED);
|
||||
return -error;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ xfs_cancel_ioend(
|
||||
unlock_buffer(bh);
|
||||
} while ((bh = next_bh) != NULL);
|
||||
|
||||
vn_iowake(ioend->io_vnode);
|
||||
vn_iowake(XFS_I(ioend->io_inode));
|
||||
mempool_free(ioend, xfs_ioend_pool);
|
||||
} while ((ioend = next) != NULL);
|
||||
}
|
||||
@@ -1237,10 +1237,7 @@ xfs_vm_writepages(
|
||||
struct address_space *mapping,
|
||||
struct writeback_control *wbc)
|
||||
{
|
||||
struct bhv_vnode *vp = vn_from_inode(mapping->host);
|
||||
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED);
|
||||
return generic_writepages(mapping, wbc);
|
||||
}
|
||||
|
||||
@@ -1317,7 +1314,6 @@ __xfs_get_blocks(
|
||||
int direct,
|
||||
bmapi_flags_t flags)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_iomap_t iomap;
|
||||
xfs_off_t offset;
|
||||
ssize_t size;
|
||||
@@ -1327,7 +1323,7 @@ __xfs_get_blocks(
|
||||
offset = (xfs_off_t)iblock << inode->i_blkbits;
|
||||
ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
|
||||
size = bh_result->b_size;
|
||||
error = bhv_vop_bmap(vp, offset, size,
|
||||
error = xfs_bmap(XFS_I(inode), offset, size,
|
||||
create ? flags : BMAPI_READ, &iomap, &niomap);
|
||||
if (error)
|
||||
return -error;
|
||||
@@ -1475,13 +1471,13 @@ xfs_vm_direct_IO(
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_iomap_t iomap;
|
||||
int maps = 1;
|
||||
int error;
|
||||
ssize_t ret;
|
||||
|
||||
error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps);
|
||||
error = xfs_bmap(XFS_I(inode), offset, 0,
|
||||
BMAPI_DEVICE, &iomap, &maps);
|
||||
if (error)
|
||||
return -error;
|
||||
|
||||
@@ -1527,12 +1523,13 @@ xfs_vm_bmap(
|
||||
sector_t block)
|
||||
{
|
||||
struct inode *inode = (struct inode *)mapping->host;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
struct xfs_inode *ip = XFS_I(inode);
|
||||
|
||||
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
|
||||
bhv_vop_rwlock(vp, VRWLOCK_READ);
|
||||
bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF);
|
||||
bhv_vop_rwunlock(vp, VRWLOCK_READ);
|
||||
vn_trace_entry(XFS_I(inode), __FUNCTION__,
|
||||
(inst_t *)__return_address);
|
||||
xfs_rwlock(ip, VRWLOCK_READ);
|
||||
xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF);
|
||||
xfs_rwunlock(ip, VRWLOCK_READ);
|
||||
return generic_block_bmap(mapping, block, xfs_get_blocks);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct xfs_ioend {
|
||||
unsigned int io_type; /* delalloc / unwritten */
|
||||
int io_error; /* I/O error code */
|
||||
atomic_t io_remaining; /* hold count */
|
||||
struct bhv_vnode *io_vnode; /* file being written to */
|
||||
struct inode *io_inode; /* file being written to */
|
||||
struct buffer_head *io_buffer_head;/* buffer linked list head */
|
||||
struct buffer_head *io_buffer_tail;/* buffer linked list tail */
|
||||
size_t io_size; /* size of the extent */
|
||||
|
||||
@@ -187,6 +187,19 @@ free_address(
|
||||
{
|
||||
a_list_t *aentry;
|
||||
|
||||
#ifdef CONFIG_XEN
|
||||
/*
|
||||
* Xen needs to be able to make sure it can get an exclusive
|
||||
* RO mapping of pages it wants to turn into a pagetable. If
|
||||
* a newly allocated page is also still being vmap()ed by xfs,
|
||||
* it will cause pagetable construction to fail. This is a
|
||||
* quick workaround to always eagerly unmap pages so that Xen
|
||||
* is happy.
|
||||
*/
|
||||
vunmap(addr);
|
||||
return;
|
||||
#endif
|
||||
|
||||
aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
|
||||
if (likely(aentry)) {
|
||||
spin_lock(&as_lock);
|
||||
@@ -997,7 +1010,18 @@ xfs_buf_iodone_work(
|
||||
xfs_buf_t *bp =
|
||||
container_of(work, xfs_buf_t, b_iodone_work);
|
||||
|
||||
if (bp->b_iodone)
|
||||
/*
|
||||
* We can get an EOPNOTSUPP to ordered writes. Here we clear the
|
||||
* ordered flag and reissue them. Because we can't tell the higher
|
||||
* layers directly that they should not issue ordered I/O anymore, they
|
||||
* need to check if the ordered flag was cleared during I/O completion.
|
||||
*/
|
||||
if ((bp->b_error == EOPNOTSUPP) &&
|
||||
(bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
|
||||
XB_TRACE(bp, "ordered_retry", bp->b_iodone);
|
||||
bp->b_flags &= ~XBF_ORDERED;
|
||||
xfs_buf_iorequest(bp);
|
||||
} else if (bp->b_iodone)
|
||||
(*(bp->b_iodone))(bp);
|
||||
else if (bp->b_flags & XBF_ASYNC)
|
||||
xfs_buf_relse(bp);
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_types.h"
|
||||
#include "xfs_dmapi.h"
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_log.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dmapi.h"
|
||||
#include "xfs_mount.h"
|
||||
#include "xfs_export.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_inode.h"
|
||||
#include "xfs_vfsops.h"
|
||||
|
||||
static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, };
|
||||
|
||||
@@ -96,9 +102,7 @@ xfs_fs_encode_fh(
|
||||
int len;
|
||||
int is64 = 0;
|
||||
#if XFS_BIG_INUMS
|
||||
bhv_vfs_t *vfs = vfs_from_sb(inode->i_sb);
|
||||
|
||||
if (!(vfs->vfs_flag & VFS_32BITINODES)) {
|
||||
if (!(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_SMALL_INUMS)) {
|
||||
/* filesystem may contain 64bit inode numbers */
|
||||
is64 = XFS_FILEID_TYPE_64FLAG;
|
||||
}
|
||||
@@ -138,10 +142,9 @@ xfs_fs_get_dentry(
|
||||
bhv_vnode_t *vp;
|
||||
struct inode *inode;
|
||||
struct dentry *result;
|
||||
bhv_vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
error = bhv_vfs_vget(vfsp, &vp, (fid_t *)data);
|
||||
error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data);
|
||||
if (error || vp == NULL)
|
||||
return ERR_PTR(-ESTALE) ;
|
||||
|
||||
@@ -159,12 +162,11 @@ xfs_fs_get_parent(
|
||||
struct dentry *child)
|
||||
{
|
||||
int error;
|
||||
bhv_vnode_t *vp, *cvp;
|
||||
bhv_vnode_t *cvp;
|
||||
struct dentry *parent;
|
||||
|
||||
cvp = NULL;
|
||||
vp = vn_from_inode(child->d_inode);
|
||||
error = bhv_vop_lookup(vp, &dotdot, &cvp, 0, NULL, NULL);
|
||||
error = xfs_lookup(XFS_I(child->d_inode), &dotdot, &cvp);
|
||||
if (unlikely(error))
|
||||
return ERR_PTR(-error);
|
||||
|
||||
|
||||
+57
-115
@@ -37,6 +37,7 @@
|
||||
#include "xfs_error.h"
|
||||
#include "xfs_rw.h"
|
||||
#include "xfs_ioctl32.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/smp_lock.h>
|
||||
@@ -55,13 +56,12 @@ __xfs_file_read(
|
||||
loff_t pos)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
bhv_vnode_t *vp = vn_from_inode(file->f_path.dentry->d_inode);
|
||||
|
||||
BUG_ON(iocb->ki_pos != pos);
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
return bhv_vop_read(vp, iocb, iov, nr_segs, &iocb->ki_pos,
|
||||
ioflags, NULL);
|
||||
return xfs_read(XFS_I(file->f_path.dentry->d_inode), iocb, iov,
|
||||
nr_segs, &iocb->ki_pos, ioflags);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -93,14 +93,12 @@ __xfs_file_write(
|
||||
loff_t pos)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
BUG_ON(iocb->ki_pos != pos);
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
return bhv_vop_write(vp, iocb, iov, nr_segs, &iocb->ki_pos,
|
||||
ioflags, NULL);
|
||||
return xfs_write(XFS_I(file->f_mapping->host), iocb, iov, nr_segs,
|
||||
&iocb->ki_pos, ioflags);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -131,8 +129,8 @@ xfs_file_splice_read(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, 0, NULL);
|
||||
return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, 0);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -143,9 +141,8 @@ xfs_file_splice_read_invis(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, IO_INVIS,
|
||||
NULL);
|
||||
return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, IO_INVIS);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -156,8 +153,8 @@ xfs_file_splice_write(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, 0, NULL);
|
||||
return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, 0);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -168,9 +165,8 @@ xfs_file_splice_write_invis(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, IO_INVIS,
|
||||
NULL);
|
||||
return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, IO_INVIS);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -180,7 +176,7 @@ xfs_file_open(
|
||||
{
|
||||
if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
|
||||
return -EFBIG;
|
||||
return -bhv_vop_open(vn_from_inode(inode), NULL);
|
||||
return -xfs_open(XFS_I(inode));
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -188,11 +184,7 @@ xfs_file_release(
|
||||
struct inode *inode,
|
||||
struct file *filp)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
if (vp)
|
||||
return -bhv_vop_release(vp);
|
||||
return 0;
|
||||
return -xfs_release(XFS_I(inode));
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -201,14 +193,13 @@ xfs_file_fsync(
|
||||
struct dentry *dentry,
|
||||
int datasync)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
int flags = FSYNC_WAIT;
|
||||
|
||||
if (datasync)
|
||||
flags |= FSYNC_DATA;
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1);
|
||||
xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED);
|
||||
return -xfs_fsync(XFS_I(dentry->d_inode), flags,
|
||||
(xfs_off_t)0, (xfs_off_t)-1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XFS_DMAPI
|
||||
@@ -233,74 +224,30 @@ xfs_file_readdir(
|
||||
void *dirent,
|
||||
filldir_t filldir)
|
||||
{
|
||||
int error = 0;
|
||||
bhv_vnode_t *vp = vn_from_inode(filp->f_path.dentry->d_inode);
|
||||
uio_t uio;
|
||||
iovec_t iov;
|
||||
int eof = 0;
|
||||
caddr_t read_buf;
|
||||
int namelen, size = 0;
|
||||
size_t rlen = PAGE_CACHE_SIZE;
|
||||
xfs_off_t start_offset, curr_offset;
|
||||
xfs_dirent_t *dbp = NULL;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
xfs_inode_t *ip = XFS_I(inode);
|
||||
int error;
|
||||
size_t bufsize;
|
||||
|
||||
/* Try fairly hard to get memory */
|
||||
do {
|
||||
if ((read_buf = kmalloc(rlen, GFP_KERNEL)))
|
||||
break;
|
||||
rlen >>= 1;
|
||||
} while (rlen >= 1024);
|
||||
/*
|
||||
* The Linux API doesn't pass down the total size of the buffer
|
||||
* we read into down to the filesystem. With the filldir concept
|
||||
* it's not needed for correct information, but the XFS dir2 leaf
|
||||
* code wants an estimate of the buffer size to calculate it's
|
||||
* readahead window and size the buffers used for mapping to
|
||||
* physical blocks.
|
||||
*
|
||||
* Try to give it an estimate that's good enough, maybe at some
|
||||
* point we can change the ->readdir prototype to include the
|
||||
* buffer size.
|
||||
*/
|
||||
bufsize = (size_t)min_t(loff_t, PAGE_SIZE, inode->i_size);
|
||||
|
||||
if (read_buf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_segflg = UIO_SYSSPACE;
|
||||
curr_offset = filp->f_pos;
|
||||
if (filp->f_pos != 0x7fffffff)
|
||||
uio.uio_offset = filp->f_pos;
|
||||
else
|
||||
uio.uio_offset = 0xffffffff;
|
||||
|
||||
while (!eof) {
|
||||
uio.uio_resid = iov.iov_len = rlen;
|
||||
iov.iov_base = read_buf;
|
||||
uio.uio_iovcnt = 1;
|
||||
|
||||
start_offset = uio.uio_offset;
|
||||
|
||||
error = bhv_vop_readdir(vp, &uio, NULL, &eof);
|
||||
if ((uio.uio_offset == start_offset) || error) {
|
||||
size = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
size = rlen - uio.uio_resid;
|
||||
dbp = (xfs_dirent_t *)read_buf;
|
||||
while (size > 0) {
|
||||
namelen = strlen(dbp->d_name);
|
||||
|
||||
if (filldir(dirent, dbp->d_name, namelen,
|
||||
(loff_t) curr_offset & 0x7fffffff,
|
||||
(ino_t) dbp->d_ino,
|
||||
DT_UNKNOWN)) {
|
||||
goto done;
|
||||
}
|
||||
size -= dbp->d_reclen;
|
||||
curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
|
||||
dbp = (xfs_dirent_t *)((char *)dbp + dbp->d_reclen);
|
||||
}
|
||||
}
|
||||
done:
|
||||
if (!error) {
|
||||
if (size == 0)
|
||||
filp->f_pos = uio.uio_offset & 0x7fffffff;
|
||||
else if (dbp)
|
||||
filp->f_pos = curr_offset;
|
||||
}
|
||||
|
||||
kfree(read_buf);
|
||||
return -error;
|
||||
error = xfs_readdir(ip, dirent, bufsize,
|
||||
(xfs_off_t *)&filp->f_pos, filldir);
|
||||
if (error)
|
||||
return -error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -312,7 +259,7 @@ xfs_file_mmap(
|
||||
vma->vm_flags |= VM_CAN_NONLINEAR;
|
||||
|
||||
#ifdef CONFIG_XFS_DMAPI
|
||||
if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
|
||||
if (XFS_M(filp->f_path.dentry->d_inode->i_sb)->m_flags & XFS_MOUNT_DMAPI)
|
||||
vma->vm_ops = &xfs_dmapi_file_vm_ops;
|
||||
#endif /* CONFIG_XFS_DMAPI */
|
||||
|
||||
@@ -328,10 +275,9 @@ xfs_file_ioctl(
|
||||
{
|
||||
int error;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
|
||||
VMODIFY(vp);
|
||||
error = xfs_ioctl(XFS_I(inode), filp, 0, cmd, (void __user *)p);
|
||||
xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
|
||||
|
||||
/* NOTE: some of the ioctl's return positive #'s as a
|
||||
* byte count indicating success, such as
|
||||
@@ -350,10 +296,9 @@ xfs_file_ioctl_invis(
|
||||
{
|
||||
int error;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
|
||||
VMODIFY(vp);
|
||||
error = xfs_ioctl(XFS_I(inode), filp, IO_INVIS, cmd, (void __user *)p);
|
||||
xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
|
||||
|
||||
/* NOTE: some of the ioctl's return positive #'s as a
|
||||
* byte count indicating success, such as
|
||||
@@ -371,16 +316,14 @@ xfs_vm_mprotect(
|
||||
struct vm_area_struct *vma,
|
||||
unsigned int newflags)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_path.dentry->d_inode);
|
||||
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
|
||||
struct xfs_mount *mp = XFS_M(inode->i_sb);
|
||||
int error = 0;
|
||||
|
||||
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
|
||||
if (mp->m_flags & XFS_MOUNT_DMAPI) {
|
||||
if ((vma->vm_flags & VM_MAYSHARE) &&
|
||||
(newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) {
|
||||
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
|
||||
|
||||
(newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE))
|
||||
error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@@ -397,18 +340,17 @@ STATIC int
|
||||
xfs_file_open_exec(
|
||||
struct inode *inode)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
struct xfs_mount *mp = XFS_M(inode->i_sb);
|
||||
|
||||
if (unlikely(vp->v_vfsp->vfs_flag & VFS_DMI)) {
|
||||
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
|
||||
xfs_inode_t *ip = xfs_vtoi(vp);
|
||||
if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI)) {
|
||||
if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) {
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
if (!ip)
|
||||
return -EINVAL;
|
||||
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ))
|
||||
return -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
|
||||
0, 0, 0, NULL);
|
||||
return -XFS_SEND_DATA(mp, DM_EVENT_READ,
|
||||
vp, 0, 0, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_FOP_OPEN_EXEC */
|
||||
|
||||
@@ -16,66 +16,78 @@
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
/*
|
||||
* The following six includes are needed so that we can include
|
||||
* xfs_inode.h. What a mess..
|
||||
*/
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
|
||||
#include "xfs_inode.h"
|
||||
|
||||
int fs_noerr(void) { return 0; }
|
||||
int fs_nosys(void) { return ENOSYS; }
|
||||
void fs_noval(void) { return; }
|
||||
|
||||
void
|
||||
fs_tosspages(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_tosspages(
|
||||
xfs_inode_t *ip,
|
||||
xfs_off_t first,
|
||||
xfs_off_t last,
|
||||
int fiopt)
|
||||
{
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
struct inode *inode = vn_to_inode(vp);
|
||||
|
||||
if (VN_CACHED(vp))
|
||||
truncate_inode_pages(ip->i_mapping, first);
|
||||
truncate_inode_pages(inode->i_mapping, first);
|
||||
}
|
||||
|
||||
int
|
||||
fs_flushinval_pages(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_flushinval_pages(
|
||||
xfs_inode_t *ip,
|
||||
xfs_off_t first,
|
||||
xfs_off_t last,
|
||||
int fiopt)
|
||||
{
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
struct inode *inode = vn_to_inode(vp);
|
||||
int ret = 0;
|
||||
|
||||
if (VN_CACHED(vp)) {
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
ret = filemap_write_and_wait(ip->i_mapping);
|
||||
xfs_iflags_clear(ip, XFS_ITRUNCATED);
|
||||
ret = filemap_write_and_wait(inode->i_mapping);
|
||||
if (!ret)
|
||||
truncate_inode_pages(ip->i_mapping, first);
|
||||
truncate_inode_pages(inode->i_mapping, first);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fs_flush_pages(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_flush_pages(
|
||||
xfs_inode_t *ip,
|
||||
xfs_off_t first,
|
||||
xfs_off_t last,
|
||||
uint64_t flags,
|
||||
int fiopt)
|
||||
{
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
struct inode *inode = vn_to_inode(vp);
|
||||
int ret = 0;
|
||||
int ret2;
|
||||
|
||||
if (VN_DIRTY(vp)) {
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
ret = filemap_fdatawrite(ip->i_mapping);
|
||||
xfs_iflags_clear(ip, XFS_ITRUNCATED);
|
||||
ret = filemap_fdatawrite(inode->i_mapping);
|
||||
if (flags & XFS_B_ASYNC)
|
||||
return ret;
|
||||
ret2 = filemap_fdatawait(ip->i_mapping);
|
||||
ret2 = filemap_fdatawait(inode->i_mapping);
|
||||
if (!ret)
|
||||
ret = ret2;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,8 @@
|
||||
#ifndef __XFS_FS_SUBR_H__
|
||||
#define __XFS_FS_SUBR_H__
|
||||
|
||||
struct cred;
|
||||
extern int fs_noerr(void);
|
||||
extern int fs_nosys(void);
|
||||
extern void fs_noval(void);
|
||||
extern void fs_tosspages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
|
||||
extern int fs_flushinval_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
|
||||
extern int fs_flush_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
|
||||
|
||||
#endif /* __XFS_FS_SUBR_H__ */
|
||||
|
||||
@@ -19,11 +19,6 @@
|
||||
#include "xfs_cred.h"
|
||||
#include "xfs_sysctl.h"
|
||||
|
||||
/*
|
||||
* System memory size - used to scale certain data structures in XFS.
|
||||
*/
|
||||
unsigned long xfs_physmem;
|
||||
|
||||
/*
|
||||
* Tunable XFS parameters. xfs_params is required even when CONFIG_SYSCTL=n,
|
||||
* other XFS code uses these values. Times are measured in centisecs (i.e.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define __XFS_GLOBALS_H__
|
||||
|
||||
extern uint64_t xfs_panic_mask; /* set to cause more panics */
|
||||
extern unsigned long xfs_physmem;
|
||||
extern struct cred *sys_cred;
|
||||
|
||||
#endif /* __XFS_GLOBALS_H__ */
|
||||
|
||||
+133
-109
@@ -47,6 +47,7 @@
|
||||
#include "xfs_utils.h"
|
||||
#include "xfs_dfrag.h"
|
||||
#include "xfs_fsops.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/dcache.h>
|
||||
@@ -137,7 +138,8 @@ xfs_find_handle(
|
||||
vp = vn_from_inode(inode);
|
||||
|
||||
/* now we can grab the fsid */
|
||||
memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t));
|
||||
memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid,
|
||||
sizeof(xfs_fsid_t));
|
||||
hsize = sizeof(xfs_fsid_t);
|
||||
|
||||
if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
|
||||
@@ -349,19 +351,44 @@ xfs_open_by_handle(
|
||||
return new_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a copy from fs/namei.c:vfs_readlink(), except for removing it's
|
||||
* unused first argument.
|
||||
*/
|
||||
STATIC int
|
||||
do_readlink(
|
||||
char __user *buffer,
|
||||
int buflen,
|
||||
const char *link)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = PTR_ERR(link);
|
||||
if (IS_ERR(link))
|
||||
goto out;
|
||||
|
||||
len = strlen(link);
|
||||
if (len > (unsigned) buflen)
|
||||
len = buflen;
|
||||
if (copy_to_user(buffer, link, len))
|
||||
len = -EFAULT;
|
||||
out:
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
STATIC int
|
||||
xfs_readlink_by_handle(
|
||||
xfs_mount_t *mp,
|
||||
void __user *arg,
|
||||
struct inode *parinode)
|
||||
{
|
||||
int error;
|
||||
struct iovec aiov;
|
||||
struct uio auio;
|
||||
struct inode *inode;
|
||||
xfs_fsop_handlereq_t hreq;
|
||||
bhv_vnode_t *vp;
|
||||
__u32 olen;
|
||||
void *link;
|
||||
int error;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -XFS_ERROR(EPERM);
|
||||
@@ -374,29 +401,31 @@ xfs_readlink_by_handle(
|
||||
|
||||
/* Restrict this handle operation to symlinks only. */
|
||||
if (!S_ISLNK(inode->i_mode)) {
|
||||
VN_RELE(vp);
|
||||
return -XFS_ERROR(EINVAL);
|
||||
error = -XFS_ERROR(EINVAL);
|
||||
goto out_iput;
|
||||
}
|
||||
|
||||
if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) {
|
||||
VN_RELE(vp);
|
||||
return -XFS_ERROR(EFAULT);
|
||||
error = -XFS_ERROR(EFAULT);
|
||||
goto out_iput;
|
||||
}
|
||||
aiov.iov_len = olen;
|
||||
aiov.iov_base = hreq.ohandle;
|
||||
|
||||
auio.uio_iov = (struct kvec *)&aiov;
|
||||
auio.uio_iovcnt = 1;
|
||||
auio.uio_offset = 0;
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_resid = olen;
|
||||
link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
|
||||
if (!link)
|
||||
goto out_iput;
|
||||
|
||||
error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL);
|
||||
VN_RELE(vp);
|
||||
error = -xfs_readlink(XFS_I(inode), link);
|
||||
if (error)
|
||||
return -error;
|
||||
goto out_kfree;
|
||||
error = do_readlink(hreq.ohandle, olen, link);
|
||||
if (error)
|
||||
goto out_kfree;
|
||||
|
||||
return (olen - auio.uio_resid);
|
||||
out_kfree:
|
||||
kfree(link);
|
||||
out_iput:
|
||||
iput(inode);
|
||||
return error;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -409,7 +438,6 @@ xfs_fssetdm_by_handle(
|
||||
struct fsdmidata fsd;
|
||||
xfs_fsop_setdm_handlereq_t dmhreq;
|
||||
struct inode *inode;
|
||||
bhv_desc_t *bdp;
|
||||
bhv_vnode_t *vp;
|
||||
|
||||
if (!capable(CAP_MKNOD))
|
||||
@@ -431,8 +459,8 @@ xfs_fssetdm_by_handle(
|
||||
return -XFS_ERROR(EFAULT);
|
||||
}
|
||||
|
||||
bdp = bhv_base_unlocked(VN_BHV_HEAD(vp));
|
||||
error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL);
|
||||
error = xfs_set_dmattrs(xfs_vtoi(vp),
|
||||
fsd.fsd_dmevmask, fsd.fsd_dmstate);
|
||||
|
||||
VN_RELE(vp);
|
||||
if (error)
|
||||
@@ -470,8 +498,8 @@ xfs_attrlist_by_handle(
|
||||
goto out_vn_rele;
|
||||
|
||||
cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
|
||||
error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags,
|
||||
cursor, NULL);
|
||||
error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen,
|
||||
al_hreq.flags, cursor);
|
||||
if (error)
|
||||
goto out_kfree;
|
||||
|
||||
@@ -488,7 +516,7 @@ xfs_attrlist_by_handle(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_get(
|
||||
bhv_vnode_t *vp,
|
||||
struct inode *inode,
|
||||
char *name,
|
||||
char __user *ubuf,
|
||||
__uint32_t *len,
|
||||
@@ -503,7 +531,7 @@ xfs_attrmulti_attr_get(
|
||||
if (!kbuf)
|
||||
return ENOMEM;
|
||||
|
||||
error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL);
|
||||
error = xfs_attr_get(XFS_I(inode), name, kbuf, len, flags, NULL);
|
||||
if (error)
|
||||
goto out_kfree;
|
||||
|
||||
@@ -517,7 +545,7 @@ xfs_attrmulti_attr_get(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_set(
|
||||
bhv_vnode_t *vp,
|
||||
struct inode *inode,
|
||||
char *name,
|
||||
const char __user *ubuf,
|
||||
__uint32_t len,
|
||||
@@ -526,9 +554,9 @@ xfs_attrmulti_attr_set(
|
||||
char *kbuf;
|
||||
int error = EFAULT;
|
||||
|
||||
if (IS_RDONLY(&vp->v_inode))
|
||||
if (IS_RDONLY(inode))
|
||||
return -EROFS;
|
||||
if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
|
||||
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
|
||||
return EPERM;
|
||||
if (len > XATTR_SIZE_MAX)
|
||||
return EINVAL;
|
||||
@@ -540,7 +568,7 @@ xfs_attrmulti_attr_set(
|
||||
if (copy_from_user(kbuf, ubuf, len))
|
||||
goto out_kfree;
|
||||
|
||||
error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL);
|
||||
error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
|
||||
|
||||
out_kfree:
|
||||
kfree(kbuf);
|
||||
@@ -549,15 +577,15 @@ xfs_attrmulti_attr_set(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_remove(
|
||||
bhv_vnode_t *vp,
|
||||
struct inode *inode,
|
||||
char *name,
|
||||
__uint32_t flags)
|
||||
{
|
||||
if (IS_RDONLY(&vp->v_inode))
|
||||
if (IS_RDONLY(inode))
|
||||
return -EROFS;
|
||||
if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
|
||||
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
|
||||
return EPERM;
|
||||
return bhv_vop_attr_remove(vp, name, flags, NULL);
|
||||
return xfs_attr_remove(XFS_I(inode), name, flags);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -613,17 +641,17 @@ xfs_attrmulti_by_handle(
|
||||
|
||||
switch (ops[i].am_opcode) {
|
||||
case ATTR_OP_GET:
|
||||
ops[i].am_error = xfs_attrmulti_attr_get(vp,
|
||||
ops[i].am_error = xfs_attrmulti_attr_get(inode,
|
||||
attr_name, ops[i].am_attrvalue,
|
||||
&ops[i].am_length, ops[i].am_flags);
|
||||
break;
|
||||
case ATTR_OP_SET:
|
||||
ops[i].am_error = xfs_attrmulti_attr_set(vp,
|
||||
ops[i].am_error = xfs_attrmulti_attr_set(inode,
|
||||
attr_name, ops[i].am_attrvalue,
|
||||
ops[i].am_length, ops[i].am_flags);
|
||||
break;
|
||||
case ATTR_OP_REMOVE:
|
||||
ops[i].am_error = xfs_attrmulti_attr_remove(vp,
|
||||
ops[i].am_error = xfs_attrmulti_attr_remove(inode,
|
||||
attr_name, ops[i].am_flags);
|
||||
break;
|
||||
default:
|
||||
@@ -649,7 +677,7 @@ xfs_attrmulti_by_handle(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_space(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
struct inode *inode,
|
||||
struct file *filp,
|
||||
int flags,
|
||||
@@ -680,38 +708,38 @@ xfs_ioc_xattr(
|
||||
unsigned int cmd,
|
||||
void __user *arg);
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_fsgetxattr(
|
||||
xfs_inode_t *ip,
|
||||
int attr,
|
||||
void __user *arg);
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_getbmap(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
int flags,
|
||||
unsigned int cmd,
|
||||
void __user *arg);
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_getbmapx(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
void __user *arg);
|
||||
|
||||
int
|
||||
xfs_ioctl(
|
||||
bhv_desc_t *bdp,
|
||||
struct inode *inode,
|
||||
xfs_inode_t *ip,
|
||||
struct file *filp,
|
||||
int ioflags,
|
||||
unsigned int cmd,
|
||||
void __user *arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_mount_t *mp = ip->i_mount;
|
||||
int error;
|
||||
bhv_vnode_t *vp;
|
||||
xfs_inode_t *ip;
|
||||
xfs_mount_t *mp;
|
||||
|
||||
vp = vn_from_inode(inode);
|
||||
|
||||
vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
|
||||
|
||||
ip = XFS_BHVTOI(bdp);
|
||||
mp = ip->i_mount;
|
||||
vn_trace_entry(XFS_I(inode), "xfs_ioctl", (inst_t *)__return_address);
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
@@ -731,7 +759,7 @@ xfs_ioctl(
|
||||
!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg);
|
||||
return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg);
|
||||
|
||||
case XFS_IOC_DIOINFO: {
|
||||
struct dioattr da;
|
||||
@@ -761,11 +789,13 @@ xfs_ioctl(
|
||||
case XFS_IOC_GETVERSION:
|
||||
return put_user(inode->i_generation, (int __user *)arg);
|
||||
|
||||
case XFS_IOC_FSGETXATTR:
|
||||
return xfs_ioc_fsgetxattr(ip, 0, arg);
|
||||
case XFS_IOC_FSGETXATTRA:
|
||||
return xfs_ioc_fsgetxattr(ip, 1, arg);
|
||||
case XFS_IOC_GETXFLAGS:
|
||||
case XFS_IOC_SETXFLAGS:
|
||||
case XFS_IOC_FSGETXATTR:
|
||||
case XFS_IOC_FSSETXATTR:
|
||||
case XFS_IOC_FSGETXATTRA:
|
||||
return xfs_ioc_xattr(vp, ip, filp, cmd, arg);
|
||||
|
||||
case XFS_IOC_FSSETDM: {
|
||||
@@ -774,17 +804,17 @@ xfs_ioctl(
|
||||
if (copy_from_user(&dmi, arg, sizeof(dmi)))
|
||||
return -XFS_ERROR(EFAULT);
|
||||
|
||||
error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate,
|
||||
NULL);
|
||||
error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask,
|
||||
dmi.fsd_dmstate);
|
||||
return -error;
|
||||
}
|
||||
|
||||
case XFS_IOC_GETBMAP:
|
||||
case XFS_IOC_GETBMAPA:
|
||||
return xfs_ioc_getbmap(bdp, ioflags, cmd, arg);
|
||||
return xfs_ioc_getbmap(ip, ioflags, cmd, arg);
|
||||
|
||||
case XFS_IOC_GETBMAPX:
|
||||
return xfs_ioc_getbmapx(bdp, arg);
|
||||
return xfs_ioc_getbmapx(ip, arg);
|
||||
|
||||
case XFS_IOC_FD_TO_HANDLE:
|
||||
case XFS_IOC_PATH_TO_HANDLE:
|
||||
@@ -944,7 +974,7 @@ xfs_ioctl(
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
error = xfs_errortag_clearall(mp);
|
||||
error = xfs_errortag_clearall(mp, 1);
|
||||
return -error;
|
||||
|
||||
default:
|
||||
@@ -954,7 +984,7 @@ xfs_ioctl(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_space(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
struct inode *inode,
|
||||
struct file *filp,
|
||||
int ioflags,
|
||||
@@ -982,7 +1012,7 @@ xfs_ioc_space(
|
||||
if (ioflags & IO_INVIS)
|
||||
attr_flags |= ATTR_DMI;
|
||||
|
||||
error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos,
|
||||
error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
|
||||
NULL, attr_flags);
|
||||
return -error;
|
||||
}
|
||||
@@ -1139,6 +1169,42 @@ xfs_di2lxflags(
|
||||
return flags;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_fsgetxattr(
|
||||
xfs_inode_t *ip,
|
||||
int attr,
|
||||
void __user *arg)
|
||||
{
|
||||
struct fsxattr fa;
|
||||
|
||||
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
||||
fa.fsx_xflags = xfs_ip2xflags(ip);
|
||||
fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
|
||||
fa.fsx_projid = ip->i_d.di_projid;
|
||||
|
||||
if (attr) {
|
||||
if (ip->i_afp) {
|
||||
if (ip->i_afp->if_flags & XFS_IFEXTENTS)
|
||||
fa.fsx_nextents = ip->i_afp->if_bytes /
|
||||
sizeof(xfs_bmbt_rec_t);
|
||||
else
|
||||
fa.fsx_nextents = ip->i_d.di_anextents;
|
||||
} else
|
||||
fa.fsx_nextents = 0;
|
||||
} else {
|
||||
if (ip->i_df.if_flags & XFS_IFEXTENTS)
|
||||
fa.fsx_nextents = ip->i_df.if_bytes /
|
||||
sizeof(xfs_bmbt_rec_t);
|
||||
else
|
||||
fa.fsx_nextents = ip->i_d.di_nextents;
|
||||
}
|
||||
xfs_iunlock(ip, XFS_ILOCK_SHARED);
|
||||
|
||||
if (copy_to_user(arg, &fa, sizeof(fa)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_xattr(
|
||||
bhv_vnode_t *vp,
|
||||
@@ -1158,27 +1224,6 @@ xfs_ioc_xattr(
|
||||
return -ENOMEM;
|
||||
|
||||
switch (cmd) {
|
||||
case XFS_IOC_FSGETXATTR: {
|
||||
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
|
||||
XFS_AT_NEXTENTS | XFS_AT_PROJID;
|
||||
error = bhv_vop_getattr(vp, vattr, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
error = -error;
|
||||
break;
|
||||
}
|
||||
|
||||
fa.fsx_xflags = vattr->va_xflags;
|
||||
fa.fsx_extsize = vattr->va_extsize;
|
||||
fa.fsx_nextents = vattr->va_nextents;
|
||||
fa.fsx_projid = vattr->va_projid;
|
||||
|
||||
if (copy_to_user(arg, &fa, sizeof(fa))) {
|
||||
error = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case XFS_IOC_FSSETXATTR: {
|
||||
if (copy_from_user(&fa, arg, sizeof(fa))) {
|
||||
error = -EFAULT;
|
||||
@@ -1194,34 +1239,13 @@ xfs_ioc_xattr(
|
||||
vattr->va_extsize = fa.fsx_extsize;
|
||||
vattr->va_projid = fa.fsx_projid;
|
||||
|
||||
error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
|
||||
error = xfs_setattr(ip, vattr, attr_flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, vattr); /* update flags */
|
||||
error = -error;
|
||||
break;
|
||||
}
|
||||
|
||||
case XFS_IOC_FSGETXATTRA: {
|
||||
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
|
||||
XFS_AT_ANEXTENTS | XFS_AT_PROJID;
|
||||
error = bhv_vop_getattr(vp, vattr, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
error = -error;
|
||||
break;
|
||||
}
|
||||
|
||||
fa.fsx_xflags = vattr->va_xflags;
|
||||
fa.fsx_extsize = vattr->va_extsize;
|
||||
fa.fsx_nextents = vattr->va_anextents;
|
||||
fa.fsx_projid = vattr->va_projid;
|
||||
|
||||
if (copy_to_user(arg, &fa, sizeof(fa))) {
|
||||
error = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case XFS_IOC_GETXFLAGS: {
|
||||
flags = xfs_di2lxflags(ip->i_d.di_flags);
|
||||
if (copy_to_user(arg, &flags, sizeof(flags)))
|
||||
@@ -1250,7 +1274,7 @@ xfs_ioc_xattr(
|
||||
vattr->va_xflags = xfs_merge_ioc_xflags(flags,
|
||||
xfs_ip2xflags(ip));
|
||||
|
||||
error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
|
||||
error = xfs_setattr(ip, vattr, attr_flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, vattr); /* update flags */
|
||||
error = -error;
|
||||
@@ -1268,7 +1292,7 @@ xfs_ioc_xattr(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_getbmap(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
int ioflags,
|
||||
unsigned int cmd,
|
||||
void __user *arg)
|
||||
@@ -1287,7 +1311,7 @@ xfs_ioc_getbmap(
|
||||
if (ioflags & IO_INVIS)
|
||||
iflags |= BMV_IF_NO_DMAPI_READ;
|
||||
|
||||
error = xfs_getbmap(bdp, &bm, (struct getbmap __user *)arg+1, iflags);
|
||||
error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags);
|
||||
if (error)
|
||||
return -error;
|
||||
|
||||
@@ -1298,7 +1322,7 @@ xfs_ioc_getbmap(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_getbmapx(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *ip,
|
||||
void __user *arg)
|
||||
{
|
||||
struct getbmapx bmx;
|
||||
@@ -1325,7 +1349,7 @@ xfs_ioc_getbmapx(
|
||||
|
||||
iflags |= BMV_IF_EXTENDED;
|
||||
|
||||
error = xfs_getbmap(bdp, &bm, (struct getbmapx __user *)arg+1, iflags);
|
||||
error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags);
|
||||
if (error)
|
||||
return -error;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "xfs_itable.h"
|
||||
#include "xfs_error.h"
|
||||
#include "xfs_dfrag.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
#define _NATIVE_IOC(cmd, type) \
|
||||
_IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
|
||||
@@ -370,7 +371,6 @@ xfs_compat_ioctl(
|
||||
unsigned long arg)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -443,7 +443,7 @@ xfs_compat_ioctl(
|
||||
case XFS_IOC_FSBULKSTAT_SINGLE_32:
|
||||
case XFS_IOC_FSINUMBERS_32:
|
||||
cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq);
|
||||
return xfs_ioc_bulkstat_compat(XFS_BHVTOI(VNHEAD(vp))->i_mount,
|
||||
return xfs_ioc_bulkstat_compat(XFS_I(inode)->i_mount,
|
||||
cmd, (void __user*)arg);
|
||||
case XFS_IOC_FD_TO_HANDLE_32:
|
||||
case XFS_IOC_PATH_TO_HANDLE_32:
|
||||
@@ -457,8 +457,8 @@ xfs_compat_ioctl(
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
error = bhv_vop_ioctl(vp, inode, file, mode, cmd, (void __user *)arg);
|
||||
VMODIFY(vp);
|
||||
error = xfs_ioctl(XFS_I(inode), file, mode, cmd, (void __user *)arg);
|
||||
xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
+67
-127
@@ -46,28 +46,13 @@
|
||||
#include "xfs_attr.h"
|
||||
#include "xfs_buf_item.h"
|
||||
#include "xfs_utils.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/xattr.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/security.h>
|
||||
|
||||
/*
|
||||
* Get a XFS inode from a given vnode.
|
||||
*/
|
||||
xfs_inode_t *
|
||||
xfs_vtoi(
|
||||
bhv_vnode_t *vp)
|
||||
{
|
||||
bhv_desc_t *bdp;
|
||||
|
||||
bdp = bhv_lookup_range(VN_BHV_HEAD(vp),
|
||||
VNODE_POSITION_XFS, VNODE_POSITION_XFS);
|
||||
if (unlikely(bdp == NULL))
|
||||
return NULL;
|
||||
return XFS_BHVTOI(bdp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bring the atime in the XFS inode uptodate.
|
||||
* Used before logging the inode to disk or when the Linux inode goes away.
|
||||
@@ -80,9 +65,8 @@ xfs_synchronize_atime(
|
||||
|
||||
vp = XFS_ITOV_NULL(ip);
|
||||
if (vp) {
|
||||
struct inode *inode = &vp->v_inode;
|
||||
ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec;
|
||||
ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec;
|
||||
ip->i_d.di_atime.t_sec = (__int32_t)vp->i_atime.tv_sec;
|
||||
ip->i_d.di_atime.t_nsec = (__int32_t)vp->i_atime.tv_nsec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,18 +179,19 @@ xfs_ichgtime_fast(
|
||||
*/
|
||||
STATIC void
|
||||
xfs_validate_fields(
|
||||
struct inode *ip,
|
||||
bhv_vattr_t *vattr)
|
||||
struct inode *inode)
|
||||
{
|
||||
vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
|
||||
if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) {
|
||||
ip->i_nlink = vattr->va_nlink;
|
||||
ip->i_blocks = vattr->va_nblocks;
|
||||
struct xfs_inode *ip = XFS_I(inode);
|
||||
loff_t size;
|
||||
|
||||
/* we're under i_sem so i_size can't change under us */
|
||||
if (i_size_read(ip) != vattr->va_size)
|
||||
i_size_write(ip, vattr->va_size);
|
||||
}
|
||||
inode->i_nlink = ip->i_d.di_nlink;
|
||||
inode->i_blocks =
|
||||
XFS_FSB_TO_BB(ip->i_mount, ip->i_d.di_nblocks +
|
||||
ip->i_delayed_blks);
|
||||
/* we're under i_sem so i_size can't change under us */
|
||||
size = XFS_ISIZE(ip);
|
||||
if (i_size_read(inode) != size)
|
||||
i_size_write(inode, size);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -233,9 +218,10 @@ xfs_init_security(
|
||||
return -error;
|
||||
}
|
||||
|
||||
error = bhv_vop_attr_set(vp, name, value, length, ATTR_SECURE, NULL);
|
||||
error = xfs_attr_set(XFS_I(ip), name, value,
|
||||
length, ATTR_SECURE);
|
||||
if (!error)
|
||||
VMODIFY(vp);
|
||||
xfs_iflags_set(XFS_I(ip), XFS_IMODIFIED);
|
||||
|
||||
kfree(name);
|
||||
kfree(value);
|
||||
@@ -256,7 +242,7 @@ xfs_has_fs_struct(struct task_struct *task)
|
||||
|
||||
STATIC void
|
||||
xfs_cleanup_inode(
|
||||
bhv_vnode_t *dvp,
|
||||
struct inode *dir,
|
||||
bhv_vnode_t *vp,
|
||||
struct dentry *dentry,
|
||||
int mode)
|
||||
@@ -272,9 +258,9 @@ xfs_cleanup_inode(
|
||||
teardown.d_name = dentry->d_name;
|
||||
|
||||
if (S_ISDIR(mode))
|
||||
bhv_vop_rmdir(dvp, &teardown, NULL);
|
||||
xfs_rmdir(XFS_I(dir), &teardown);
|
||||
else
|
||||
bhv_vop_remove(dvp, &teardown, NULL);
|
||||
xfs_remove(XFS_I(dir), &teardown);
|
||||
VN_RELE(vp);
|
||||
}
|
||||
|
||||
@@ -286,7 +272,6 @@ xfs_vn_mknod(
|
||||
dev_t rdev)
|
||||
{
|
||||
struct inode *ip;
|
||||
bhv_vattr_t vattr = { 0 };
|
||||
bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
|
||||
xfs_acl_t *default_acl = NULL;
|
||||
attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
|
||||
@@ -312,19 +297,14 @@ xfs_vn_mknod(
|
||||
if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current))
|
||||
mode &= ~current->fs->umask;
|
||||
|
||||
vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
|
||||
vattr.va_mode = mode;
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
|
||||
vattr.va_rdev = sysv_encode_dev(rdev);
|
||||
vattr.va_mask |= XFS_AT_RDEV;
|
||||
/*FALLTHROUGH*/
|
||||
rdev = sysv_encode_dev(rdev);
|
||||
case S_IFREG:
|
||||
error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL);
|
||||
error = xfs_create(XFS_I(dir), dentry, mode, rdev, &vp, NULL);
|
||||
break;
|
||||
case S_IFDIR:
|
||||
error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL);
|
||||
error = xfs_mkdir(XFS_I(dir), dentry, mode, &vp, NULL);
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
@@ -334,16 +314,16 @@ xfs_vn_mknod(
|
||||
if (unlikely(!error)) {
|
||||
error = xfs_init_security(vp, dir);
|
||||
if (error)
|
||||
xfs_cleanup_inode(dvp, vp, dentry, mode);
|
||||
xfs_cleanup_inode(dir, vp, dentry, mode);
|
||||
}
|
||||
|
||||
if (unlikely(default_acl)) {
|
||||
if (!error) {
|
||||
error = _ACL_INHERIT(vp, &vattr, default_acl);
|
||||
error = _ACL_INHERIT(vp, mode, default_acl);
|
||||
if (!error)
|
||||
VMODIFY(vp);
|
||||
xfs_iflags_set(XFS_I(vp), XFS_IMODIFIED);
|
||||
else
|
||||
xfs_cleanup_inode(dvp, vp, dentry, mode);
|
||||
xfs_cleanup_inode(dir, vp, dentry, mode);
|
||||
}
|
||||
_ACL_FREE(default_acl);
|
||||
}
|
||||
@@ -355,9 +335,9 @@ xfs_vn_mknod(
|
||||
if (S_ISCHR(mode) || S_ISBLK(mode))
|
||||
ip->i_rdev = rdev;
|
||||
else if (S_ISDIR(mode))
|
||||
xfs_validate_fields(ip, &vattr);
|
||||
xfs_validate_fields(ip);
|
||||
d_instantiate(dentry, ip);
|
||||
xfs_validate_fields(dir, &vattr);
|
||||
xfs_validate_fields(dir);
|
||||
}
|
||||
return -error;
|
||||
}
|
||||
@@ -387,13 +367,13 @@ xfs_vn_lookup(
|
||||
struct dentry *dentry,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
bhv_vnode_t *vp = vn_from_inode(dir), *cvp;
|
||||
bhv_vnode_t *cvp;
|
||||
int error;
|
||||
|
||||
if (dentry->d_name.len >= MAXNAMELEN)
|
||||
return ERR_PTR(-ENAMETOOLONG);
|
||||
|
||||
error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL);
|
||||
error = xfs_lookup(XFS_I(dir), dentry, &cvp);
|
||||
if (unlikely(error)) {
|
||||
if (unlikely(error != ENOENT))
|
||||
return ERR_PTR(-error);
|
||||
@@ -411,22 +391,19 @@ xfs_vn_link(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *ip; /* inode of guy being linked to */
|
||||
bhv_vnode_t *tdvp; /* target directory for new name/link */
|
||||
bhv_vnode_t *vp; /* vp of name being linked */
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
ip = old_dentry->d_inode; /* inode being linked to */
|
||||
tdvp = vn_from_inode(dir);
|
||||
vp = vn_from_inode(ip);
|
||||
|
||||
VN_HOLD(vp);
|
||||
error = bhv_vop_link(tdvp, vp, dentry, NULL);
|
||||
error = xfs_link(XFS_I(dir), vp, dentry);
|
||||
if (unlikely(error)) {
|
||||
VN_RELE(vp);
|
||||
} else {
|
||||
VMODIFY(tdvp);
|
||||
xfs_validate_fields(ip, &vattr);
|
||||
xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
|
||||
xfs_validate_fields(ip);
|
||||
d_instantiate(dentry, ip);
|
||||
}
|
||||
return -error;
|
||||
@@ -438,17 +415,14 @@ xfs_vn_unlink(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode;
|
||||
bhv_vnode_t *dvp; /* directory containing name to remove */
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
inode = dentry->d_inode;
|
||||
dvp = vn_from_inode(dir);
|
||||
|
||||
error = bhv_vop_remove(dvp, dentry, NULL);
|
||||
error = xfs_remove(XFS_I(dir), dentry);
|
||||
if (likely(!error)) {
|
||||
xfs_validate_fields(dir, &vattr); /* size needs update */
|
||||
xfs_validate_fields(inode, &vattr);
|
||||
xfs_validate_fields(dir); /* size needs update */
|
||||
xfs_validate_fields(inode);
|
||||
}
|
||||
return -error;
|
||||
}
|
||||
@@ -460,28 +434,26 @@ xfs_vn_symlink(
|
||||
const char *symname)
|
||||
{
|
||||
struct inode *ip;
|
||||
bhv_vattr_t va = { 0 };
|
||||
bhv_vnode_t *dvp; /* directory containing name of symlink */
|
||||
bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */
|
||||
int error;
|
||||
mode_t mode;
|
||||
|
||||
dvp = vn_from_inode(dir);
|
||||
cvp = NULL;
|
||||
|
||||
va.va_mode = S_IFLNK |
|
||||
mode = S_IFLNK |
|
||||
(irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
|
||||
va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
|
||||
|
||||
error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &cvp, NULL);
|
||||
error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode,
|
||||
&cvp, NULL);
|
||||
if (likely(!error && cvp)) {
|
||||
error = xfs_init_security(cvp, dir);
|
||||
if (likely(!error)) {
|
||||
ip = vn_to_inode(cvp);
|
||||
d_instantiate(dentry, ip);
|
||||
xfs_validate_fields(dir, &va);
|
||||
xfs_validate_fields(ip, &va);
|
||||
xfs_validate_fields(dir);
|
||||
xfs_validate_fields(ip);
|
||||
} else {
|
||||
xfs_cleanup_inode(dvp, cvp, dentry, 0);
|
||||
xfs_cleanup_inode(dir, cvp, dentry, 0);
|
||||
}
|
||||
}
|
||||
return -error;
|
||||
@@ -493,14 +465,12 @@ xfs_vn_rmdir(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
bhv_vnode_t *dvp = vn_from_inode(dir);
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
error = bhv_vop_rmdir(dvp, dentry, NULL);
|
||||
error = xfs_rmdir(XFS_I(dir), dentry);
|
||||
if (likely(!error)) {
|
||||
xfs_validate_fields(inode, &vattr);
|
||||
xfs_validate_fields(dir, &vattr);
|
||||
xfs_validate_fields(inode);
|
||||
xfs_validate_fields(dir);
|
||||
}
|
||||
return -error;
|
||||
}
|
||||
@@ -513,21 +483,18 @@ xfs_vn_rename(
|
||||
struct dentry *ndentry)
|
||||
{
|
||||
struct inode *new_inode = ndentry->d_inode;
|
||||
bhv_vnode_t *fvp; /* from directory */
|
||||
bhv_vnode_t *tvp; /* target directory */
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
fvp = vn_from_inode(odir);
|
||||
tvp = vn_from_inode(ndir);
|
||||
|
||||
error = bhv_vop_rename(fvp, odentry, tvp, ndentry, NULL);
|
||||
error = xfs_rename(XFS_I(odir), odentry, tvp, ndentry);
|
||||
if (likely(!error)) {
|
||||
if (new_inode)
|
||||
xfs_validate_fields(new_inode, &vattr);
|
||||
xfs_validate_fields(odir, &vattr);
|
||||
xfs_validate_fields(new_inode);
|
||||
xfs_validate_fields(odir);
|
||||
if (ndir != odir)
|
||||
xfs_validate_fields(ndir, &vattr);
|
||||
xfs_validate_fields(ndir);
|
||||
}
|
||||
return -error;
|
||||
}
|
||||
@@ -542,50 +509,25 @@ xfs_vn_follow_link(
|
||||
struct dentry *dentry,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
bhv_vnode_t *vp;
|
||||
uio_t *uio;
|
||||
iovec_t iov;
|
||||
int error;
|
||||
char *link;
|
||||
|
||||
ASSERT(dentry);
|
||||
ASSERT(nd);
|
||||
int error = -ENOMEM;
|
||||
|
||||
link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
|
||||
if (!link) {
|
||||
nd_set_link(nd, ERR_PTR(-ENOMEM));
|
||||
return NULL;
|
||||
}
|
||||
if (!link)
|
||||
goto out_err;
|
||||
|
||||
uio = kmalloc(sizeof(uio_t), GFP_KERNEL);
|
||||
if (!uio) {
|
||||
kfree(link);
|
||||
nd_set_link(nd, ERR_PTR(-ENOMEM));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vp = vn_from_inode(dentry->d_inode);
|
||||
|
||||
iov.iov_base = link;
|
||||
iov.iov_len = MAXPATHLEN;
|
||||
|
||||
uio->uio_iov = &iov;
|
||||
uio->uio_offset = 0;
|
||||
uio->uio_segflg = UIO_SYSSPACE;
|
||||
uio->uio_resid = MAXPATHLEN;
|
||||
uio->uio_iovcnt = 1;
|
||||
|
||||
error = bhv_vop_readlink(vp, uio, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
kfree(link);
|
||||
link = ERR_PTR(-error);
|
||||
} else {
|
||||
link[MAXPATHLEN - uio->uio_resid] = '\0';
|
||||
}
|
||||
kfree(uio);
|
||||
error = -xfs_readlink(XFS_I(dentry->d_inode), link);
|
||||
if (unlikely(error))
|
||||
goto out_kfree;
|
||||
|
||||
nd_set_link(nd, link);
|
||||
return NULL;
|
||||
|
||||
out_kfree:
|
||||
kfree(link);
|
||||
out_err:
|
||||
nd_set_link(nd, ERR_PTR(error));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STATIC void
|
||||
@@ -607,7 +549,7 @@ xfs_vn_permission(
|
||||
int mode,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL);
|
||||
return -xfs_access(XFS_I(inode), mode << 6, NULL);
|
||||
}
|
||||
#else
|
||||
#define xfs_vn_permission NULL
|
||||
@@ -620,11 +562,10 @@ xfs_vn_getattr(
|
||||
struct kstat *stat)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT };
|
||||
int error;
|
||||
|
||||
error = bhv_vop_getattr(vp, &vattr, ATTR_LAZY, NULL);
|
||||
error = xfs_getattr(XFS_I(inode), &vattr, ATTR_LAZY);
|
||||
if (likely(!error)) {
|
||||
stat->size = i_size_read(inode);
|
||||
stat->dev = inode->i_sb->s_dev;
|
||||
@@ -652,7 +593,6 @@ xfs_vn_setattr(
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
unsigned int ia_valid = attr->ia_valid;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vattr_t vattr = { 0 };
|
||||
int flags = 0;
|
||||
int error;
|
||||
@@ -696,9 +636,9 @@ xfs_vn_setattr(
|
||||
flags |= ATTR_NONBLOCK;
|
||||
#endif
|
||||
|
||||
error = bhv_vop_setattr(vp, &vattr, flags, NULL);
|
||||
error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, &vattr);
|
||||
__vn_revalidate(vn_from_inode(inode), &vattr);
|
||||
return -error;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,15 @@ extern const struct file_operations xfs_file_operations;
|
||||
extern const struct file_operations xfs_dir_file_operations;
|
||||
extern const struct file_operations xfs_invis_file_operations;
|
||||
|
||||
extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
|
||||
int, unsigned int, void __user *);
|
||||
|
||||
struct xfs_inode;
|
||||
extern void xfs_ichgtime(struct xfs_inode *, int);
|
||||
extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int);
|
||||
|
||||
#define xfs_vtoi(vp) \
|
||||
((struct xfs_inode *)vn_to_inode(vp)->i_private)
|
||||
|
||||
#define XFS_I(inode) \
|
||||
((struct xfs_inode *)(inode)->i_private)
|
||||
|
||||
#endif /* __XFS_IOPS_H__ */
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
#include <support/ktrace.h>
|
||||
#include <support/debug.h>
|
||||
#include <support/move.h>
|
||||
#include <support/uuid.h>
|
||||
|
||||
#include <linux/mm.h>
|
||||
@@ -75,6 +74,7 @@
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/log2.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/div64.h>
|
||||
@@ -83,7 +83,6 @@
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <xfs_behavior.h>
|
||||
#include <xfs_vfs.h>
|
||||
#include <xfs_cred.h>
|
||||
#include <xfs_vnode.h>
|
||||
|
||||
+43
-61
@@ -48,6 +48,7 @@
|
||||
#include "xfs_buf_item.h"
|
||||
#include "xfs_utils.h"
|
||||
#include "xfs_iomap.h"
|
||||
#include "xfs_vnodeops.h"
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/writeback.h>
|
||||
@@ -169,27 +170,22 @@ xfs_iozero(
|
||||
|
||||
ssize_t /* bytes read, or (-) error */
|
||||
xfs_read(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_inode_t *ip,
|
||||
struct kiocb *iocb,
|
||||
const struct iovec *iovp,
|
||||
unsigned int segs,
|
||||
loff_t *offset,
|
||||
int ioflags,
|
||||
cred_t *credp)
|
||||
int ioflags)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
xfs_mount_t *mp = ip->i_mount;
|
||||
size_t size = 0;
|
||||
ssize_t ret = 0;
|
||||
xfs_fsize_t n;
|
||||
xfs_inode_t *ip;
|
||||
xfs_mount_t *mp;
|
||||
bhv_vnode_t *vp;
|
||||
unsigned long seg;
|
||||
|
||||
ip = XFS_BHVTOI(bdp);
|
||||
vp = BHV_TO_VNODE(bdp);
|
||||
mp = ip->i_mount;
|
||||
|
||||
XFS_STATS_INC(xs_read_calls);
|
||||
|
||||
@@ -234,13 +230,11 @@ xfs_read(
|
||||
mutex_lock(&inode->i_mutex);
|
||||
xfs_ilock(ip, XFS_IOLOCK_SHARED);
|
||||
|
||||
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
|
||||
!(ioflags & IO_INVIS)) {
|
||||
if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
|
||||
bhv_vrwlock_t locktype = VRWLOCK_READ;
|
||||
int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
|
||||
|
||||
ret = -XFS_SEND_DATA(mp, DM_EVENT_READ,
|
||||
BHV_TO_VNODE(bdp), *offset, size,
|
||||
ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size,
|
||||
dmflags, &locktype);
|
||||
if (ret) {
|
||||
xfs_iunlock(ip, XFS_IOLOCK_SHARED);
|
||||
@@ -252,8 +246,9 @@ xfs_read(
|
||||
|
||||
if (unlikely(ioflags & IO_ISDIRECT)) {
|
||||
if (VN_CACHED(vp))
|
||||
ret = bhv_vop_flushinval_pages(vp, ctooff(offtoct(*offset)),
|
||||
-1, FI_REMAPF_LOCKED);
|
||||
ret = xfs_flushinval_pages(ip,
|
||||
ctooff(offtoct(*offset)),
|
||||
-1, FI_REMAPF_LOCKED);
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
if (ret) {
|
||||
xfs_iunlock(ip, XFS_IOLOCK_SHARED);
|
||||
@@ -277,16 +272,15 @@ xfs_read(
|
||||
|
||||
ssize_t
|
||||
xfs_splice_read(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_inode_t *ip,
|
||||
struct file *infilp,
|
||||
loff_t *ppos,
|
||||
struct pipe_inode_info *pipe,
|
||||
size_t count,
|
||||
int flags,
|
||||
int ioflags,
|
||||
cred_t *credp)
|
||||
int ioflags)
|
||||
{
|
||||
xfs_inode_t *ip = XFS_BHVTOI(bdp);
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
xfs_mount_t *mp = ip->i_mount;
|
||||
ssize_t ret;
|
||||
|
||||
@@ -296,13 +290,11 @@ xfs_splice_read(
|
||||
|
||||
xfs_ilock(ip, XFS_IOLOCK_SHARED);
|
||||
|
||||
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
|
||||
(!(ioflags & IO_INVIS))) {
|
||||
if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
|
||||
bhv_vrwlock_t locktype = VRWLOCK_READ;
|
||||
int error;
|
||||
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
|
||||
*ppos, count,
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count,
|
||||
FILP_DELAY_FLAG(infilp), &locktype);
|
||||
if (error) {
|
||||
xfs_iunlock(ip, XFS_IOLOCK_SHARED);
|
||||
@@ -321,16 +313,15 @@ xfs_splice_read(
|
||||
|
||||
ssize_t
|
||||
xfs_splice_write(
|
||||
bhv_desc_t *bdp,
|
||||
xfs_inode_t *ip,
|
||||
struct pipe_inode_info *pipe,
|
||||
struct file *outfilp,
|
||||
loff_t *ppos,
|
||||
size_t count,
|
||||
int flags,
|
||||
int ioflags,
|
||||
cred_t *credp)
|
||||
int ioflags)
|
||||
{
|
||||
xfs_inode_t *ip = XFS_BHVTOI(bdp);
|
||||
bhv_vnode_t *vp = XFS_ITOV(ip);
|
||||
xfs_mount_t *mp = ip->i_mount;
|
||||
xfs_iocore_t *io = &ip->i_iocore;
|
||||
ssize_t ret;
|
||||
@@ -343,13 +334,11 @@ xfs_splice_write(
|
||||
|
||||
xfs_ilock(ip, XFS_IOLOCK_EXCL);
|
||||
|
||||
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) &&
|
||||
(!(ioflags & IO_INVIS))) {
|
||||
if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) {
|
||||
bhv_vrwlock_t locktype = VRWLOCK_WRITE;
|
||||
int error;
|
||||
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp),
|
||||
*ppos, count,
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count,
|
||||
FILP_DELAY_FLAG(outfilp), &locktype);
|
||||
if (error) {
|
||||
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
|
||||
@@ -583,24 +572,22 @@ out_lock:
|
||||
|
||||
ssize_t /* bytes written, or (-) error */
|
||||
xfs_write(
|
||||
bhv_desc_t *bdp,
|
||||
struct xfs_inode *xip,
|
||||
struct kiocb *iocb,
|
||||
const struct iovec *iovp,
|
||||
unsigned int nsegs,
|
||||
loff_t *offset,
|
||||
int ioflags,
|
||||
cred_t *credp)
|
||||
int ioflags)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
struct inode *inode = mapping->host;
|
||||
bhv_vnode_t *vp = XFS_ITOV(xip);
|
||||
unsigned long segs = nsegs;
|
||||
xfs_inode_t *xip;
|
||||
xfs_mount_t *mp;
|
||||
ssize_t ret = 0, error = 0;
|
||||
xfs_fsize_t isize, new_size;
|
||||
xfs_iocore_t *io;
|
||||
bhv_vnode_t *vp;
|
||||
int iolock;
|
||||
int eventsent = 0;
|
||||
bhv_vrwlock_t locktype;
|
||||
@@ -610,9 +597,6 @@ xfs_write(
|
||||
|
||||
XFS_STATS_INC(xs_write_calls);
|
||||
|
||||
vp = BHV_TO_VNODE(bdp);
|
||||
xip = XFS_BHVTOI(bdp);
|
||||
|
||||
error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -626,7 +610,7 @@ xfs_write(
|
||||
io = &xip->i_iocore;
|
||||
mp = io->io_mount;
|
||||
|
||||
vfs_wait_for_freeze(vp->v_vfsp, SB_FREEZE_WRITE);
|
||||
xfs_wait_for_freeze(mp, SB_FREEZE_WRITE);
|
||||
|
||||
if (XFS_FORCED_SHUTDOWN(mp))
|
||||
return -EIO;
|
||||
@@ -653,7 +637,7 @@ start:
|
||||
goto out_unlock_mutex;
|
||||
}
|
||||
|
||||
if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) &&
|
||||
if ((DM_EVENT_ENABLED(xip, DM_EVENT_WRITE) &&
|
||||
!(ioflags & IO_INVIS) && !eventsent)) {
|
||||
int dmflags = FILP_DELAY_FLAG(file);
|
||||
|
||||
@@ -722,7 +706,7 @@ start:
|
||||
*/
|
||||
|
||||
if (pos > xip->i_size) {
|
||||
error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, xip->i_size);
|
||||
error = xfs_zero_eof(vp, io, pos, xip->i_size);
|
||||
if (error) {
|
||||
xfs_iunlock(xip, XFS_ILOCK_EXCL);
|
||||
goto out_unlock_internal;
|
||||
@@ -758,7 +742,8 @@ retry:
|
||||
WARN_ON(need_i_mutex == 0);
|
||||
xfs_inval_cached_trace(io, pos, -1,
|
||||
ctooff(offtoct(pos)), -1);
|
||||
error = bhv_vop_flushinval_pages(vp, ctooff(offtoct(pos)),
|
||||
error = xfs_flushinval_pages(xip,
|
||||
ctooff(offtoct(pos)),
|
||||
-1, FI_REMAPF_LOCKED);
|
||||
if (error)
|
||||
goto out_unlock_internal;
|
||||
@@ -805,11 +790,9 @@ retry:
|
||||
if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
|
||||
ret = wait_on_sync_kiocb(iocb);
|
||||
|
||||
if ((ret == -ENOSPC) &&
|
||||
DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
|
||||
!(ioflags & IO_INVIS)) {
|
||||
|
||||
xfs_rwunlock(bdp, locktype);
|
||||
if (ret == -ENOSPC &&
|
||||
DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
|
||||
xfs_rwunlock(xip, locktype);
|
||||
if (need_i_mutex)
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
|
||||
@@ -817,7 +800,7 @@ retry:
|
||||
0, 0, 0); /* Delay flag intentionally unused */
|
||||
if (need_i_mutex)
|
||||
mutex_lock(&inode->i_mutex);
|
||||
xfs_rwlock(bdp, locktype);
|
||||
xfs_rwlock(xip, locktype);
|
||||
if (error)
|
||||
goto out_unlock_internal;
|
||||
pos = xip->i_size;
|
||||
@@ -844,20 +827,19 @@ retry:
|
||||
|
||||
/* Handle various SYNC-type writes */
|
||||
if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
|
||||
error = xfs_write_sync_logforce(mp, xip);
|
||||
if (error)
|
||||
goto out_unlock_internal;
|
||||
|
||||
xfs_rwunlock(bdp, locktype);
|
||||
int error2;
|
||||
xfs_rwunlock(xip, locktype);
|
||||
if (need_i_mutex)
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
error = sync_page_range(inode, mapping, pos, ret);
|
||||
error2 = sync_page_range(inode, mapping, pos, ret);
|
||||
if (!error)
|
||||
error = -ret;
|
||||
error = error2;
|
||||
if (need_i_mutex)
|
||||
mutex_lock(&inode->i_mutex);
|
||||
xfs_rwlock(bdp, locktype);
|
||||
xfs_rwlock(xip, locktype);
|
||||
error2 = xfs_write_sync_logforce(mp, xip);
|
||||
if (!error)
|
||||
error = error2;
|
||||
}
|
||||
|
||||
out_unlock_internal:
|
||||
@@ -875,7 +857,7 @@ retry:
|
||||
xip->i_d.di_size = xip->i_size;
|
||||
xfs_iunlock(xip, XFS_ILOCK_EXCL);
|
||||
}
|
||||
xfs_rwunlock(bdp, locktype);
|
||||
xfs_rwunlock(xip, locktype);
|
||||
out_unlock_mutex:
|
||||
if (need_i_mutex)
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
@@ -914,14 +896,14 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
|
||||
|
||||
|
||||
int
|
||||
xfs_bmap(bhv_desc_t *bdp,
|
||||
xfs_bmap(
|
||||
xfs_inode_t *ip,
|
||||
xfs_off_t offset,
|
||||
ssize_t count,
|
||||
int flags,
|
||||
xfs_iomap_t *iomapp,
|
||||
int *niomaps)
|
||||
{
|
||||
xfs_inode_t *ip = XFS_BHVTOI(bdp);
|
||||
xfs_iocore_t *io = &ip->i_iocore;
|
||||
|
||||
ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#ifndef __XFS_LRW_H__
|
||||
#define __XFS_LRW_H__
|
||||
|
||||
struct bhv_desc;
|
||||
struct bhv_vnode;
|
||||
struct xfs_mount;
|
||||
struct xfs_iocore;
|
||||
struct xfs_inode;
|
||||
@@ -71,30 +69,11 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *,
|
||||
#define xfs_inval_cached_trace(io, offset, len, first, last)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Maximum count of bmaps used by read and write paths.
|
||||
*/
|
||||
#define XFS_MAX_RW_NBMAPS 4
|
||||
|
||||
extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
|
||||
struct xfs_iomap *, int *);
|
||||
extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
|
||||
extern int xfs_bdstrat_cb(struct xfs_buf *);
|
||||
extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
|
||||
|
||||
extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t,
|
||||
extern int xfs_zero_eof(struct inode *, struct xfs_iocore *, xfs_off_t,
|
||||
xfs_fsize_t);
|
||||
extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
|
||||
const struct iovec *, unsigned int,
|
||||
loff_t *, int, struct cred *);
|
||||
extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
|
||||
const struct iovec *, unsigned int,
|
||||
loff_t *, int, struct cred *);
|
||||
extern ssize_t xfs_splice_read(struct bhv_desc *, struct file *, loff_t *,
|
||||
struct pipe_inode_info *, size_t, int, int,
|
||||
struct cred *);
|
||||
extern ssize_t xfs_splice_write(struct bhv_desc *, struct pipe_inode_info *,
|
||||
struct file *, loff_t *, size_t, int, int,
|
||||
struct cred *);
|
||||
|
||||
#endif /* __XFS_LRW_H__ */
|
||||
|
||||
+143
-151
File diff suppressed because it is too large
Load Diff
@@ -107,7 +107,8 @@ struct block_device;
|
||||
|
||||
extern __uint64_t xfs_max_file_offset(unsigned int);
|
||||
|
||||
extern void xfs_initialize_vnode(bhv_desc_t *, bhv_vnode_t *, bhv_desc_t *, int);
|
||||
extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp,
|
||||
struct xfs_inode *ip);
|
||||
|
||||
extern void xfs_flush_inode(struct xfs_inode *);
|
||||
extern void xfs_flush_device(struct xfs_inode *);
|
||||
@@ -119,4 +120,6 @@ extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
|
||||
|
||||
extern struct export_operations xfs_export_operations;
|
||||
|
||||
#define XFS_M(sb) ((struct xfs_mount *)((sb)->s_fs_info))
|
||||
|
||||
#endif /* __XFS_SUPER_H__ */
|
||||
|
||||
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it would be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_log.h"
|
||||
#include "xfs_clnt.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_imap.h"
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_dmapi.h"
|
||||
#include "xfs_mount.h"
|
||||
#include "xfs_quota.h"
|
||||
|
||||
int
|
||||
vfs_mount(
|
||||
struct bhv_desc *bdp,
|
||||
struct xfs_mount_args *args,
|
||||
struct cred *cr)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_mount)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_parseargs(
|
||||
struct bhv_desc *bdp,
|
||||
char *s,
|
||||
struct xfs_mount_args *args,
|
||||
int f)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_parseargs)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_showargs(
|
||||
struct bhv_desc *bdp,
|
||||
struct seq_file *m)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_showargs)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_unmount(
|
||||
struct bhv_desc *bdp,
|
||||
int fl,
|
||||
struct cred *cr)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_unmount)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_mntupdate(
|
||||
struct bhv_desc *bdp,
|
||||
int *fl,
|
||||
struct xfs_mount_args *args)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_mntupdate)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_root(
|
||||
struct bhv_desc *bdp,
|
||||
struct bhv_vnode **vpp)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_root)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_statvfs(
|
||||
struct bhv_desc *bdp,
|
||||
bhv_statvfs_t *statp,
|
||||
struct bhv_vnode *vp)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_statvfs)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_statvfs)(next, statp, vp));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_sync(
|
||||
struct bhv_desc *bdp,
|
||||
int fl,
|
||||
struct cred *cr)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_sync)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_vget(
|
||||
struct bhv_desc *bdp,
|
||||
struct bhv_vnode **vpp,
|
||||
struct fid *fidp)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_vget)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_dmapiops(
|
||||
struct bhv_desc *bdp,
|
||||
caddr_t addr)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_dmapiops)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
|
||||
}
|
||||
|
||||
int
|
||||
vfs_quotactl(
|
||||
struct bhv_desc *bdp,
|
||||
int cmd,
|
||||
int id,
|
||||
caddr_t addr)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_quotactl)
|
||||
next = BHV_NEXT(next);
|
||||
return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
|
||||
}
|
||||
|
||||
void
|
||||
vfs_init_vnode(
|
||||
struct bhv_desc *bdp,
|
||||
struct bhv_vnode *vp,
|
||||
struct bhv_desc *bp,
|
||||
int unlock)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_init_vnode)
|
||||
next = BHV_NEXT(next);
|
||||
((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
|
||||
}
|
||||
|
||||
void
|
||||
vfs_force_shutdown(
|
||||
struct bhv_desc *bdp,
|
||||
int fl,
|
||||
char *file,
|
||||
int line)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_force_shutdown)
|
||||
next = BHV_NEXT(next);
|
||||
((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
|
||||
}
|
||||
|
||||
void
|
||||
vfs_freeze(
|
||||
struct bhv_desc *bdp)
|
||||
{
|
||||
struct bhv_desc *next = bdp;
|
||||
|
||||
ASSERT(next);
|
||||
while (! (bhvtovfsops(next))->vfs_freeze)
|
||||
next = BHV_NEXT(next);
|
||||
((*bhvtovfsops(next)->vfs_freeze)(next));
|
||||
}
|
||||
|
||||
bhv_vfs_t *
|
||||
vfs_allocate(
|
||||
struct super_block *sb)
|
||||
{
|
||||
struct bhv_vfs *vfsp;
|
||||
|
||||
vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP);
|
||||
bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
|
||||
INIT_LIST_HEAD(&vfsp->vfs_sync_list);
|
||||
spin_lock_init(&vfsp->vfs_sync_lock);
|
||||
init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
|
||||
|
||||
vfsp->vfs_super = sb;
|
||||
sb->s_fs_info = vfsp;
|
||||
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
vfsp->vfs_flag |= VFS_RDONLY;
|
||||
|
||||
return vfsp;
|
||||
}
|
||||
|
||||
bhv_vfs_t *
|
||||
vfs_from_sb(
|
||||
struct super_block *sb)
|
||||
{
|
||||
return (bhv_vfs_t *)sb->s_fs_info;
|
||||
}
|
||||
|
||||
void
|
||||
vfs_deallocate(
|
||||
struct bhv_vfs *vfsp)
|
||||
{
|
||||
bhv_head_destroy(VFS_BHVHEAD(vfsp));
|
||||
kmem_free(vfsp, sizeof(bhv_vfs_t));
|
||||
}
|
||||
|
||||
void
|
||||
vfs_insertops(
|
||||
struct bhv_vfs *vfsp,
|
||||
struct bhv_module_vfsops *vfsops)
|
||||
{
|
||||
struct bhv_desc *bdp;
|
||||
|
||||
bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
|
||||
bhv_desc_init(bdp, NULL, vfsp, vfsops);
|
||||
bhv_insert(&vfsp->vfs_bh, bdp);
|
||||
}
|
||||
|
||||
void
|
||||
vfs_insertbhv(
|
||||
struct bhv_vfs *vfsp,
|
||||
struct bhv_desc *bdp,
|
||||
struct bhv_vfsops *vfsops,
|
||||
void *mount)
|
||||
{
|
||||
bhv_desc_init(bdp, mount, vfsp, vfsops);
|
||||
bhv_insert_initial(&vfsp->vfs_bh, bdp);
|
||||
}
|
||||
|
||||
void
|
||||
bhv_remove_vfsops(
|
||||
struct bhv_vfs *vfsp,
|
||||
int pos)
|
||||
{
|
||||
struct bhv_desc *bhv;
|
||||
|
||||
bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
|
||||
if (!bhv)
|
||||
return;
|
||||
bhv_remove(&vfsp->vfs_bh, bhv);
|
||||
kmem_free(bhv, sizeof(*bhv));
|
||||
}
|
||||
|
||||
void
|
||||
bhv_remove_all_vfsops(
|
||||
struct bhv_vfs *vfsp,
|
||||
int freebase)
|
||||
{
|
||||
struct xfs_mount *mp;
|
||||
|
||||
bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
|
||||
bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
|
||||
if (!freebase)
|
||||
return;
|
||||
mp = XFS_VFSTOM(vfsp);
|
||||
VFS_REMOVEBHV(vfsp, &mp->m_bhv);
|
||||
xfs_mount_free(mp, 0);
|
||||
}
|
||||
|
||||
void
|
||||
bhv_insert_all_vfsops(
|
||||
struct bhv_vfs *vfsp)
|
||||
{
|
||||
struct xfs_mount *mp;
|
||||
|
||||
mp = xfs_mount_init();
|
||||
vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
|
||||
vfs_insertdmapi(vfsp);
|
||||
vfs_insertquota(vfsp);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user