mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge git://oss.sgi.com:8090/xfs-2.6
* git://oss.sgi.com:8090/xfs-2.6: (43 commits) [XFS] Remove files from the build that are now unused. [XFS] Fix a Makefile issue related to exports.o handling. [XFS] Remove version 1 directory code. Never functioned on Linux, just [XFS] Map EFSCORRUPTED to an actual error code, not just a made up one [XFS] Kill direct access to ->count in valusema(); all we ever use it for [XFS] Remove unneeded conditional code on NFS export interface related [XFS] Remove an incorrect use of unlikely() on a relatively likely code [XFS] Push some common code out of write path into core XFS code for [XFS] Remove unnecessary local from open_exec dmapi path. [XFS] Minor XFS documentation updates. [XFS] Fix broken const use inside local suffix_strtoul routine. [XFS] Fix nused counter. It's currently getting set to -1 rather than [XFS] Fix mismerge of the fs_writable cleanup patch causing a freeze/thaw [XFS] Fix up debug code so that bulkstat wont generate thousands of [XFS] Remove unused parameter from di2xflags routine. [XFS] Cleanup a missed porting conversion, and freezing. [XFS] Resolve a namespace collision on remaining vtypes for FreeBSD [XFS] Resolve a namespace collision on vnode/vnodeops for FreeBSD porters. [XFS] Resolve a namespace collision on vfs/vfsops for FreeBSD porters. [XFS] statvfs component of directory/project quota support, code ...
This commit is contained in:
+1
-1
@@ -3191,7 +3191,7 @@ XFS FILESYSTEM
|
||||
P: Silicon Graphics Inc
|
||||
M: xfs-masters@oss.sgi.com
|
||||
M: nathans@sgi.com
|
||||
L: linux-xfs@oss.sgi.com
|
||||
L: xfs@oss.sgi.com
|
||||
W: http://oss.sgi.com/projects/xfs
|
||||
S: Supported
|
||||
|
||||
|
||||
+11
-16
@@ -1,6 +1,5 @@
|
||||
config XFS_FS
|
||||
tristate "XFS filesystem support"
|
||||
select EXPORTFS if NFSD!=n
|
||||
help
|
||||
XFS is a high performance journaling filesystem which originated
|
||||
on the SGI IRIX platform. It is completely multi-threaded, can
|
||||
@@ -18,11 +17,6 @@ config XFS_FS
|
||||
system of your root partition is compiled as a module, you'll need
|
||||
to use an initial ramdisk (initrd) to boot.
|
||||
|
||||
config XFS_EXPORT
|
||||
bool
|
||||
depends on XFS_FS && EXPORTFS
|
||||
default y
|
||||
|
||||
config XFS_QUOTA
|
||||
bool "XFS Quota support"
|
||||
depends on XFS_FS
|
||||
@@ -65,18 +59,19 @@ config XFS_POSIX_ACL
|
||||
If you don't know what Access Control Lists are, say N.
|
||||
|
||||
config XFS_RT
|
||||
bool "XFS Realtime support (EXPERIMENTAL)"
|
||||
depends on XFS_FS && EXPERIMENTAL
|
||||
bool "XFS Realtime subvolume support"
|
||||
depends on XFS_FS
|
||||
help
|
||||
If you say Y here you will be able to mount and use XFS filesystems
|
||||
which contain a realtime subvolume. The realtime subvolume is a
|
||||
separate area of disk space where only file data is stored. The
|
||||
realtime subvolume is designed to provide very deterministic
|
||||
data rates suitable for media streaming applications.
|
||||
which contain a realtime subvolume. The realtime subvolume is a
|
||||
separate area of disk space where only file data is stored. It was
|
||||
originally designed to provide deterministic data rates suitable
|
||||
for media streaming applications, but is also useful as a generic
|
||||
mechanism for ensuring data and metadata/log I/Os are completely
|
||||
separated. Regular file I/Os are isolated to a separate device
|
||||
from all other requests, and this can be done quite transparently
|
||||
to applications via the inherit-realtime directory inode flag.
|
||||
|
||||
See the xfs man page in section 5 for a bit more information.
|
||||
|
||||
This feature is unsupported at this time, is not yet fully
|
||||
functional, and may cause serious problems.
|
||||
See the xfs man page in section 5 for additional information.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
@@ -59,7 +59,6 @@ xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
|
||||
xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
|
||||
xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
|
||||
xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
|
||||
xfs-$(CONFIG_XFS_EXPORT) += $(XFS_LINUX)/xfs_export.o
|
||||
|
||||
|
||||
xfs-y += xfs_alloc.o \
|
||||
@@ -73,14 +72,12 @@ xfs-y += xfs_alloc.o \
|
||||
xfs_btree.o \
|
||||
xfs_buf_item.o \
|
||||
xfs_da_btree.o \
|
||||
xfs_dir.o \
|
||||
xfs_dir2.o \
|
||||
xfs_dir2_block.o \
|
||||
xfs_dir2_data.o \
|
||||
xfs_dir2_leaf.o \
|
||||
xfs_dir2_node.o \
|
||||
xfs_dir2_sf.o \
|
||||
xfs_dir_leaf.o \
|
||||
xfs_error.o \
|
||||
xfs_extfree_item.o \
|
||||
xfs_fsops.o \
|
||||
@@ -117,6 +114,7 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
|
||||
kmem.o \
|
||||
xfs_aops.o \
|
||||
xfs_buf.o \
|
||||
xfs_export.o \
|
||||
xfs_file.o \
|
||||
xfs_fs_subr.o \
|
||||
xfs_globals.o \
|
||||
|
||||
+1
-37
@@ -22,42 +22,6 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
/*
|
||||
* Process flags handling
|
||||
*/
|
||||
|
||||
#define PFLAGS_TEST_NOIO() (current->flags & PF_NOIO)
|
||||
#define PFLAGS_TEST_FSTRANS() (current->flags & PF_FSTRANS)
|
||||
|
||||
#define PFLAGS_SET_NOIO() do { \
|
||||
current->flags |= PF_NOIO; \
|
||||
} while (0)
|
||||
|
||||
#define PFLAGS_CLEAR_NOIO() do { \
|
||||
current->flags &= ~PF_NOIO; \
|
||||
} while (0)
|
||||
|
||||
/* these could be nested, so we save state */
|
||||
#define PFLAGS_SET_FSTRANS(STATEP) do { \
|
||||
*(STATEP) = current->flags; \
|
||||
current->flags |= PF_FSTRANS; \
|
||||
} while (0)
|
||||
|
||||
#define PFLAGS_CLEAR_FSTRANS(STATEP) do { \
|
||||
*(STATEP) = current->flags; \
|
||||
current->flags &= ~PF_FSTRANS; \
|
||||
} while (0)
|
||||
|
||||
/* Restore the PF_FSTRANS state to what was saved in STATEP */
|
||||
#define PFLAGS_RESTORE_FSTRANS(STATEP) do { \
|
||||
current->flags = ((current->flags & ~PF_FSTRANS) | \
|
||||
(*(STATEP) & PF_FSTRANS)); \
|
||||
} while (0)
|
||||
|
||||
#define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
|
||||
*(NSTATEP) = *(OSTATEP); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* General memory allocation interfaces
|
||||
*/
|
||||
@@ -83,7 +47,7 @@ kmem_flags_convert(unsigned int __nocast flags)
|
||||
lflags = GFP_ATOMIC | __GFP_NOWARN;
|
||||
} else {
|
||||
lflags = GFP_KERNEL | __GFP_NOWARN;
|
||||
if (PFLAGS_TEST_FSTRANS() || (flags & KM_NOFS))
|
||||
if ((current->flags & PF_FSTRANS) || (flags & KM_NOFS))
|
||||
lflags &= ~__GFP_FS;
|
||||
}
|
||||
return lflags;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,7 +28,7 @@ typedef struct {
|
||||
} mrlock_t;
|
||||
|
||||
#define mrinit(mrp, name) \
|
||||
( (mrp)->mr_writer = 0, init_rwsem(&(mrp)->mr_lock) )
|
||||
do { (mrp)->mr_writer = 0; init_rwsem(&(mrp)->mr_lock); } while (0)
|
||||
#define mrlock_init(mrp, t,n,s) mrinit(mrp, n)
|
||||
#define mrfree(mrp) do { } while (0)
|
||||
#define mraccess(mrp) mraccessf(mrp, 0)
|
||||
|
||||
+10
-9
@@ -34,20 +34,21 @@ typedef struct semaphore sema_t;
|
||||
#define initnsema(sp, val, name) sema_init(sp, val)
|
||||
#define psema(sp, b) down(sp)
|
||||
#define vsema(sp) up(sp)
|
||||
#define valusema(sp) (atomic_read(&(sp)->count))
|
||||
#define freesema(sema)
|
||||
#define freesema(sema) do { } while (0)
|
||||
|
||||
static inline int issemalocked(sema_t *sp)
|
||||
{
|
||||
return down_trylock(sp) || (up(sp), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Map cpsema (try to get the sema) to down_trylock. We need to switch
|
||||
* the return values since cpsema returns 1 (acquired) 0 (failed) and
|
||||
* down_trylock returns the reverse 0 (acquired) 1 (failed).
|
||||
*/
|
||||
|
||||
#define cpsema(sp) (down_trylock(sp) ? 0 : 1)
|
||||
|
||||
/*
|
||||
* Didn't do cvsema(sp). Not sure how to map this to up/down/...
|
||||
* It does a vsema if the values is < 0 other wise nothing.
|
||||
*/
|
||||
static inline int cpsema(sema_t *sp)
|
||||
{
|
||||
return down_trylock(sp) ? 0 : 1;
|
||||
}
|
||||
|
||||
#endif /* __XFS_SUPPORT_SEMA_H__ */
|
||||
|
||||
+36
-29
@@ -21,7 +21,6 @@
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -29,7 +28,6 @@
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_alloc_btree.h"
|
||||
#include "xfs_ialloc_btree.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
@@ -76,7 +74,7 @@ xfs_page_trace(
|
||||
int mask)
|
||||
{
|
||||
xfs_inode_t *ip;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
loff_t isize = i_size_read(inode);
|
||||
loff_t offset = page_offset(page);
|
||||
int delalloc = -1, unmapped = -1, unwritten = -1;
|
||||
@@ -136,9 +134,10 @@ xfs_destroy_ioend(
|
||||
|
||||
for (bh = ioend->io_buffer_head; bh; bh = next) {
|
||||
next = bh->b_private;
|
||||
bh->b_end_io(bh, ioend->io_uptodate);
|
||||
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);
|
||||
mempool_free(ioend, xfs_ioend_pool);
|
||||
}
|
||||
@@ -180,13 +179,12 @@ xfs_end_bio_unwritten(
|
||||
void *data)
|
||||
{
|
||||
xfs_ioend_t *ioend = data;
|
||||
vnode_t *vp = ioend->io_vnode;
|
||||
bhv_vnode_t *vp = ioend->io_vnode;
|
||||
xfs_off_t offset = ioend->io_offset;
|
||||
size_t size = ioend->io_size;
|
||||
int error;
|
||||
|
||||
if (ioend->io_uptodate)
|
||||
VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
|
||||
if (likely(!ioend->io_error))
|
||||
bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL);
|
||||
xfs_destroy_ioend(ioend);
|
||||
}
|
||||
|
||||
@@ -211,7 +209,7 @@ xfs_alloc_ioend(
|
||||
* all the I/O from calling the completion routine too early.
|
||||
*/
|
||||
atomic_set(&ioend->io_remaining, 1);
|
||||
ioend->io_uptodate = 1; /* cleared if any I/O fails */
|
||||
ioend->io_error = 0;
|
||||
ioend->io_list = NULL;
|
||||
ioend->io_type = type;
|
||||
ioend->io_vnode = vn_from_inode(inode);
|
||||
@@ -239,10 +237,10 @@ xfs_map_blocks(
|
||||
xfs_iomap_t *mapp,
|
||||
int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
int error, nmaps = 1;
|
||||
|
||||
VOP_BMAP(vp, offset, count, flags, mapp, &nmaps, error);
|
||||
error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps);
|
||||
if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
|
||||
VMODIFY(vp);
|
||||
return -error;
|
||||
@@ -271,16 +269,14 @@ xfs_end_bio(
|
||||
if (bio->bi_size)
|
||||
return 1;
|
||||
|
||||
ASSERT(ioend);
|
||||
ASSERT(atomic_read(&bio->bi_cnt) >= 1);
|
||||
ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error;
|
||||
|
||||
/* Toss bio and pass work off to an xfsdatad thread */
|
||||
if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
|
||||
ioend->io_uptodate = 0;
|
||||
bio->bi_private = NULL;
|
||||
bio->bi_end_io = NULL;
|
||||
|
||||
bio_put(bio);
|
||||
|
||||
xfs_finish_ioend(ioend);
|
||||
return 0;
|
||||
}
|
||||
@@ -1127,7 +1123,7 @@ xfs_vm_writepage(
|
||||
* then mark the page dirty again and leave the page
|
||||
* as is.
|
||||
*/
|
||||
if (PFLAGS_TEST_FSTRANS() && need_trans)
|
||||
if (current_test_flags(PF_FSTRANS) && need_trans)
|
||||
goto out_fail;
|
||||
|
||||
/*
|
||||
@@ -1158,6 +1154,18 @@ out_unlock:
|
||||
return error;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
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);
|
||||
return generic_writepages(mapping, wbc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called to move a page into cleanable state - and from there
|
||||
* to be released. Possibly the page is already clean. We always
|
||||
@@ -1204,7 +1212,7 @@ xfs_vm_releasepage(
|
||||
/* If we are already inside a transaction or the thread cannot
|
||||
* do I/O, we cannot release this page.
|
||||
*/
|
||||
if (PFLAGS_TEST_FSTRANS())
|
||||
if (current_test_flags(PF_FSTRANS))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -1231,7 +1239,7 @@ __xfs_get_blocks(
|
||||
int direct,
|
||||
bmapi_flags_t flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_iomap_t iomap;
|
||||
xfs_off_t offset;
|
||||
ssize_t size;
|
||||
@@ -1241,8 +1249,8 @@ __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;
|
||||
VOP_BMAP(vp, offset, size,
|
||||
create ? flags : BMAPI_READ, &iomap, &niomap, error);
|
||||
error = bhv_vop_bmap(vp, offset, size,
|
||||
create ? flags : BMAPI_READ, &iomap, &niomap);
|
||||
if (error)
|
||||
return -error;
|
||||
if (niomap == 0)
|
||||
@@ -1370,13 +1378,13 @@ xfs_vm_direct_IO(
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_iomap_t iomap;
|
||||
int maps = 1;
|
||||
int error;
|
||||
ssize_t ret;
|
||||
|
||||
VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error);
|
||||
error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps);
|
||||
if (error)
|
||||
return -error;
|
||||
|
||||
@@ -1409,14 +1417,12 @@ xfs_vm_bmap(
|
||||
sector_t block)
|
||||
{
|
||||
struct inode *inode = (struct inode *)mapping->host;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
|
||||
|
||||
VOP_RWLOCK(vp, VRWLOCK_READ);
|
||||
VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
|
||||
VOP_RWUNLOCK(vp, VRWLOCK_READ);
|
||||
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);
|
||||
return generic_block_bmap(mapping, block, xfs_get_blocks);
|
||||
}
|
||||
|
||||
@@ -1452,6 +1458,7 @@ struct address_space_operations xfs_address_space_operations = {
|
||||
.readpage = xfs_vm_readpage,
|
||||
.readpages = xfs_vm_readpages,
|
||||
.writepage = xfs_vm_writepage,
|
||||
.writepages = xfs_vm_writepages,
|
||||
.sync_page = block_sync_page,
|
||||
.releasepage = xfs_vm_releasepage,
|
||||
.invalidatepage = xfs_vm_invalidatepage,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2005-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -30,9 +30,9 @@ typedef void (*xfs_ioend_func_t)(void *);
|
||||
typedef struct xfs_ioend {
|
||||
struct xfs_ioend *io_list; /* next ioend in chain */
|
||||
unsigned int io_type; /* delalloc / unwritten */
|
||||
unsigned int io_uptodate; /* I/O status register */
|
||||
int io_error; /* I/O error code */
|
||||
atomic_t io_remaining; /* hold count */
|
||||
struct vnode *io_vnode; /* file being written to */
|
||||
struct bhv_vnode *io_vnode; /* 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 */
|
||||
@@ -43,4 +43,4 @@ typedef struct xfs_ioend {
|
||||
extern struct address_space_operations xfs_address_space_operations;
|
||||
extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);
|
||||
|
||||
#endif /* __XFS_IOPS_H__ */
|
||||
#endif /* __XFS_AOPS_H__ */
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "xfs_log.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_mount.h"
|
||||
#include "xfs_export.h"
|
||||
|
||||
@@ -97,7 +96,7 @@ xfs_fs_encode_fh(
|
||||
int len;
|
||||
int is64 = 0;
|
||||
#if XFS_BIG_INUMS
|
||||
vfs_t *vfs = vfs_from_sb(inode->i_sb);
|
||||
bhv_vfs_t *vfs = vfs_from_sb(inode->i_sb);
|
||||
|
||||
if (!(vfs->vfs_flag & VFS_32BITINODES)) {
|
||||
/* filesystem may contain 64bit inode numbers */
|
||||
@@ -136,13 +135,13 @@ xfs_fs_get_dentry(
|
||||
struct super_block *sb,
|
||||
void *data)
|
||||
{
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
struct inode *inode;
|
||||
struct dentry *result;
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
bhv_vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
VFS_VGET(vfsp, &vp, (fid_t *)data, error);
|
||||
error = bhv_vfs_vget(vfsp, &vp, (fid_t *)data);
|
||||
if (error || vp == NULL)
|
||||
return ERR_PTR(-ESTALE) ;
|
||||
|
||||
@@ -160,12 +159,12 @@ xfs_fs_get_parent(
|
||||
struct dentry *child)
|
||||
{
|
||||
int error;
|
||||
vnode_t *vp, *cvp;
|
||||
bhv_vnode_t *vp, *cvp;
|
||||
struct dentry *parent;
|
||||
|
||||
cvp = NULL;
|
||||
vp = vn_from_inode(child->d_inode);
|
||||
VOP_LOOKUP(vp, &dotdot, &cvp, 0, NULL, NULL, error);
|
||||
error = bhv_vop_lookup(vp, &dotdot, &cvp, 0, NULL, NULL);
|
||||
if (unlikely(error))
|
||||
return ERR_PTR(-error);
|
||||
|
||||
|
||||
+66
-104
@@ -21,7 +21,6 @@
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -32,7 +31,6 @@
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_btree.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
#include "xfs_inode.h"
|
||||
@@ -58,15 +56,12 @@ __xfs_file_read(
|
||||
{
|
||||
struct iovec iov = {buf, count};
|
||||
struct file *file = iocb->ki_filp;
|
||||
vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
|
||||
|
||||
BUG_ON(iocb->ki_pos != pos);
|
||||
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_read(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -100,15 +95,12 @@ __xfs_file_write(
|
||||
struct iovec iov = {(void __user *)buf, count};
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
ssize_t rval;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
BUG_ON(iocb->ki_pos != pos);
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
|
||||
VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_write(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -140,7 +132,7 @@ __xfs_file_readv(
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
struct kiocb kiocb;
|
||||
ssize_t rval;
|
||||
|
||||
@@ -149,7 +141,8 @@ __xfs_file_readv(
|
||||
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
|
||||
rval = bhv_vop_read(vp, &kiocb, iov, nr_segs,
|
||||
&kiocb.ki_pos, ioflags, NULL);
|
||||
|
||||
*ppos = kiocb.ki_pos;
|
||||
return rval;
|
||||
@@ -184,7 +177,7 @@ __xfs_file_writev(
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
struct kiocb kiocb;
|
||||
ssize_t rval;
|
||||
|
||||
@@ -193,7 +186,8 @@ __xfs_file_writev(
|
||||
if (unlikely(file->f_flags & O_DIRECT))
|
||||
ioflags |= IO_ISDIRECT;
|
||||
|
||||
VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
|
||||
rval = bhv_vop_write(vp, &kiocb, iov, nr_segs,
|
||||
&kiocb.ki_pos, ioflags, NULL);
|
||||
|
||||
*ppos = kiocb.ki_pos;
|
||||
return rval;
|
||||
@@ -227,11 +221,8 @@ xfs_file_sendfile(
|
||||
read_actor_t actor,
|
||||
void *target)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
|
||||
filp, pos, 0, count, actor, target, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -242,11 +233,8 @@ xfs_file_sendfile_invis(
|
||||
read_actor_t actor,
|
||||
void *target)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
|
||||
filp, pos, IO_INVIS, count, actor, target, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -257,11 +245,8 @@ xfs_file_splice_read(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, 0, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -272,11 +257,9 @@ xfs_file_splice_read_invis(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
|
||||
infilp, ppos, pipe, len, flags, IO_INVIS,
|
||||
NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -287,11 +270,8 @@ xfs_file_splice_write(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, 0, NULL);
|
||||
}
|
||||
|
||||
STATIC ssize_t
|
||||
@@ -302,11 +282,9 @@ xfs_file_splice_write_invis(
|
||||
size_t len,
|
||||
unsigned int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
|
||||
ssize_t rval;
|
||||
|
||||
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval);
|
||||
return rval;
|
||||
return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
|
||||
pipe, outfilp, ppos, len, flags, IO_INVIS,
|
||||
NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -314,13 +292,17 @@ xfs_file_open(
|
||||
struct inode *inode,
|
||||
struct file *filp)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
|
||||
if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
|
||||
return -EFBIG;
|
||||
VOP_OPEN(vp, NULL, error);
|
||||
return -error;
|
||||
return -bhv_vop_open(vn_from_inode(inode), NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_file_close(
|
||||
struct file *filp)
|
||||
{
|
||||
return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0,
|
||||
file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -328,12 +310,11 @@ xfs_file_release(
|
||||
struct inode *inode,
|
||||
struct file *filp)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error = 0;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
if (vp)
|
||||
VOP_RELEASE(vp, error);
|
||||
return -error;
|
||||
return -bhv_vop_release(vp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -342,15 +323,14 @@ xfs_file_fsync(
|
||||
struct dentry *dentry,
|
||||
int datasync)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
int flags = FSYNC_WAIT;
|
||||
|
||||
if (datasync)
|
||||
flags |= FSYNC_DATA;
|
||||
VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
|
||||
return -error;
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XFS_DMAPI
|
||||
@@ -361,16 +341,11 @@ xfs_vm_nopage(
|
||||
int *type)
|
||||
{
|
||||
struct inode *inode = area->vm_file->f_dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
|
||||
int error;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
|
||||
|
||||
error = XFS_SEND_MMAP(mp, area, 0);
|
||||
if (error)
|
||||
if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0))
|
||||
return NULL;
|
||||
|
||||
return filemap_nopage(area, address, type);
|
||||
}
|
||||
#endif /* CONFIG_XFS_DMAPI */
|
||||
@@ -382,7 +357,7 @@ xfs_file_readdir(
|
||||
filldir_t filldir)
|
||||
{
|
||||
int error = 0;
|
||||
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
|
||||
uio_t uio;
|
||||
iovec_t iov;
|
||||
int eof = 0;
|
||||
@@ -417,7 +392,7 @@ xfs_file_readdir(
|
||||
|
||||
start_offset = uio.uio_offset;
|
||||
|
||||
VOP_READDIR(vp, &uio, NULL, &eof, error);
|
||||
error = bhv_vop_readdir(vp, &uio, NULL, &eof);
|
||||
if ((uio.uio_offset == start_offset) || error) {
|
||||
size = 0;
|
||||
break;
|
||||
@@ -456,38 +431,28 @@ xfs_file_mmap(
|
||||
struct file *filp,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct inode *ip = filp->f_dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(ip);
|
||||
vattr_t vattr;
|
||||
int error;
|
||||
|
||||
vma->vm_ops = &xfs_file_vm_ops;
|
||||
|
||||
#ifdef CONFIG_XFS_DMAPI
|
||||
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
|
||||
if (vn_from_inode(filp->f_dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
|
||||
vma->vm_ops = &xfs_dmapi_file_vm_ops;
|
||||
}
|
||||
#endif /* CONFIG_XFS_DMAPI */
|
||||
|
||||
vattr.va_mask = XFS_AT_UPDATIME;
|
||||
VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, &vattr); /* update flags */
|
||||
file_accessed(filp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STATIC long
|
||||
xfs_file_ioctl(
|
||||
struct file *filp,
|
||||
unsigned int cmd,
|
||||
unsigned long arg)
|
||||
unsigned long p)
|
||||
{
|
||||
int error;
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error);
|
||||
error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
|
||||
VMODIFY(vp);
|
||||
|
||||
/* NOTE: some of the ioctl's return positive #'s as a
|
||||
@@ -503,13 +468,13 @@ STATIC long
|
||||
xfs_file_ioctl_invis(
|
||||
struct file *filp,
|
||||
unsigned int cmd,
|
||||
unsigned long arg)
|
||||
unsigned long p)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error);
|
||||
error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
|
||||
VMODIFY(vp);
|
||||
|
||||
/* NOTE: some of the ioctl's return positive #'s as a
|
||||
@@ -528,7 +493,7 @@ xfs_vm_mprotect(
|
||||
struct vm_area_struct *vma,
|
||||
unsigned int newflags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
|
||||
int error = 0;
|
||||
|
||||
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
|
||||
@@ -554,24 +519,19 @@ STATIC int
|
||||
xfs_file_open_exec(
|
||||
struct inode *inode)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
|
||||
int error = 0;
|
||||
xfs_inode_t *ip;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
|
||||
ip = xfs_vtoi(vp);
|
||||
if (!ip) {
|
||||
error = -EINVAL;
|
||||
goto open_exec_out;
|
||||
}
|
||||
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) {
|
||||
error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
|
||||
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 (!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);
|
||||
}
|
||||
}
|
||||
open_exec_out:
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_FOP_OPEN_EXEC */
|
||||
|
||||
@@ -592,6 +552,7 @@ const struct file_operations xfs_file_operations = {
|
||||
#endif
|
||||
.mmap = xfs_file_mmap,
|
||||
.open = xfs_file_open,
|
||||
.flush = xfs_file_close,
|
||||
.release = xfs_file_release,
|
||||
.fsync = xfs_file_fsync,
|
||||
#ifdef HAVE_FOP_OPEN_EXEC
|
||||
@@ -616,6 +577,7 @@ const struct file_operations xfs_invis_file_operations = {
|
||||
#endif
|
||||
.mmap = xfs_file_mmap,
|
||||
.open = xfs_file_open,
|
||||
.flush = xfs_file_close,
|
||||
.release = xfs_file_release,
|
||||
.fsync = xfs_file_fsync,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2000-2002,2005-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -15,40 +15,12 @@
|
||||
* 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"
|
||||
|
||||
/*
|
||||
* Stub for no-op vnode operations that return error status.
|
||||
*/
|
||||
int
|
||||
fs_noerr(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int fs_noerr(void) { return 0; }
|
||||
int fs_nosys(void) { return ENOSYS; }
|
||||
void fs_noval(void) { return; }
|
||||
|
||||
/*
|
||||
* Operation unsupported under this file system.
|
||||
*/
|
||||
int
|
||||
fs_nosys(void)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stub for inactive, strategy, and read/write lock/unlock. Does nothing.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
void
|
||||
fs_noval(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* vnode pcache layer for vnode_tosspages.
|
||||
* 'last' parameter unused but left in for IRIX compatibility
|
||||
*/
|
||||
void
|
||||
fs_tosspages(
|
||||
bhv_desc_t *bdp,
|
||||
@@ -56,18 +28,13 @@ fs_tosspages(
|
||||
xfs_off_t last,
|
||||
int fiopt)
|
||||
{
|
||||
vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
|
||||
if (VN_CACHED(vp))
|
||||
truncate_inode_pages(ip->i_mapping, first);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vnode pcache layer for vnode_flushinval_pages.
|
||||
* 'last' parameter unused but left in for IRIX compatibility
|
||||
*/
|
||||
void
|
||||
fs_flushinval_pages(
|
||||
bhv_desc_t *bdp,
|
||||
@@ -75,20 +42,17 @@ fs_flushinval_pages(
|
||||
xfs_off_t last,
|
||||
int fiopt)
|
||||
{
|
||||
vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
|
||||
if (VN_CACHED(vp)) {
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
filemap_write_and_wait(ip->i_mapping);
|
||||
|
||||
truncate_inode_pages(ip->i_mapping, first);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* vnode pcache layer for vnode_flush_pages.
|
||||
* 'last' parameter unused but left in for IRIX compatibility
|
||||
*/
|
||||
int
|
||||
fs_flush_pages(
|
||||
bhv_desc_t *bdp,
|
||||
@@ -97,15 +61,16 @@ fs_flush_pages(
|
||||
uint64_t flags,
|
||||
int fiopt)
|
||||
{
|
||||
vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
|
||||
if (VN_CACHED(vp)) {
|
||||
if (VN_DIRTY(vp)) {
|
||||
if (VN_TRUNC(vp))
|
||||
VUNTRUNCATE(vp);
|
||||
filemap_fdatawrite(ip->i_mapping);
|
||||
if (flags & XFS_B_ASYNC)
|
||||
return 0;
|
||||
filemap_fdatawait(ip->i_mapping);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ xfs_param_t xfs_params = {
|
||||
.xfs_buf_age = { 1*100, 15*100, 7200*100},
|
||||
.inherit_nosym = { 0, 0, 1 },
|
||||
.rotorstep = { 1, 1, 255 },
|
||||
.inherit_nodfrg = { 0, 1, 1 },
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -31,7 +30,6 @@
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_alloc_btree.h"
|
||||
#include "xfs_ialloc_btree.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
@@ -78,7 +76,7 @@ xfs_find_handle(
|
||||
xfs_handle_t handle;
|
||||
xfs_fsop_handlereq_t hreq;
|
||||
struct inode *inode;
|
||||
struct vnode *vp;
|
||||
bhv_vnode_t *vp;
|
||||
|
||||
if (copy_from_user(&hreq, arg, sizeof(hreq)))
|
||||
return -XFS_ERROR(EFAULT);
|
||||
@@ -192,7 +190,7 @@ xfs_vget_fsop_handlereq(
|
||||
xfs_mount_t *mp,
|
||||
struct inode *parinode, /* parent inode pointer */
|
||||
xfs_fsop_handlereq_t *hreq,
|
||||
vnode_t **vp,
|
||||
bhv_vnode_t **vp,
|
||||
struct inode **inode)
|
||||
{
|
||||
void __user *hanp;
|
||||
@@ -202,7 +200,7 @@ xfs_vget_fsop_handlereq(
|
||||
xfs_handle_t handle;
|
||||
xfs_inode_t *ip;
|
||||
struct inode *inodep;
|
||||
vnode_t *vpp;
|
||||
bhv_vnode_t *vpp;
|
||||
xfs_ino_t ino;
|
||||
__u32 igen;
|
||||
int error;
|
||||
@@ -277,7 +275,7 @@ xfs_open_by_handle(
|
||||
struct file *filp;
|
||||
struct inode *inode;
|
||||
struct dentry *dentry;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
xfs_fsop_handlereq_t hreq;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@@ -362,7 +360,7 @@ xfs_readlink_by_handle(
|
||||
struct uio auio;
|
||||
struct inode *inode;
|
||||
xfs_fsop_handlereq_t hreq;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
__u32 olen;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@@ -393,9 +391,11 @@ xfs_readlink_by_handle(
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_resid = olen;
|
||||
|
||||
VOP_READLINK(vp, &auio, IO_INVIS, NULL, error);
|
||||
|
||||
error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL);
|
||||
VN_RELE(vp);
|
||||
if (error)
|
||||
return -error;
|
||||
|
||||
return (olen - auio.uio_resid);
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ xfs_fssetdm_by_handle(
|
||||
xfs_fsop_setdm_handlereq_t dmhreq;
|
||||
struct inode *inode;
|
||||
bhv_desc_t *bdp;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
|
||||
if (!capable(CAP_MKNOD))
|
||||
return -XFS_ERROR(EPERM);
|
||||
@@ -452,7 +452,7 @@ xfs_attrlist_by_handle(
|
||||
attrlist_cursor_kern_t *cursor;
|
||||
xfs_fsop_attrlist_handlereq_t al_hreq;
|
||||
struct inode *inode;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
char *kbuf;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@@ -472,8 +472,8 @@ xfs_attrlist_by_handle(
|
||||
goto out_vn_rele;
|
||||
|
||||
cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
|
||||
VOP_ATTR_LIST(vp, kbuf, al_hreq.buflen, al_hreq.flags,
|
||||
cursor, NULL, error);
|
||||
error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags,
|
||||
cursor, NULL);
|
||||
if (error)
|
||||
goto out_kfree;
|
||||
|
||||
@@ -490,7 +490,7 @@ xfs_attrlist_by_handle(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_get(
|
||||
struct vnode *vp,
|
||||
bhv_vnode_t *vp,
|
||||
char *name,
|
||||
char __user *ubuf,
|
||||
__uint32_t *len,
|
||||
@@ -505,7 +505,7 @@ xfs_attrmulti_attr_get(
|
||||
if (!kbuf)
|
||||
return ENOMEM;
|
||||
|
||||
VOP_ATTR_GET(vp, name, kbuf, len, flags, NULL, error);
|
||||
error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL);
|
||||
if (error)
|
||||
goto out_kfree;
|
||||
|
||||
@@ -519,7 +519,7 @@ xfs_attrmulti_attr_get(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_set(
|
||||
struct vnode *vp,
|
||||
bhv_vnode_t *vp,
|
||||
char *name,
|
||||
const char __user *ubuf,
|
||||
__uint32_t len,
|
||||
@@ -542,7 +542,7 @@ xfs_attrmulti_attr_set(
|
||||
if (copy_from_user(kbuf, ubuf, len))
|
||||
goto out_kfree;
|
||||
|
||||
VOP_ATTR_SET(vp, name, kbuf, len, flags, NULL, error);
|
||||
error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL);
|
||||
|
||||
out_kfree:
|
||||
kfree(kbuf);
|
||||
@@ -551,20 +551,15 @@ xfs_attrmulti_attr_set(
|
||||
|
||||
STATIC int
|
||||
xfs_attrmulti_attr_remove(
|
||||
struct vnode *vp,
|
||||
bhv_vnode_t *vp,
|
||||
char *name,
|
||||
__uint32_t flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if (IS_RDONLY(&vp->v_inode))
|
||||
return -EROFS;
|
||||
if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
|
||||
return EPERM;
|
||||
|
||||
VOP_ATTR_REMOVE(vp, name, flags, NULL, error);
|
||||
return error;
|
||||
return bhv_vop_attr_remove(vp, name, flags, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -578,7 +573,7 @@ xfs_attrmulti_by_handle(
|
||||
xfs_attr_multiop_t *ops;
|
||||
xfs_fsop_attrmulti_handlereq_t am_hreq;
|
||||
struct inode *inode;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
unsigned int i, size;
|
||||
char *attr_name;
|
||||
|
||||
@@ -658,7 +653,7 @@ xfs_attrmulti_by_handle(
|
||||
STATIC int
|
||||
xfs_ioc_space(
|
||||
bhv_desc_t *bdp,
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
struct file *filp,
|
||||
int flags,
|
||||
unsigned int cmd,
|
||||
@@ -682,7 +677,7 @@ xfs_ioc_fsgeometry(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_xattr(
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
xfs_inode_t *ip,
|
||||
struct file *filp,
|
||||
unsigned int cmd,
|
||||
@@ -711,7 +706,7 @@ xfs_ioctl(
|
||||
void __user *arg)
|
||||
{
|
||||
int error;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
xfs_inode_t *ip;
|
||||
xfs_mount_t *mp;
|
||||
|
||||
@@ -962,7 +957,7 @@ xfs_ioctl(
|
||||
STATIC int
|
||||
xfs_ioc_space(
|
||||
bhv_desc_t *bdp,
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
struct file *filp,
|
||||
int ioflags,
|
||||
unsigned int cmd,
|
||||
@@ -1153,14 +1148,14 @@ xfs_di2lxflags(
|
||||
|
||||
STATIC int
|
||||
xfs_ioc_xattr(
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
xfs_inode_t *ip,
|
||||
struct file *filp,
|
||||
unsigned int cmd,
|
||||
void __user *arg)
|
||||
{
|
||||
struct fsxattr fa;
|
||||
struct vattr *vattr;
|
||||
struct bhv_vattr *vattr;
|
||||
int error = 0;
|
||||
int attr_flags;
|
||||
unsigned int flags;
|
||||
@@ -1173,7 +1168,7 @@ xfs_ioc_xattr(
|
||||
case XFS_IOC_FSGETXATTR: {
|
||||
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
|
||||
XFS_AT_NEXTENTS | XFS_AT_PROJID;
|
||||
VOP_GETATTR(vp, vattr, 0, NULL, error);
|
||||
error = bhv_vop_getattr(vp, vattr, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
error = -error;
|
||||
break;
|
||||
@@ -1206,7 +1201,7 @@ xfs_ioc_xattr(
|
||||
vattr->va_extsize = fa.fsx_extsize;
|
||||
vattr->va_projid = fa.fsx_projid;
|
||||
|
||||
VOP_SETATTR(vp, vattr, attr_flags, NULL, error);
|
||||
error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, vattr); /* update flags */
|
||||
error = -error;
|
||||
@@ -1216,7 +1211,7 @@ xfs_ioc_xattr(
|
||||
case XFS_IOC_FSGETXATTRA: {
|
||||
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
|
||||
XFS_AT_ANEXTENTS | XFS_AT_PROJID;
|
||||
VOP_GETATTR(vp, vattr, 0, NULL, error);
|
||||
error = bhv_vop_getattr(vp, vattr, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
error = -error;
|
||||
break;
|
||||
@@ -1262,7 +1257,7 @@ xfs_ioc_xattr(
|
||||
vattr->va_xflags = xfs_merge_ioc_xflags(flags,
|
||||
xfs_ip2xflags(ip));
|
||||
|
||||
VOP_SETATTR(vp, vattr, attr_flags, NULL, error);
|
||||
error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, vattr); /* update flags */
|
||||
error = -error;
|
||||
|
||||
@@ -114,7 +114,7 @@ xfs_compat_ioctl(
|
||||
unsigned long arg)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -193,7 +193,7 @@ xfs_compat_ioctl(
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
VOP_IOCTL(vp, inode, file, mode, cmd, (void __user *)arg, error);
|
||||
error = bhv_vop_ioctl(vp, inode, file, mode, cmd, (void __user *)arg);
|
||||
VMODIFY(vp);
|
||||
|
||||
return error;
|
||||
|
||||
+52
-65
@@ -23,7 +23,6 @@
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -32,7 +31,6 @@
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_alloc_btree.h"
|
||||
#include "xfs_ialloc_btree.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
@@ -61,7 +59,7 @@
|
||||
*/
|
||||
xfs_inode_t *
|
||||
xfs_vtoi(
|
||||
struct vnode *vp)
|
||||
bhv_vnode_t *vp)
|
||||
{
|
||||
bhv_desc_t *bdp;
|
||||
|
||||
@@ -80,7 +78,7 @@ void
|
||||
xfs_synchronize_atime(
|
||||
xfs_inode_t *ip)
|
||||
{
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
|
||||
vp = XFS_ITOV_NULL(ip);
|
||||
if (vp) {
|
||||
@@ -200,14 +198,10 @@ xfs_ichgtime_fast(
|
||||
STATIC void
|
||||
xfs_validate_fields(
|
||||
struct inode *ip,
|
||||
struct vattr *vattr)
|
||||
bhv_vattr_t *vattr)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(ip);
|
||||
int error;
|
||||
|
||||
vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
|
||||
VOP_GETATTR(vp, vattr, ATTR_LAZY, NULL, error);
|
||||
if (likely(!error)) {
|
||||
if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) {
|
||||
ip->i_nlink = vattr->va_nlink;
|
||||
ip->i_blocks = vattr->va_nblocks;
|
||||
|
||||
@@ -225,7 +219,7 @@ xfs_validate_fields(
|
||||
*/
|
||||
STATIC int
|
||||
xfs_init_security(
|
||||
struct vnode *vp,
|
||||
bhv_vnode_t *vp,
|
||||
struct inode *dir)
|
||||
{
|
||||
struct inode *ip = vn_to_inode(vp);
|
||||
@@ -241,7 +235,7 @@ xfs_init_security(
|
||||
return -error;
|
||||
}
|
||||
|
||||
VOP_ATTR_SET(vp, name, value, length, ATTR_SECURE, NULL, error);
|
||||
error = bhv_vop_attr_set(vp, name, value, length, ATTR_SECURE, NULL);
|
||||
if (!error)
|
||||
VMODIFY(vp);
|
||||
|
||||
@@ -264,13 +258,12 @@ xfs_has_fs_struct(struct task_struct *task)
|
||||
|
||||
STATIC inline void
|
||||
xfs_cleanup_inode(
|
||||
vnode_t *dvp,
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *dvp,
|
||||
bhv_vnode_t *vp,
|
||||
struct dentry *dentry,
|
||||
int mode)
|
||||
{
|
||||
struct dentry teardown = {};
|
||||
int error;
|
||||
|
||||
/* Oh, the horror.
|
||||
* If we can't add the ACL or we fail in
|
||||
@@ -281,9 +274,9 @@ xfs_cleanup_inode(
|
||||
teardown.d_name = dentry->d_name;
|
||||
|
||||
if (S_ISDIR(mode))
|
||||
VOP_RMDIR(dvp, &teardown, NULL, error);
|
||||
bhv_vop_rmdir(dvp, &teardown, NULL);
|
||||
else
|
||||
VOP_REMOVE(dvp, &teardown, NULL, error);
|
||||
bhv_vop_remove(dvp, &teardown, NULL);
|
||||
VN_RELE(vp);
|
||||
}
|
||||
|
||||
@@ -295,8 +288,8 @@ xfs_vn_mknod(
|
||||
dev_t rdev)
|
||||
{
|
||||
struct inode *ip;
|
||||
vattr_t vattr = { 0 };
|
||||
vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
|
||||
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;
|
||||
int error;
|
||||
@@ -330,10 +323,10 @@ xfs_vn_mknod(
|
||||
vattr.va_mask |= XFS_AT_RDEV;
|
||||
/*FALLTHROUGH*/
|
||||
case S_IFREG:
|
||||
VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error);
|
||||
error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL);
|
||||
break;
|
||||
case S_IFDIR:
|
||||
VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error);
|
||||
error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL);
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
@@ -396,14 +389,14 @@ xfs_vn_lookup(
|
||||
struct dentry *dentry,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
struct vnode *vp = vn_from_inode(dir), *cvp;
|
||||
bhv_vnode_t *vp = vn_from_inode(dir), *cvp;
|
||||
int error;
|
||||
|
||||
if (dentry->d_name.len >= MAXNAMELEN)
|
||||
return ERR_PTR(-ENAMETOOLONG);
|
||||
|
||||
VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error);
|
||||
if (error) {
|
||||
error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL);
|
||||
if (unlikely(error)) {
|
||||
if (unlikely(error != ENOENT))
|
||||
return ERR_PTR(-error);
|
||||
d_add(dentry, NULL);
|
||||
@@ -420,9 +413,9 @@ xfs_vn_link(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *ip; /* inode of guy being linked to */
|
||||
vnode_t *tdvp; /* target directory for new name/link */
|
||||
vnode_t *vp; /* vp of name being linked */
|
||||
vattr_t vattr;
|
||||
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 */
|
||||
@@ -432,7 +425,7 @@ xfs_vn_link(
|
||||
tdvp = vn_from_inode(dir);
|
||||
vp = vn_from_inode(ip);
|
||||
|
||||
VOP_LINK(tdvp, vp, dentry, NULL, error);
|
||||
error = bhv_vop_link(tdvp, vp, dentry, NULL);
|
||||
if (likely(!error)) {
|
||||
VMODIFY(tdvp);
|
||||
VN_HOLD(vp);
|
||||
@@ -448,14 +441,14 @@ xfs_vn_unlink(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode;
|
||||
vnode_t *dvp; /* directory containing name to remove */
|
||||
vattr_t vattr;
|
||||
bhv_vnode_t *dvp; /* directory containing name to remove */
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
inode = dentry->d_inode;
|
||||
dvp = vn_from_inode(dir);
|
||||
|
||||
VOP_REMOVE(dvp, dentry, NULL, error);
|
||||
error = bhv_vop_remove(dvp, dentry, NULL);
|
||||
if (likely(!error)) {
|
||||
xfs_validate_fields(dir, &vattr); /* size needs update */
|
||||
xfs_validate_fields(inode, &vattr);
|
||||
@@ -470,27 +463,26 @@ xfs_vn_symlink(
|
||||
const char *symname)
|
||||
{
|
||||
struct inode *ip;
|
||||
vattr_t vattr = { 0 };
|
||||
vnode_t *dvp; /* directory containing name of symlink */
|
||||
vnode_t *cvp; /* used to lookup symlink to put in dentry */
|
||||
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;
|
||||
|
||||
dvp = vn_from_inode(dir);
|
||||
cvp = NULL;
|
||||
|
||||
vattr.va_mode = S_IFLNK |
|
||||
va.va_mode = S_IFLNK |
|
||||
(irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
|
||||
vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
|
||||
va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
|
||||
|
||||
error = 0;
|
||||
VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error);
|
||||
error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &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, &vattr);
|
||||
xfs_validate_fields(ip, &vattr);
|
||||
xfs_validate_fields(dir, &va);
|
||||
xfs_validate_fields(ip, &va);
|
||||
} else {
|
||||
xfs_cleanup_inode(dvp, cvp, dentry, 0);
|
||||
}
|
||||
@@ -504,11 +496,11 @@ xfs_vn_rmdir(
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
vnode_t *dvp = vn_from_inode(dir);
|
||||
vattr_t vattr;
|
||||
bhv_vnode_t *dvp = vn_from_inode(dir);
|
||||
bhv_vattr_t vattr;
|
||||
int error;
|
||||
|
||||
VOP_RMDIR(dvp, dentry, NULL, error);
|
||||
error = bhv_vop_rmdir(dvp, dentry, NULL);
|
||||
if (likely(!error)) {
|
||||
xfs_validate_fields(inode, &vattr);
|
||||
xfs_validate_fields(dir, &vattr);
|
||||
@@ -524,15 +516,15 @@ xfs_vn_rename(
|
||||
struct dentry *ndentry)
|
||||
{
|
||||
struct inode *new_inode = ndentry->d_inode;
|
||||
vnode_t *fvp; /* from directory */
|
||||
vnode_t *tvp; /* target directory */
|
||||
vattr_t vattr;
|
||||
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);
|
||||
|
||||
VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error);
|
||||
error = bhv_vop_rename(fvp, odentry, tvp, ndentry, NULL);
|
||||
if (likely(!error)) {
|
||||
if (new_inode)
|
||||
xfs_validate_fields(new_inode, &vattr);
|
||||
@@ -553,7 +545,7 @@ xfs_vn_follow_link(
|
||||
struct dentry *dentry,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
uio_t *uio;
|
||||
iovec_t iov;
|
||||
int error;
|
||||
@@ -586,8 +578,8 @@ xfs_vn_follow_link(
|
||||
uio->uio_resid = MAXPATHLEN;
|
||||
uio->uio_iovcnt = 1;
|
||||
|
||||
VOP_READLINK(vp, uio, 0, NULL, error);
|
||||
if (error) {
|
||||
error = bhv_vop_readlink(vp, uio, 0, NULL);
|
||||
if (unlikely(error)) {
|
||||
kfree(link);
|
||||
link = ERR_PTR(-error);
|
||||
} else {
|
||||
@@ -618,12 +610,7 @@ xfs_vn_permission(
|
||||
int mode,
|
||||
struct nameidata *nd)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error;
|
||||
|
||||
mode <<= 6; /* convert from linux to vnode access bits */
|
||||
VOP_ACCESS(vp, mode, NULL, error);
|
||||
return -error;
|
||||
return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL);
|
||||
}
|
||||
#else
|
||||
#define xfs_vn_permission NULL
|
||||
@@ -636,14 +623,14 @@ xfs_vn_getattr(
|
||||
struct kstat *stat)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
int error = 0;
|
||||
|
||||
if (unlikely(vp->v_flag & VMODIFIED))
|
||||
error = vn_revalidate(vp);
|
||||
if (!error)
|
||||
generic_fillattr(inode, stat);
|
||||
return 0;
|
||||
return -error;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -653,8 +640,8 @@ xfs_vn_setattr(
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
unsigned int ia_valid = attr->ia_valid;
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
vattr_t vattr = { 0 };
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vattr_t vattr = { 0 };
|
||||
int flags = 0;
|
||||
int error;
|
||||
|
||||
@@ -697,7 +684,7 @@ xfs_vn_setattr(
|
||||
flags |= ATTR_NONBLOCK;
|
||||
#endif
|
||||
|
||||
VOP_SETATTR(vp, &vattr, flags, NULL, error);
|
||||
error = bhv_vop_setattr(vp, &vattr, flags, NULL);
|
||||
if (likely(!error))
|
||||
__vn_revalidate(vp, &vattr);
|
||||
return -error;
|
||||
@@ -718,7 +705,7 @@ xfs_vn_setxattr(
|
||||
size_t size,
|
||||
int flags)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
char *attr = (char *)name;
|
||||
attrnames_t *namesp;
|
||||
int xflags = 0;
|
||||
@@ -748,7 +735,7 @@ xfs_vn_getxattr(
|
||||
void *data,
|
||||
size_t size)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
char *attr = (char *)name;
|
||||
attrnames_t *namesp;
|
||||
int xflags = 0;
|
||||
@@ -777,7 +764,7 @@ xfs_vn_listxattr(
|
||||
char *data,
|
||||
size_t size)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
int error, xflags = ATTR_KERNAMELS;
|
||||
ssize_t result;
|
||||
|
||||
@@ -796,7 +783,7 @@ xfs_vn_removexattr(
|
||||
struct dentry *dentry,
|
||||
const char *name)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
|
||||
char *attr = (char *)name;
|
||||
attrnames_t *namesp;
|
||||
int xflags = 0;
|
||||
|
||||
@@ -134,14 +134,21 @@ BUFFER_FNS(PrivateStart, unwritten);
|
||||
#define xfs_buf_age_centisecs xfs_params.xfs_buf_age.val
|
||||
#define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val
|
||||
#define xfs_rotorstep xfs_params.rotorstep.val
|
||||
#define xfs_inherit_nodefrag xfs_params.inherit_nodfrg.val
|
||||
|
||||
#ifndef raw_smp_processor_id
|
||||
#define raw_smp_processor_id() smp_processor_id()
|
||||
#endif
|
||||
#define current_cpu() raw_smp_processor_id()
|
||||
#define current_cpu() (raw_smp_processor_id())
|
||||
#define current_pid() (current->pid)
|
||||
#define current_fsuid(cred) (current->fsuid)
|
||||
#define current_fsgid(cred) (current->fsgid)
|
||||
#define current_set_flags(f) (current->flags |= (f))
|
||||
#define current_test_flags(f) (current->flags & (f))
|
||||
#define current_clear_flags(f) (current->flags & ~(f))
|
||||
#define current_set_flags_nested(sp, f) \
|
||||
(*(sp) = current->flags, current->flags |= (f))
|
||||
#define current_clear_flags_nested(sp, f) \
|
||||
(*(sp) = current->flags, current->flags &= ~(f))
|
||||
#define current_restore_flags_nested(sp, f) \
|
||||
(current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
|
||||
|
||||
#define NBPP PAGE_SIZE
|
||||
#define DPPSHFT (PAGE_SHIFT - 9)
|
||||
@@ -187,25 +194,9 @@ BUFFER_FNS(PrivateStart, unwritten);
|
||||
/* bytes to clicks */
|
||||
#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
|
||||
|
||||
#ifndef ENOATTR
|
||||
#define ENOATTR ENODATA /* Attribute not found */
|
||||
#endif
|
||||
|
||||
/* Note: EWRONGFS never visible outside the kernel */
|
||||
#define EWRONGFS EINVAL /* Mount with wrong filesystem type */
|
||||
|
||||
/*
|
||||
* XXX EFSCORRUPTED needs a real value in errno.h. asm-i386/errno.h won't
|
||||
* return codes out of its known range in errno.
|
||||
* XXX Also note: needs to be < 1000 and fairly unique on Linux (mustn't
|
||||
* conflict with any code we use already or any code a driver may use)
|
||||
* XXX Some options (currently we do #2):
|
||||
* 1/ New error code ["Filesystem is corrupted", _after_ glibc updated]
|
||||
* 2/ 990 ["Unknown error 990"]
|
||||
* 3/ EUCLEAN ["Structure needs cleaning"]
|
||||
* 4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace]
|
||||
*/
|
||||
#define EFSCORRUPTED 990 /* Filesystem is corrupted */
|
||||
#define EWRONGFS EINVAL /* Mount with wrong filesystem type */
|
||||
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
|
||||
|
||||
#define SYNCHRONIZE() barrier()
|
||||
#define __return_address __builtin_return_address(0)
|
||||
|
||||
+20
-103
@@ -23,7 +23,6 @@
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -32,7 +31,6 @@
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_alloc_btree.h"
|
||||
#include "xfs_ialloc_btree.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
@@ -206,7 +204,7 @@ xfs_read(
|
||||
xfs_fsize_t n;
|
||||
xfs_inode_t *ip;
|
||||
xfs_mount_t *mp;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
unsigned long seg;
|
||||
|
||||
ip = XFS_BHVTOI(bdp);
|
||||
@@ -258,7 +256,7 @@ xfs_read(
|
||||
|
||||
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
|
||||
!(ioflags & IO_INVIS)) {
|
||||
vrwlock_t locktype = VRWLOCK_READ;
|
||||
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,
|
||||
@@ -271,7 +269,7 @@ xfs_read(
|
||||
}
|
||||
|
||||
if (unlikely((ioflags & IO_ISDIRECT) && VN_CACHED(vp)))
|
||||
VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(*offset)),
|
||||
bhv_vop_flushinval_pages(vp, ctooff(offtoct(*offset)),
|
||||
-1, FI_REMAPF_LOCKED);
|
||||
|
||||
xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
|
||||
@@ -313,7 +311,7 @@ xfs_sendfile(
|
||||
|
||||
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
|
||||
(!(ioflags & IO_INVIS))) {
|
||||
vrwlock_t locktype = VRWLOCK_READ;
|
||||
bhv_vrwlock_t locktype = VRWLOCK_READ;
|
||||
int error;
|
||||
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
|
||||
@@ -357,7 +355,7 @@ xfs_splice_read(
|
||||
|
||||
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
|
||||
(!(ioflags & IO_INVIS))) {
|
||||
vrwlock_t locktype = VRWLOCK_READ;
|
||||
bhv_vrwlock_t locktype = VRWLOCK_READ;
|
||||
int error;
|
||||
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
|
||||
@@ -401,7 +399,7 @@ xfs_splice_write(
|
||||
|
||||
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) &&
|
||||
(!(ioflags & IO_INVIS))) {
|
||||
vrwlock_t locktype = VRWLOCK_WRITE;
|
||||
bhv_vrwlock_t locktype = VRWLOCK_WRITE;
|
||||
int error;
|
||||
|
||||
error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp),
|
||||
@@ -458,7 +456,7 @@ xfs_zero_last_block(
|
||||
last_fsb = XFS_B_TO_FSBT(mp, isize);
|
||||
nimaps = 1;
|
||||
error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap,
|
||||
&nimaps, NULL);
|
||||
&nimaps, NULL, NULL);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
@@ -499,7 +497,7 @@ xfs_zero_last_block(
|
||||
|
||||
int /* error (positive) */
|
||||
xfs_zero_eof(
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
xfs_iocore_t *io,
|
||||
xfs_off_t offset, /* starting I/O offset */
|
||||
xfs_fsize_t isize, /* current inode size */
|
||||
@@ -510,7 +508,6 @@ xfs_zero_eof(
|
||||
xfs_fileoff_t end_zero_fsb;
|
||||
xfs_fileoff_t zero_count_fsb;
|
||||
xfs_fileoff_t last_fsb;
|
||||
xfs_extlen_t buf_len_fsb;
|
||||
xfs_mount_t *mp = io->io_mount;
|
||||
int nimaps;
|
||||
int error = 0;
|
||||
@@ -556,7 +553,7 @@ xfs_zero_eof(
|
||||
nimaps = 1;
|
||||
zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
|
||||
error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb,
|
||||
0, NULL, 0, &imap, &nimaps, NULL);
|
||||
0, NULL, 0, &imap, &nimaps, NULL, NULL);
|
||||
if (error) {
|
||||
ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
|
||||
ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
|
||||
@@ -579,16 +576,7 @@ xfs_zero_eof(
|
||||
}
|
||||
|
||||
/*
|
||||
* There are blocks in the range requested.
|
||||
* Zero them a single write at a time. We actually
|
||||
* don't zero the entire range returned if it is
|
||||
* too big and simply loop around to get the rest.
|
||||
* That is not the most efficient thing to do, but it
|
||||
* is simple and this path should not be exercised often.
|
||||
*/
|
||||
buf_len_fsb = XFS_FILBLKS_MIN(imap.br_blockcount,
|
||||
mp->m_writeio_blocks << 8);
|
||||
/*
|
||||
* There are blocks we need to zero.
|
||||
* Drop the inode lock while we're doing the I/O.
|
||||
* We'll still have the iolock to protect us.
|
||||
*/
|
||||
@@ -596,14 +584,13 @@ xfs_zero_eof(
|
||||
|
||||
error = xfs_iozero(ip,
|
||||
XFS_FSB_TO_B(mp, start_zero_fsb),
|
||||
XFS_FSB_TO_B(mp, buf_len_fsb),
|
||||
XFS_FSB_TO_B(mp, imap.br_blockcount),
|
||||
end_size);
|
||||
|
||||
if (error) {
|
||||
goto out_lock;
|
||||
}
|
||||
|
||||
start_zero_fsb = imap.br_startoff + buf_len_fsb;
|
||||
start_zero_fsb = imap.br_startoff + imap.br_blockcount;
|
||||
ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
|
||||
|
||||
XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
|
||||
@@ -637,11 +624,11 @@ xfs_write(
|
||||
ssize_t ret = 0, error = 0;
|
||||
xfs_fsize_t isize, new_size;
|
||||
xfs_iocore_t *io;
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
unsigned long seg;
|
||||
int iolock;
|
||||
int eventsent = 0;
|
||||
vrwlock_t locktype;
|
||||
bhv_vrwlock_t locktype;
|
||||
size_t ocount = 0, count;
|
||||
loff_t pos;
|
||||
int need_i_mutex = 1, need_flush = 0;
|
||||
@@ -679,11 +666,11 @@ xfs_write(
|
||||
io = &xip->i_iocore;
|
||||
mp = io->io_mount;
|
||||
|
||||
vfs_wait_for_freeze(vp->v_vfsp, SB_FREEZE_WRITE);
|
||||
|
||||
if (XFS_FORCED_SHUTDOWN(mp))
|
||||
return -EIO;
|
||||
|
||||
fs_check_frozen(vp->v_vfsp, SB_FREEZE_WRITE);
|
||||
|
||||
if (ioflags & IO_ISDIRECT) {
|
||||
xfs_buftarg_t *target =
|
||||
(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
|
||||
@@ -814,7 +801,7 @@ retry:
|
||||
if (need_flush) {
|
||||
xfs_inval_cached_trace(io, pos, -1,
|
||||
ctooff(offtoct(pos)), -1);
|
||||
VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(pos)),
|
||||
bhv_vop_flushinval_pages(vp, ctooff(offtoct(pos)),
|
||||
-1, FI_REMAPF_LOCKED);
|
||||
}
|
||||
|
||||
@@ -903,79 +890,9 @@ retry:
|
||||
|
||||
/* Handle various SYNC-type writes */
|
||||
if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
|
||||
/*
|
||||
* If we're treating this as O_DSYNC and we have not updated the
|
||||
* size, force the log.
|
||||
*/
|
||||
if (!(mp->m_flags & XFS_MOUNT_OSYNCISOSYNC) &&
|
||||
!(xip->i_update_size)) {
|
||||
xfs_inode_log_item_t *iip = xip->i_itemp;
|
||||
|
||||
/*
|
||||
* If an allocation transaction occurred
|
||||
* without extending the size, then we have to force
|
||||
* the log up the proper point to ensure that the
|
||||
* allocation is permanent. We can't count on
|
||||
* the fact that buffered writes lock out direct I/O
|
||||
* writes - the direct I/O write could have extended
|
||||
* the size nontransactionally, then finished before
|
||||
* we started. xfs_write_file will think that the file
|
||||
* didn't grow but the update isn't safe unless the
|
||||
* size change is logged.
|
||||
*
|
||||
* Force the log if we've committed a transaction
|
||||
* against the inode or if someone else has and
|
||||
* the commit record hasn't gone to disk (e.g.
|
||||
* the inode is pinned). This guarantees that
|
||||
* all changes affecting the inode are permanent
|
||||
* when we return.
|
||||
*/
|
||||
if (iip && iip->ili_last_lsn) {
|
||||
xfs_log_force(mp, iip->ili_last_lsn,
|
||||
XFS_LOG_FORCE | XFS_LOG_SYNC);
|
||||
} else if (xfs_ipincount(xip) > 0) {
|
||||
xfs_log_force(mp, (xfs_lsn_t)0,
|
||||
XFS_LOG_FORCE | XFS_LOG_SYNC);
|
||||
}
|
||||
|
||||
} else {
|
||||
xfs_trans_t *tp;
|
||||
|
||||
/*
|
||||
* O_SYNC or O_DSYNC _with_ a size update are handled
|
||||
* the same way.
|
||||
*
|
||||
* If the write was synchronous then we need to make
|
||||
* sure that the inode modification time is permanent.
|
||||
* We'll have updated the timestamp above, so here
|
||||
* we use a synchronous transaction to log the inode.
|
||||
* It's not fast, but it's necessary.
|
||||
*
|
||||
* If this a dsync write and the size got changed
|
||||
* non-transactionally, then we need to ensure that
|
||||
* the size change gets logged in a synchronous
|
||||
* transaction.
|
||||
*/
|
||||
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_WRITE_SYNC);
|
||||
if ((error = xfs_trans_reserve(tp, 0,
|
||||
XFS_SWRITE_LOG_RES(mp),
|
||||
0, 0, 0))) {
|
||||
/* Transaction reserve failed */
|
||||
xfs_trans_cancel(tp, 0);
|
||||
} else {
|
||||
/* Transaction reserve successful */
|
||||
xfs_ilock(xip, XFS_ILOCK_EXCL);
|
||||
xfs_trans_ijoin(tp, xip, XFS_ILOCK_EXCL);
|
||||
xfs_trans_ihold(tp, xip);
|
||||
xfs_trans_log_inode(tp, xip, XFS_ILOG_CORE);
|
||||
xfs_trans_set_sync(tp);
|
||||
error = xfs_trans_commit(tp, 0, NULL);
|
||||
xfs_iunlock(xip, XFS_ILOCK_EXCL);
|
||||
}
|
||||
if (error)
|
||||
goto out_unlock_internal;
|
||||
}
|
||||
error = xfs_write_sync_logforce(mp, xip);
|
||||
if (error)
|
||||
goto out_unlock_internal;
|
||||
|
||||
xfs_rwunlock(bdp, locktype);
|
||||
if (need_i_mutex)
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef __XFS_LRW_H__
|
||||
#define __XFS_LRW_H__
|
||||
|
||||
struct vnode;
|
||||
struct bhv_desc;
|
||||
struct bhv_vnode;
|
||||
struct xfs_mount;
|
||||
struct xfs_iocore;
|
||||
struct xfs_inode;
|
||||
@@ -49,7 +49,7 @@ struct xfs_iomap;
|
||||
#define XFS_CTRUNC4 14
|
||||
#define XFS_CTRUNC5 15
|
||||
#define XFS_CTRUNC6 16
|
||||
#define XFS_BUNMAPI 17
|
||||
#define XFS_BUNMAP 17
|
||||
#define XFS_INVAL_CACHED 18
|
||||
#define XFS_DIORD_ENTER 19
|
||||
#define XFS_DIOWR_ENTER 20
|
||||
@@ -82,7 +82,7 @@ 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 vnode *, struct xfs_iocore *, xfs_off_t,
|
||||
extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t,
|
||||
xfs_fsize_t, xfs_fsize_t);
|
||||
extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
|
||||
const struct iovec *, unsigned int,
|
||||
|
||||
+71
-118
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_dir.h"
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_dmapi.h"
|
||||
@@ -32,7 +31,6 @@
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_alloc_btree.h"
|
||||
#include "xfs_ialloc_btree.h"
|
||||
#include "xfs_dir_sf.h"
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_attr_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
@@ -151,7 +149,7 @@ xfs_set_inodeops(
|
||||
STATIC __inline__ void
|
||||
xfs_revalidate_inode(
|
||||
xfs_mount_t *mp,
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
xfs_inode_t *ip)
|
||||
{
|
||||
struct inode *inode = vn_to_inode(vp);
|
||||
@@ -206,7 +204,7 @@ xfs_revalidate_inode(
|
||||
void
|
||||
xfs_initialize_vnode(
|
||||
bhv_desc_t *bdp,
|
||||
vnode_t *vp,
|
||||
bhv_vnode_t *vp,
|
||||
bhv_desc_t *inode_bhv,
|
||||
int unlock)
|
||||
{
|
||||
@@ -336,7 +334,7 @@ STATIC struct inode *
|
||||
xfs_fs_alloc_inode(
|
||||
struct super_block *sb)
|
||||
{
|
||||
vnode_t *vp;
|
||||
bhv_vnode_t *vp;
|
||||
|
||||
vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
|
||||
if (unlikely(!vp))
|
||||
@@ -359,13 +357,13 @@ xfs_fs_inode_init_once(
|
||||
{
|
||||
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
|
||||
SLAB_CTOR_CONSTRUCTOR)
|
||||
inode_init_once(vn_to_inode((vnode_t *)vnode));
|
||||
inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_init_zones(void)
|
||||
{
|
||||
xfs_vnode_zone = kmem_zone_init_flags(sizeof(vnode_t), "xfs_vnode_t",
|
||||
xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode",
|
||||
KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
|
||||
KM_ZONE_SPREAD,
|
||||
xfs_fs_inode_init_once);
|
||||
@@ -409,22 +407,17 @@ xfs_fs_write_inode(
|
||||
struct inode *inode,
|
||||
int sync)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
int error = 0, flags = FLUSH_INODE;
|
||||
|
||||
if (vp) {
|
||||
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
|
||||
if (sync)
|
||||
flags |= FLUSH_SYNC;
|
||||
VOP_IFLUSH(vp, flags, error);
|
||||
if (error == EAGAIN) {
|
||||
if (sync)
|
||||
VOP_IFLUSH(vp, flags | FLUSH_LOG, error);
|
||||
else
|
||||
error = 0;
|
||||
}
|
||||
error = bhv_vop_iflush(vp, flags);
|
||||
if (error == EAGAIN)
|
||||
error = sync? bhv_vop_iflush(vp, flags | FLUSH_LOG) : 0;
|
||||
}
|
||||
|
||||
return -error;
|
||||
}
|
||||
|
||||
@@ -432,8 +425,7 @@ STATIC void
|
||||
xfs_fs_clear_inode(
|
||||
struct inode *inode)
|
||||
{
|
||||
vnode_t *vp = vn_from_inode(inode);
|
||||
int error, cache;
|
||||
bhv_vnode_t *vp = vn_from_inode(inode);
|
||||
|
||||
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
|
||||
|
||||
@@ -446,20 +438,18 @@ xfs_fs_clear_inode(
|
||||
* This can happen because xfs_iget_core calls xfs_idestroy if we
|
||||
* find an inode with di_mode == 0 but without IGET_CREATE set.
|
||||
*/
|
||||
if (vp->v_fbhv)
|
||||
VOP_INACTIVE(vp, NULL, cache);
|
||||
if (VNHEAD(vp))
|
||||
bhv_vop_inactive(vp, NULL);
|
||||
|
||||
VN_LOCK(vp);
|
||||
vp->v_flag &= ~VMODIFIED;
|
||||
VN_UNLOCK(vp, 0);
|
||||
|
||||
if (vp->v_fbhv) {
|
||||
VOP_RECLAIM(vp, error);
|
||||
if (error)
|
||||
panic("vn_purge: cannot reclaim");
|
||||
}
|
||||
if (VNHEAD(vp))
|
||||
if (bhv_vop_reclaim(vp))
|
||||
panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp);
|
||||
|
||||
ASSERT(vp->v_fbhv == NULL);
|
||||
ASSERT(VNHEAD(vp) == NULL);
|
||||
|
||||
#ifdef XFS_VNODE_TRACE
|
||||
ktrace_free(vp->v_trace);
|
||||
@@ -475,13 +465,13 @@ xfs_fs_clear_inode(
|
||||
*/
|
||||
STATIC void
|
||||
xfs_syncd_queue_work(
|
||||
struct vfs *vfs,
|
||||
struct bhv_vfs *vfs,
|
||||
void *data,
|
||||
void (*syncer)(vfs_t *, void *))
|
||||
void (*syncer)(bhv_vfs_t *, void *))
|
||||
{
|
||||
vfs_sync_work_t *work;
|
||||
struct bhv_vfs_sync_work *work;
|
||||
|
||||
work = kmem_alloc(sizeof(struct vfs_sync_work), KM_SLEEP);
|
||||
work = kmem_alloc(sizeof(struct bhv_vfs_sync_work), KM_SLEEP);
|
||||
INIT_LIST_HEAD(&work->w_list);
|
||||
work->w_syncer = syncer;
|
||||
work->w_data = data;
|
||||
@@ -500,7 +490,7 @@ xfs_syncd_queue_work(
|
||||
*/
|
||||
STATIC void
|
||||
xfs_flush_inode_work(
|
||||
vfs_t *vfs,
|
||||
bhv_vfs_t *vfs,
|
||||
void *inode)
|
||||
{
|
||||
filemap_flush(((struct inode *)inode)->i_mapping);
|
||||
@@ -512,7 +502,7 @@ xfs_flush_inode(
|
||||
xfs_inode_t *ip)
|
||||
{
|
||||
struct inode *inode = vn_to_inode(XFS_ITOV(ip));
|
||||
struct vfs *vfs = XFS_MTOVFS(ip->i_mount);
|
||||
struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
|
||||
|
||||
igrab(inode);
|
||||
xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work);
|
||||
@@ -525,7 +515,7 @@ xfs_flush_inode(
|
||||
*/
|
||||
STATIC void
|
||||
xfs_flush_device_work(
|
||||
vfs_t *vfs,
|
||||
bhv_vfs_t *vfs,
|
||||
void *inode)
|
||||
{
|
||||
sync_blockdev(vfs->vfs_super->s_bdev);
|
||||
@@ -537,7 +527,7 @@ xfs_flush_device(
|
||||
xfs_inode_t *ip)
|
||||
{
|
||||
struct inode *inode = vn_to_inode(XFS_ITOV(ip));
|
||||
struct vfs *vfs = XFS_MTOVFS(ip->i_mount);
|
||||
struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
|
||||
|
||||
igrab(inode);
|
||||
xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work);
|
||||
@@ -545,16 +535,16 @@ xfs_flush_device(
|
||||
xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
|
||||
}
|
||||
|
||||
#define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR|SYNC_REFCACHE)
|
||||
STATIC void
|
||||
vfs_sync_worker(
|
||||
vfs_t *vfsp,
|
||||
bhv_vfs_t *vfsp,
|
||||
void *unused)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!(vfsp->vfs_flag & VFS_RDONLY))
|
||||
VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error);
|
||||
error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \
|
||||
SYNC_ATTR | SYNC_REFCACHE, NULL);
|
||||
vfsp->vfs_sync_seq++;
|
||||
wmb();
|
||||
wake_up(&vfsp->vfs_wait_single_sync_task);
|
||||
@@ -565,8 +555,8 @@ xfssyncd(
|
||||
void *arg)
|
||||
{
|
||||
long timeleft;
|
||||
vfs_t *vfsp = (vfs_t *) arg;
|
||||
struct vfs_sync_work *work, *n;
|
||||
bhv_vfs_t *vfsp = (bhv_vfs_t *) arg;
|
||||
bhv_vfs_sync_work_t *work, *n;
|
||||
LIST_HEAD (tmp);
|
||||
|
||||
timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
|
||||
@@ -600,7 +590,7 @@ xfssyncd(
|
||||
list_del(&work->w_list);
|
||||
if (work == &vfsp->vfs_sync_work)
|
||||
continue;
|
||||
kmem_free(work, sizeof(struct vfs_sync_work));
|
||||
kmem_free(work, sizeof(struct bhv_vfs_sync_work));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,7 +599,7 @@ xfssyncd(
|
||||
|
||||
STATIC int
|
||||
xfs_fs_start_syncd(
|
||||
vfs_t *vfsp)
|
||||
bhv_vfs_t *vfsp)
|
||||
{
|
||||
vfsp->vfs_sync_work.w_syncer = vfs_sync_worker;
|
||||
vfsp->vfs_sync_work.w_vfs = vfsp;
|
||||
@@ -621,7 +611,7 @@ xfs_fs_start_syncd(
|
||||
|
||||
STATIC void
|
||||
xfs_fs_stop_syncd(
|
||||
vfs_t *vfsp)
|
||||
bhv_vfs_t *vfsp)
|
||||
{
|
||||
kthread_stop(vfsp->vfs_sync_task);
|
||||
}
|
||||
@@ -630,35 +620,26 @@ STATIC void
|
||||
xfs_fs_put_super(
|
||||
struct super_block *sb)
|
||||
{
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
bhv_vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
xfs_fs_stop_syncd(vfsp);
|
||||
VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error);
|
||||
if (!error)
|
||||
VFS_UNMOUNT(vfsp, 0, NULL, error);
|
||||
bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL);
|
||||
error = bhv_vfs_unmount(vfsp, 0, NULL);
|
||||
if (error) {
|
||||
printk("XFS unmount got error %d\n", error);
|
||||
printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp);
|
||||
return;
|
||||
printk("XFS: unmount got error=%d\n", error);
|
||||
printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp);
|
||||
} else {
|
||||
vfs_deallocate(vfsp);
|
||||
}
|
||||
|
||||
vfs_deallocate(vfsp);
|
||||
}
|
||||
|
||||
STATIC void
|
||||
xfs_fs_write_super(
|
||||
struct super_block *sb)
|
||||
{
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
if (sb->s_flags & MS_RDONLY) {
|
||||
sb->s_dirt = 0; /* paranoia */
|
||||
return;
|
||||
}
|
||||
/* Push the log and superblock a little */
|
||||
VFS_SYNC(vfsp, SYNC_FSDATA, NULL, error);
|
||||
if (!(sb->s_flags & MS_RDONLY))
|
||||
bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL);
|
||||
sb->s_dirt = 0;
|
||||
}
|
||||
|
||||
@@ -667,16 +648,16 @@ xfs_fs_sync_super(
|
||||
struct super_block *sb,
|
||||
int wait)
|
||||
{
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
int flags = SYNC_FSDATA;
|
||||
bhv_vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
int flags;
|
||||
|
||||
if (unlikely(sb->s_frozen == SB_FREEZE_WRITE))
|
||||
flags = SYNC_QUIESCE;
|
||||
else
|
||||
flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
|
||||
|
||||
VFS_SYNC(vfsp, flags, NULL, error);
|
||||
error = bhv_vfs_sync(vfsp, flags, NULL);
|
||||
sb->s_dirt = 0;
|
||||
|
||||
if (unlikely(laptop_mode)) {
|
||||
@@ -706,11 +687,7 @@ xfs_fs_statfs(
|
||||
struct super_block *sb,
|
||||
struct kstatfs *statp)
|
||||
{
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
VFS_STATVFS(vfsp, statp, NULL, error);
|
||||
return -error;
|
||||
return -bhv_vfs_statvfs(vfs_from_sb(sb), statp, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -719,13 +696,13 @@ xfs_fs_remount(
|
||||
int *flags,
|
||||
char *options)
|
||||
{
|
||||
vfs_t *vfsp = vfs_from_sb(sb);
|
||||
bhv_vfs_t *vfsp = vfs_from_sb(sb);
|
||||
struct xfs_mount_args *args = xfs_args_allocate(sb, 0);
|
||||
int error;
|
||||
|
||||
VFS_PARSEARGS(vfsp, options, args, 1, error);
|
||||
error = bhv_vfs_parseargs(vfsp, options, args, 1);
|
||||
if (!error)
|
||||
VFS_MNTUPDATE(vfsp, flags, args, error);
|
||||
error = bhv_vfs_mntupdate(vfsp, flags, args);
|
||||
kmem_free(args, sizeof(*args));
|
||||
return -error;
|
||||
}
|
||||
@@ -734,7 +711,7 @@ STATIC void
|
||||
xfs_fs_lockfs(
|
||||
struct super_block *sb)
|
||||
{
|
||||
VFS_FREEZE(vfs_from_sb(sb));
|
||||
bhv_vfs_freeze(vfs_from_sb(sb));
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -742,11 +719,7 @@ xfs_fs_show_options(
|
||||
struct seq_file *m,
|
||||
struct vfsmount *mnt)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(mnt->mnt_sb);
|
||||
int error;
|
||||
|
||||
VFS_SHOWARGS(vfsp, m, error);
|
||||
return error;
|
||||
return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -754,11 +727,7 @@ xfs_fs_quotasync(
|
||||
struct super_block *sb,
|
||||
int type)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
VFS_QUOTACTL(vfsp, Q_XQUOTASYNC, 0, (caddr_t)NULL, error);
|
||||
return -error;
|
||||
return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -766,11 +735,7 @@ xfs_fs_getxstate(
|
||||
struct super_block *sb,
|
||||
struct fs_quota_stat *fqs)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
VFS_QUOTACTL(vfsp, Q_XGETQSTAT, 0, (caddr_t)fqs, error);
|
||||
return -error;
|
||||
return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -779,11 +744,7 @@ xfs_fs_setxstate(
|
||||
unsigned int flags,
|
||||
int op)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(sb);
|
||||
int error;
|
||||
|
||||
VFS_QUOTACTL(vfsp, op, 0, (caddr_t)&flags, error);
|
||||
return -error;
|
||||
return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -793,13 +754,10 @@ xfs_fs_getxquota(
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(sb);
|
||||
int error, getmode;
|
||||
|
||||
getmode = (type == USRQUOTA) ? Q_XGETQUOTA :
|
||||
((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA);
|
||||
VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error);
|
||||
return -error;
|
||||
return -bhv_vfs_quotactl(vfs_from_sb(sb),
|
||||
(type == USRQUOTA) ? Q_XGETQUOTA :
|
||||
((type == GRPQUOTA) ? Q_XGETGQUOTA :
|
||||
Q_XGETPQUOTA), id, (caddr_t)fdq);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -809,13 +767,10 @@ xfs_fs_setxquota(
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
struct vfs *vfsp = vfs_from_sb(sb);
|
||||
int error, setmode;
|
||||
|
||||
setmode = (type == USRQUOTA) ? Q_XSETQLIM :
|
||||
((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM);
|
||||
VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error);
|
||||
return -error;
|
||||
return -bhv_vfs_quotactl(vfs_from_sb(sb),
|
||||
(type == USRQUOTA) ? Q_XSETQLIM :
|
||||
((type == GRPQUOTA) ? Q_XSETGQLIM :
|
||||
Q_XSETPQLIM), id, (caddr_t)fdq);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
@@ -824,34 +779,32 @@ xfs_fs_fill_super(
|
||||
void *data,
|
||||
int silent)
|
||||
{
|
||||
vnode_t *rootvp;
|
||||
struct vfs *vfsp = vfs_allocate(sb);
|
||||
struct bhv_vnode *rootvp;
|
||||
struct bhv_vfs *vfsp = vfs_allocate(sb);
|
||||
struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
|
||||
struct kstatfs statvfs;
|
||||
int error, error2;
|
||||
int error;
|
||||
|
||||
bhv_insert_all_vfsops(vfsp);
|
||||
|
||||
VFS_PARSEARGS(vfsp, (char *)data, args, 0, error);
|
||||
error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0);
|
||||
if (error) {
|
||||
bhv_remove_all_vfsops(vfsp, 1);
|
||||
goto fail_vfsop;
|
||||
}
|
||||
|
||||
sb_min_blocksize(sb, BBSIZE);
|
||||
#ifdef CONFIG_XFS_EXPORT
|
||||
sb->s_export_op = &xfs_export_operations;
|
||||
#endif
|
||||
sb->s_qcop = &xfs_quotactl_operations;
|
||||
sb->s_op = &xfs_super_operations;
|
||||
|
||||
VFS_MOUNT(vfsp, args, NULL, error);
|
||||
error = bhv_vfs_mount(vfsp, args, NULL);
|
||||
if (error) {
|
||||
bhv_remove_all_vfsops(vfsp, 1);
|
||||
goto fail_vfsop;
|
||||
}
|
||||
|
||||
VFS_STATVFS(vfsp, &statvfs, NULL, error);
|
||||
error = bhv_vfs_statvfs(vfsp, &statvfs, NULL);
|
||||
if (error)
|
||||
goto fail_unmount;
|
||||
|
||||
@@ -863,7 +816,7 @@ xfs_fs_fill_super(
|
||||
sb->s_time_gran = 1;
|
||||
set_posix_acl_flag(sb);
|
||||
|
||||
VFS_ROOT(vfsp, &rootvp, error);
|
||||
error = bhv_vfs_root(vfsp, &rootvp);
|
||||
if (error)
|
||||
goto fail_unmount;
|
||||
|
||||
@@ -892,7 +845,7 @@ fail_vnrele:
|
||||
}
|
||||
|
||||
fail_unmount:
|
||||
VFS_UNMOUNT(vfsp, 0, NULL, error2);
|
||||
bhv_vfs_unmount(vfsp, 0, NULL);
|
||||
|
||||
fail_vfsop:
|
||||
vfs_deallocate(vfsp);
|
||||
|
||||
@@ -105,7 +105,7 @@ struct block_device;
|
||||
|
||||
extern __uint64_t xfs_max_file_offset(unsigned int);
|
||||
|
||||
extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
|
||||
extern void xfs_initialize_vnode(bhv_desc_t *, bhv_vnode_t *, bhv_desc_t *, int);
|
||||
|
||||
extern void xfs_flush_inode(struct xfs_inode *);
|
||||
extern void xfs_flush_device(struct xfs_inode *);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user