提交 52ab3f3d 编写于 作者: L Linus Torvalds

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
  ...
...@@ -3191,7 +3191,7 @@ XFS FILESYSTEM ...@@ -3191,7 +3191,7 @@ XFS FILESYSTEM
P: Silicon Graphics Inc P: Silicon Graphics Inc
M: xfs-masters@oss.sgi.com M: xfs-masters@oss.sgi.com
M: nathans@sgi.com M: nathans@sgi.com
L: linux-xfs@oss.sgi.com L: xfs@oss.sgi.com
W: http://oss.sgi.com/projects/xfs W: http://oss.sgi.com/projects/xfs
S: Supported S: Supported
......
config XFS_FS config XFS_FS
tristate "XFS filesystem support" tristate "XFS filesystem support"
select EXPORTFS if NFSD!=n
help help
XFS is a high performance journaling filesystem which originated XFS is a high performance journaling filesystem which originated
on the SGI IRIX platform. It is completely multi-threaded, can on the SGI IRIX platform. It is completely multi-threaded, can
...@@ -18,11 +17,6 @@ config XFS_FS ...@@ -18,11 +17,6 @@ config XFS_FS
system of your root partition is compiled as a module, you'll need system of your root partition is compiled as a module, you'll need
to use an initial ramdisk (initrd) to boot. to use an initial ramdisk (initrd) to boot.
config XFS_EXPORT
bool
depends on XFS_FS && EXPORTFS
default y
config XFS_QUOTA config XFS_QUOTA
bool "XFS Quota support" bool "XFS Quota support"
depends on XFS_FS depends on XFS_FS
...@@ -65,18 +59,19 @@ config XFS_POSIX_ACL ...@@ -65,18 +59,19 @@ config XFS_POSIX_ACL
If you don't know what Access Control Lists are, say N. If you don't know what Access Control Lists are, say N.
config XFS_RT config XFS_RT
bool "XFS Realtime support (EXPERIMENTAL)" bool "XFS Realtime subvolume support"
depends on XFS_FS && EXPERIMENTAL depends on XFS_FS
help help
If you say Y here you will be able to mount and use XFS filesystems 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 which contain a realtime subvolume. The realtime subvolume is a
separate area of disk space where only file data is stored. The separate area of disk space where only file data is stored. It was
realtime subvolume is designed to provide very deterministic originally designed to provide deterministic data rates suitable
data rates suitable for media streaming applications. for media streaming applications, but is also useful as a generic
mechanism for ensuring data and metadata/log I/Os are completely
See the xfs man page in section 5 for a bit more information. 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.
This feature is unsupported at this time, is not yet fully See the xfs man page in section 5 for additional information.
functional, and may cause serious problems.
If unsure, say N. If unsure, say N.
...@@ -59,7 +59,6 @@ xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o ...@@ -59,7 +59,6 @@ xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
xfs-$(CONFIG_XFS_EXPORT) += $(XFS_LINUX)/xfs_export.o
xfs-y += xfs_alloc.o \ xfs-y += xfs_alloc.o \
...@@ -73,14 +72,12 @@ xfs-y += xfs_alloc.o \ ...@@ -73,14 +72,12 @@ xfs-y += xfs_alloc.o \
xfs_btree.o \ xfs_btree.o \
xfs_buf_item.o \ xfs_buf_item.o \
xfs_da_btree.o \ xfs_da_btree.o \
xfs_dir.o \
xfs_dir2.o \ xfs_dir2.o \
xfs_dir2_block.o \ xfs_dir2_block.o \
xfs_dir2_data.o \ xfs_dir2_data.o \
xfs_dir2_leaf.o \ xfs_dir2_leaf.o \
xfs_dir2_node.o \ xfs_dir2_node.o \
xfs_dir2_sf.o \ xfs_dir2_sf.o \
xfs_dir_leaf.o \
xfs_error.o \ xfs_error.o \
xfs_extfree_item.o \ xfs_extfree_item.o \
xfs_fsops.o \ xfs_fsops.o \
...@@ -117,6 +114,7 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \ ...@@ -117,6 +114,7 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
kmem.o \ kmem.o \
xfs_aops.o \ xfs_aops.o \
xfs_buf.o \ xfs_buf.o \
xfs_export.o \
xfs_file.o \ xfs_file.o \
xfs_fs_subr.o \ xfs_fs_subr.o \
xfs_globals.o \ xfs_globals.o \
......
...@@ -22,42 +22,6 @@ ...@@ -22,42 +22,6 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.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 * General memory allocation interfaces
*/ */
...@@ -83,7 +47,7 @@ kmem_flags_convert(unsigned int __nocast flags) ...@@ -83,7 +47,7 @@ kmem_flags_convert(unsigned int __nocast flags)
lflags = GFP_ATOMIC | __GFP_NOWARN; lflags = GFP_ATOMIC | __GFP_NOWARN;
} else { } else {
lflags = GFP_KERNEL | __GFP_NOWARN; lflags = GFP_KERNEL | __GFP_NOWARN;
if (PFLAGS_TEST_FSTRANS() || (flags & KM_NOFS)) if ((current->flags & PF_FSTRANS) || (flags & KM_NOFS))
lflags &= ~__GFP_FS; lflags &= ~__GFP_FS;
} }
return lflags; return lflags;
......
/* /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -28,7 +28,7 @@ typedef struct { ...@@ -28,7 +28,7 @@ typedef struct {
} mrlock_t; } mrlock_t;
#define mrinit(mrp, name) \ #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 mrlock_init(mrp, t,n,s) mrinit(mrp, n)
#define mrfree(mrp) do { } while (0) #define mrfree(mrp) do { } while (0)
#define mraccess(mrp) mraccessf(mrp, 0) #define mraccess(mrp) mraccessf(mrp, 0)
......
...@@ -34,20 +34,21 @@ typedef struct semaphore sema_t; ...@@ -34,20 +34,21 @@ typedef struct semaphore sema_t;
#define initnsema(sp, val, name) sema_init(sp, val) #define initnsema(sp, val, name) sema_init(sp, val)
#define psema(sp, b) down(sp) #define psema(sp, b) down(sp)
#define vsema(sp) up(sp) #define vsema(sp) up(sp)
#define valusema(sp) (atomic_read(&(sp)->count)) #define freesema(sema) do { } while (0)
#define freesema(sema)
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 * 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 * the return values since cpsema returns 1 (acquired) 0 (failed) and
* down_trylock returns the reverse 0 (acquired) 1 (failed). * down_trylock returns the reverse 0 (acquired) 1 (failed).
*/ */
static inline int cpsema(sema_t *sp)
#define cpsema(sp) (down_trylock(sp) ? 0 : 1) {
return 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.
*/
#endif /* __XFS_SUPPORT_SEMA_H__ */ #endif /* __XFS_SUPPORT_SEMA_H__ */
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -29,7 +28,6 @@ ...@@ -29,7 +28,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -76,7 +74,7 @@ xfs_page_trace( ...@@ -76,7 +74,7 @@ xfs_page_trace(
int mask) int mask)
{ {
xfs_inode_t *ip; 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 isize = i_size_read(inode);
loff_t offset = page_offset(page); loff_t offset = page_offset(page);
int delalloc = -1, unmapped = -1, unwritten = -1; int delalloc = -1, unmapped = -1, unwritten = -1;
...@@ -136,9 +134,10 @@ xfs_destroy_ioend( ...@@ -136,9 +134,10 @@ xfs_destroy_ioend(
for (bh = ioend->io_buffer_head; bh; bh = next) { for (bh = ioend->io_buffer_head; bh; bh = next) {
next = bh->b_private; 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); vn_iowake(ioend->io_vnode);
mempool_free(ioend, xfs_ioend_pool); mempool_free(ioend, xfs_ioend_pool);
} }
...@@ -180,13 +179,12 @@ xfs_end_bio_unwritten( ...@@ -180,13 +179,12 @@ xfs_end_bio_unwritten(
void *data) void *data)
{ {
xfs_ioend_t *ioend = 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; xfs_off_t offset = ioend->io_offset;
size_t size = ioend->io_size; size_t size = ioend->io_size;
int error;
if (ioend->io_uptodate) if (likely(!ioend->io_error))
VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error); bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL);
xfs_destroy_ioend(ioend); xfs_destroy_ioend(ioend);
} }
...@@ -211,7 +209,7 @@ xfs_alloc_ioend( ...@@ -211,7 +209,7 @@ xfs_alloc_ioend(
* all the I/O from calling the completion routine too early. * all the I/O from calling the completion routine too early.
*/ */
atomic_set(&ioend->io_remaining, 1); 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_list = NULL;
ioend->io_type = type; ioend->io_type = type;
ioend->io_vnode = vn_from_inode(inode); ioend->io_vnode = vn_from_inode(inode);
...@@ -239,10 +237,10 @@ xfs_map_blocks( ...@@ -239,10 +237,10 @@ xfs_map_blocks(
xfs_iomap_t *mapp, xfs_iomap_t *mapp,
int flags) int flags)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error, nmaps = 1; 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))) if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
VMODIFY(vp); VMODIFY(vp);
return -error; return -error;
...@@ -271,16 +269,14 @@ xfs_end_bio( ...@@ -271,16 +269,14 @@ xfs_end_bio(
if (bio->bi_size) if (bio->bi_size)
return 1; return 1;
ASSERT(ioend);
ASSERT(atomic_read(&bio->bi_cnt) >= 1); 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 */ /* 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_private = NULL;
bio->bi_end_io = NULL; bio->bi_end_io = NULL;
bio_put(bio); bio_put(bio);
xfs_finish_ioend(ioend); xfs_finish_ioend(ioend);
return 0; return 0;
} }
...@@ -1127,7 +1123,7 @@ xfs_vm_writepage( ...@@ -1127,7 +1123,7 @@ xfs_vm_writepage(
* then mark the page dirty again and leave the page * then mark the page dirty again and leave the page
* as is. * as is.
*/ */
if (PFLAGS_TEST_FSTRANS() && need_trans) if (current_test_flags(PF_FSTRANS) && need_trans)
goto out_fail; goto out_fail;
/* /*
...@@ -1158,6 +1154,18 @@ xfs_vm_writepage( ...@@ -1158,6 +1154,18 @@ xfs_vm_writepage(
return error; 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 * Called to move a page into cleanable state - and from there
* to be released. Possibly the page is already clean. We always * to be released. Possibly the page is already clean. We always
...@@ -1204,7 +1212,7 @@ xfs_vm_releasepage( ...@@ -1204,7 +1212,7 @@ xfs_vm_releasepage(
/* If we are already inside a transaction or the thread cannot /* If we are already inside a transaction or the thread cannot
* do I/O, we cannot release this page. * do I/O, we cannot release this page.
*/ */
if (PFLAGS_TEST_FSTRANS()) if (current_test_flags(PF_FSTRANS))
return 0; return 0;
/* /*
...@@ -1231,7 +1239,7 @@ __xfs_get_blocks( ...@@ -1231,7 +1239,7 @@ __xfs_get_blocks(
int direct, int direct,
bmapi_flags_t flags) bmapi_flags_t flags)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
xfs_iomap_t iomap; xfs_iomap_t iomap;
xfs_off_t offset; xfs_off_t offset;
ssize_t size; ssize_t size;
...@@ -1241,8 +1249,8 @@ __xfs_get_blocks( ...@@ -1241,8 +1249,8 @@ __xfs_get_blocks(
offset = (xfs_off_t)iblock << inode->i_blkbits; offset = (xfs_off_t)iblock << inode->i_blkbits;
ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
size = bh_result->b_size; size = bh_result->b_size;
VOP_BMAP(vp, offset, size, error = bhv_vop_bmap(vp, offset, size,
create ? flags : BMAPI_READ, &iomap, &niomap, error); create ? flags : BMAPI_READ, &iomap, &niomap);
if (error) if (error)
return -error; return -error;
if (niomap == 0) if (niomap == 0)
...@@ -1370,13 +1378,13 @@ xfs_vm_direct_IO( ...@@ -1370,13 +1378,13 @@ xfs_vm_direct_IO(
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; 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; xfs_iomap_t iomap;
int maps = 1; int maps = 1;
int error; int error;
ssize_t ret; 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) if (error)
return -error; return -error;
...@@ -1409,14 +1417,12 @@ xfs_vm_bmap( ...@@ -1409,14 +1417,12 @@ xfs_vm_bmap(
sector_t block) sector_t block)
{ {
struct inode *inode = (struct inode *)mapping->host; struct inode *inode = (struct inode *)mapping->host;
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error;
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
bhv_vop_rwlock(vp, VRWLOCK_READ);
VOP_RWLOCK(vp, VRWLOCK_READ); bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF);
VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error); bhv_vop_rwunlock(vp, VRWLOCK_READ);
VOP_RWUNLOCK(vp, VRWLOCK_READ);
return generic_block_bmap(mapping, block, xfs_get_blocks); return generic_block_bmap(mapping, block, xfs_get_blocks);
} }
...@@ -1452,6 +1458,7 @@ struct address_space_operations xfs_address_space_operations = { ...@@ -1452,6 +1458,7 @@ struct address_space_operations xfs_address_space_operations = {
.readpage = xfs_vm_readpage, .readpage = xfs_vm_readpage,
.readpages = xfs_vm_readpages, .readpages = xfs_vm_readpages,
.writepage = xfs_vm_writepage, .writepage = xfs_vm_writepage,
.writepages = xfs_vm_writepages,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.releasepage = xfs_vm_releasepage, .releasepage = xfs_vm_releasepage,
.invalidatepage = xfs_vm_invalidatepage, .invalidatepage = xfs_vm_invalidatepage,
......
/* /*
* Copyright (c) 2005 Silicon Graphics, Inc. * Copyright (c) 2005-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -30,9 +30,9 @@ typedef void (*xfs_ioend_func_t)(void *); ...@@ -30,9 +30,9 @@ typedef void (*xfs_ioend_func_t)(void *);
typedef struct xfs_ioend { typedef struct xfs_ioend {
struct xfs_ioend *io_list; /* next ioend in chain */ struct xfs_ioend *io_list; /* next ioend in chain */
unsigned int io_type; /* delalloc / unwritten */ 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 */ 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_head;/* buffer linked list head */
struct buffer_head *io_buffer_tail;/* buffer linked list tail */ struct buffer_head *io_buffer_tail;/* buffer linked list tail */
size_t io_size; /* size of the extent */ size_t io_size; /* size of the extent */
...@@ -43,4 +43,4 @@ typedef struct xfs_ioend { ...@@ -43,4 +43,4 @@ typedef struct xfs_ioend {
extern struct address_space_operations xfs_address_space_operations; extern struct address_space_operations xfs_address_space_operations;
extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); 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 @@ ...@@ -21,7 +21,6 @@
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_export.h" #include "xfs_export.h"
...@@ -97,7 +96,7 @@ xfs_fs_encode_fh( ...@@ -97,7 +96,7 @@ xfs_fs_encode_fh(
int len; int len;
int is64 = 0; int is64 = 0;
#if XFS_BIG_INUMS #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)) { if (!(vfs->vfs_flag & VFS_32BITINODES)) {
/* filesystem may contain 64bit inode numbers */ /* filesystem may contain 64bit inode numbers */
...@@ -136,13 +135,13 @@ xfs_fs_get_dentry( ...@@ -136,13 +135,13 @@ xfs_fs_get_dentry(
struct super_block *sb, struct super_block *sb,
void *data) void *data)
{ {
vnode_t *vp; bhv_vnode_t *vp;
struct inode *inode; struct inode *inode;
struct dentry *result; struct dentry *result;
vfs_t *vfsp = vfs_from_sb(sb); bhv_vfs_t *vfsp = vfs_from_sb(sb);
int error; int error;
VFS_VGET(vfsp, &vp, (fid_t *)data, error); error = bhv_vfs_vget(vfsp, &vp, (fid_t *)data);
if (error || vp == NULL) if (error || vp == NULL)
return ERR_PTR(-ESTALE) ; return ERR_PTR(-ESTALE) ;
...@@ -160,12 +159,12 @@ xfs_fs_get_parent( ...@@ -160,12 +159,12 @@ xfs_fs_get_parent(
struct dentry *child) struct dentry *child)
{ {
int error; int error;
vnode_t *vp, *cvp; bhv_vnode_t *vp, *cvp;
struct dentry *parent; struct dentry *parent;
cvp = NULL; cvp = NULL;
vp = vn_from_inode(child->d_inode); 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)) if (unlikely(error))
return ERR_PTR(-error); return ERR_PTR(-error);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
...@@ -58,15 +56,12 @@ __xfs_file_read( ...@@ -58,15 +56,12 @@ __xfs_file_read(
{ {
struct iovec iov = {buf, count}; struct iovec iov = {buf, count};
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
ssize_t rval;
BUG_ON(iocb->ki_pos != pos); BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval); return bhv_vop_read(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -100,15 +95,12 @@ __xfs_file_write( ...@@ -100,15 +95,12 @@ __xfs_file_write(
struct iovec iov = {(void __user *)buf, count}; struct iovec iov = {(void __user *)buf, count};
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
ssize_t rval;
BUG_ON(iocb->ki_pos != pos); BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
return bhv_vop_write(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -140,7 +132,7 @@ __xfs_file_readv( ...@@ -140,7 +132,7 @@ __xfs_file_readv(
loff_t *ppos) loff_t *ppos)
{ {
struct inode *inode = file->f_mapping->host; 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; struct kiocb kiocb;
ssize_t rval; ssize_t rval;
...@@ -149,7 +141,8 @@ __xfs_file_readv( ...@@ -149,7 +141,8 @@ __xfs_file_readv(
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; 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; *ppos = kiocb.ki_pos;
return rval; return rval;
...@@ -184,7 +177,7 @@ __xfs_file_writev( ...@@ -184,7 +177,7 @@ __xfs_file_writev(
loff_t *ppos) loff_t *ppos)
{ {
struct inode *inode = file->f_mapping->host; 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; struct kiocb kiocb;
ssize_t rval; ssize_t rval;
...@@ -193,7 +186,8 @@ __xfs_file_writev( ...@@ -193,7 +186,8 @@ __xfs_file_writev(
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; 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; *ppos = kiocb.ki_pos;
return rval; return rval;
...@@ -227,11 +221,8 @@ xfs_file_sendfile( ...@@ -227,11 +221,8 @@ xfs_file_sendfile(
read_actor_t actor, read_actor_t actor,
void *target) void *target)
{ {
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
ssize_t rval; filp, pos, 0, count, actor, target, NULL);
VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -242,11 +233,8 @@ xfs_file_sendfile_invis( ...@@ -242,11 +233,8 @@ xfs_file_sendfile_invis(
read_actor_t actor, read_actor_t actor,
void *target) void *target)
{ {
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
ssize_t rval; filp, pos, IO_INVIS, count, actor, target, NULL);
VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -257,11 +245,8 @@ xfs_file_splice_read( ...@@ -257,11 +245,8 @@ xfs_file_splice_read(
size_t len, size_t len,
unsigned int flags) unsigned int flags)
{ {
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
ssize_t rval; infilp, ppos, pipe, len, flags, 0, NULL);
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -272,11 +257,9 @@ xfs_file_splice_read_invis( ...@@ -272,11 +257,9 @@ xfs_file_splice_read_invis(
size_t len, size_t len,
unsigned int flags) unsigned int flags)
{ {
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
ssize_t rval; infilp, ppos, pipe, len, flags, IO_INVIS,
NULL);
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -287,11 +270,8 @@ xfs_file_splice_write( ...@@ -287,11 +270,8 @@ xfs_file_splice_write(
size_t len, size_t len,
unsigned int flags) unsigned int flags)
{ {
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
ssize_t rval; pipe, outfilp, ppos, len, flags, 0, NULL);
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval);
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -302,11 +282,9 @@ xfs_file_splice_write_invis( ...@@ -302,11 +282,9 @@ xfs_file_splice_write_invis(
size_t len, size_t len,
unsigned int flags) unsigned int flags)
{ {
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
ssize_t rval; pipe, outfilp, ppos, len, flags, IO_INVIS,
NULL);
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval);
return rval;
} }
STATIC int STATIC int
...@@ -314,13 +292,17 @@ xfs_file_open( ...@@ -314,13 +292,17 @@ xfs_file_open(
struct inode *inode, struct inode *inode,
struct file *filp) 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) if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
return -EFBIG; return -EFBIG;
VOP_OPEN(vp, NULL, error); return -bhv_vop_open(vn_from_inode(inode), NULL);
return -error; }
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 STATIC int
...@@ -328,12 +310,11 @@ xfs_file_release( ...@@ -328,12 +310,11 @@ xfs_file_release(
struct inode *inode, struct inode *inode,
struct file *filp) struct file *filp)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error = 0;
if (vp) if (vp)
VOP_RELEASE(vp, error); return -bhv_vop_release(vp);
return -error; return 0;
} }
STATIC int STATIC int
...@@ -342,15 +323,14 @@ xfs_file_fsync( ...@@ -342,15 +323,14 @@ xfs_file_fsync(
struct dentry *dentry, struct dentry *dentry,
int datasync) int datasync)
{ {
struct inode *inode = dentry->d_inode; bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
vnode_t *vp = vn_from_inode(inode);
int error;
int flags = FSYNC_WAIT; int flags = FSYNC_WAIT;
if (datasync) if (datasync)
flags |= FSYNC_DATA; flags |= FSYNC_DATA;
VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); if (VN_TRUNC(vp))
return -error; VUNTRUNCATE(vp);
return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1);
} }
#ifdef CONFIG_XFS_DMAPI #ifdef CONFIG_XFS_DMAPI
...@@ -361,16 +341,11 @@ xfs_vm_nopage( ...@@ -361,16 +341,11 @@ xfs_vm_nopage(
int *type) int *type)
{ {
struct inode *inode = area->vm_file->f_dentry->d_inode; struct inode *inode = area->vm_file->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
int error;
ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0))
error = XFS_SEND_MMAP(mp, area, 0);
if (error)
return NULL; return NULL;
return filemap_nopage(area, address, type); return filemap_nopage(area, address, type);
} }
#endif /* CONFIG_XFS_DMAPI */ #endif /* CONFIG_XFS_DMAPI */
...@@ -382,7 +357,7 @@ xfs_file_readdir( ...@@ -382,7 +357,7 @@ xfs_file_readdir(
filldir_t filldir) filldir_t filldir)
{ {
int error = 0; 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; uio_t uio;
iovec_t iov; iovec_t iov;
int eof = 0; int eof = 0;
...@@ -417,7 +392,7 @@ xfs_file_readdir( ...@@ -417,7 +392,7 @@ xfs_file_readdir(
start_offset = uio.uio_offset; 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) { if ((uio.uio_offset == start_offset) || error) {
size = 0; size = 0;
break; break;
...@@ -456,38 +431,28 @@ xfs_file_mmap( ...@@ -456,38 +431,28 @@ xfs_file_mmap(
struct file *filp, struct file *filp,
struct vm_area_struct *vma) 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; vma->vm_ops = &xfs_file_vm_ops;
#ifdef CONFIG_XFS_DMAPI #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; vma->vm_ops = &xfs_dmapi_file_vm_ops;
}
#endif /* CONFIG_XFS_DMAPI */ #endif /* CONFIG_XFS_DMAPI */
vattr.va_mask = XFS_AT_UPDATIME; file_accessed(filp);
VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error);
if (likely(!error))
__vn_revalidate(vp, &vattr); /* update flags */
return 0; return 0;
} }
STATIC long STATIC long
xfs_file_ioctl( xfs_file_ioctl(
struct file *filp, struct file *filp,
unsigned int cmd, unsigned int cmd,
unsigned long arg) unsigned long p)
{ {
int error; int error;
struct inode *inode = filp->f_dentry->d_inode; 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); VMODIFY(vp);
/* NOTE: some of the ioctl's return positive #'s as a /* NOTE: some of the ioctl's return positive #'s as a
...@@ -503,13 +468,13 @@ STATIC long ...@@ -503,13 +468,13 @@ STATIC long
xfs_file_ioctl_invis( xfs_file_ioctl_invis(
struct file *filp, struct file *filp,
unsigned int cmd, 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; 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); VMODIFY(vp);
/* NOTE: some of the ioctl's return positive #'s as a /* NOTE: some of the ioctl's return positive #'s as a
...@@ -528,7 +493,7 @@ xfs_vm_mprotect( ...@@ -528,7 +493,7 @@ xfs_vm_mprotect(
struct vm_area_struct *vma, struct vm_area_struct *vma,
unsigned int newflags) 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; int error = 0;
if (vp->v_vfsp->vfs_flag & VFS_DMI) { if (vp->v_vfsp->vfs_flag & VFS_DMI) {
...@@ -554,24 +519,19 @@ STATIC int ...@@ -554,24 +519,19 @@ STATIC int
xfs_file_open_exec( xfs_file_open_exec(
struct inode *inode) struct inode *inode)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
if (unlikely(vp->v_vfsp->vfs_flag & VFS_DMI)) {
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
int error = 0; xfs_inode_t *ip = xfs_vtoi(vp);
xfs_inode_t *ip;
if (vp->v_vfsp->vfs_flag & VFS_DMI) { if (!ip)
ip = xfs_vtoi(vp); return -EINVAL;
if (!ip) { if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ))
error = -EINVAL; return -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
goto open_exec_out;
}
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) {
error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
0, 0, 0, NULL); 0, 0, 0, NULL);
} }
} return 0;
open_exec_out:
return error;
} }
#endif /* HAVE_FOP_OPEN_EXEC */ #endif /* HAVE_FOP_OPEN_EXEC */
...@@ -592,6 +552,7 @@ const struct file_operations xfs_file_operations = { ...@@ -592,6 +552,7 @@ const struct file_operations xfs_file_operations = {
#endif #endif
.mmap = xfs_file_mmap, .mmap = xfs_file_mmap,
.open = xfs_file_open, .open = xfs_file_open,
.flush = xfs_file_close,
.release = xfs_file_release, .release = xfs_file_release,
.fsync = xfs_file_fsync, .fsync = xfs_file_fsync,
#ifdef HAVE_FOP_OPEN_EXEC #ifdef HAVE_FOP_OPEN_EXEC
...@@ -616,6 +577,7 @@ const struct file_operations xfs_invis_file_operations = { ...@@ -616,6 +577,7 @@ const struct file_operations xfs_invis_file_operations = {
#endif #endif
.mmap = xfs_file_mmap, .mmap = xfs_file_mmap,
.open = xfs_file_open, .open = xfs_file_open,
.flush = xfs_file_close,
.release = xfs_file_release, .release = xfs_file_release,
.fsync = xfs_file_fsync, .fsync = xfs_file_fsync,
}; };
......
/* /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. * Copyright (c) 2000-2002,2005-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -15,40 +15,12 @@ ...@@ -15,40 +15,12 @@
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "xfs.h" #include "xfs.h"
/* int fs_noerr(void) { return 0; }
* Stub for no-op vnode operations that return error status. int fs_nosys(void) { return ENOSYS; }
*/ void fs_noval(void) { return; }
int
fs_noerr(void)
{
return 0;
}
/*
* 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 void
fs_tosspages( fs_tosspages(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -56,18 +28,13 @@ fs_tosspages( ...@@ -56,18 +28,13 @@ fs_tosspages(
xfs_off_t last, xfs_off_t last,
int fiopt) int fiopt)
{ {
vnode_t *vp = BHV_TO_VNODE(bdp); bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp); struct inode *ip = vn_to_inode(vp);
if (VN_CACHED(vp)) if (VN_CACHED(vp))
truncate_inode_pages(ip->i_mapping, first); truncate_inode_pages(ip->i_mapping, first);
} }
/*
* vnode pcache layer for vnode_flushinval_pages.
* 'last' parameter unused but left in for IRIX compatibility
*/
void void
fs_flushinval_pages( fs_flushinval_pages(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -75,20 +42,17 @@ fs_flushinval_pages( ...@@ -75,20 +42,17 @@ fs_flushinval_pages(
xfs_off_t last, xfs_off_t last,
int fiopt) int fiopt)
{ {
vnode_t *vp = BHV_TO_VNODE(bdp); bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp); struct inode *ip = vn_to_inode(vp);
if (VN_CACHED(vp)) { if (VN_CACHED(vp)) {
if (VN_TRUNC(vp))
VUNTRUNCATE(vp);
filemap_write_and_wait(ip->i_mapping); filemap_write_and_wait(ip->i_mapping);
truncate_inode_pages(ip->i_mapping, first); truncate_inode_pages(ip->i_mapping, first);
} }
} }
/*
* vnode pcache layer for vnode_flush_pages.
* 'last' parameter unused but left in for IRIX compatibility
*/
int int
fs_flush_pages( fs_flush_pages(
bhv_desc_t *bdp, bhv_desc_t *bdp,
...@@ -97,15 +61,16 @@ fs_flush_pages( ...@@ -97,15 +61,16 @@ fs_flush_pages(
uint64_t flags, uint64_t flags,
int fiopt) int fiopt)
{ {
vnode_t *vp = BHV_TO_VNODE(bdp); bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp); 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); filemap_fdatawrite(ip->i_mapping);
if (flags & XFS_B_ASYNC) if (flags & XFS_B_ASYNC)
return 0; return 0;
filemap_fdatawait(ip->i_mapping); filemap_fdatawait(ip->i_mapping);
} }
return 0; return 0;
} }
...@@ -45,6 +45,7 @@ xfs_param_t xfs_params = { ...@@ -45,6 +45,7 @@ xfs_param_t xfs_params = {
.xfs_buf_age = { 1*100, 15*100, 7200*100}, .xfs_buf_age = { 1*100, 15*100, 7200*100},
.inherit_nosym = { 0, 0, 1 }, .inherit_nosym = { 0, 0, 1 },
.rotorstep = { 1, 1, 255 }, .rotorstep = { 1, 1, 255 },
.inherit_nodfrg = { 0, 1, 1 },
}; };
/* /*
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -78,7 +76,7 @@ xfs_find_handle( ...@@ -78,7 +76,7 @@ xfs_find_handle(
xfs_handle_t handle; xfs_handle_t handle;
xfs_fsop_handlereq_t hreq; xfs_fsop_handlereq_t hreq;
struct inode *inode; struct inode *inode;
struct vnode *vp; bhv_vnode_t *vp;
if (copy_from_user(&hreq, arg, sizeof(hreq))) if (copy_from_user(&hreq, arg, sizeof(hreq)))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
...@@ -192,7 +190,7 @@ xfs_vget_fsop_handlereq( ...@@ -192,7 +190,7 @@ xfs_vget_fsop_handlereq(
xfs_mount_t *mp, xfs_mount_t *mp,
struct inode *parinode, /* parent inode pointer */ struct inode *parinode, /* parent inode pointer */
xfs_fsop_handlereq_t *hreq, xfs_fsop_handlereq_t *hreq,
vnode_t **vp, bhv_vnode_t **vp,
struct inode **inode) struct inode **inode)
{ {
void __user *hanp; void __user *hanp;
...@@ -202,7 +200,7 @@ xfs_vget_fsop_handlereq( ...@@ -202,7 +200,7 @@ xfs_vget_fsop_handlereq(
xfs_handle_t handle; xfs_handle_t handle;
xfs_inode_t *ip; xfs_inode_t *ip;
struct inode *inodep; struct inode *inodep;
vnode_t *vpp; bhv_vnode_t *vpp;
xfs_ino_t ino; xfs_ino_t ino;
__u32 igen; __u32 igen;
int error; int error;
...@@ -277,7 +275,7 @@ xfs_open_by_handle( ...@@ -277,7 +275,7 @@ xfs_open_by_handle(
struct file *filp; struct file *filp;
struct inode *inode; struct inode *inode;
struct dentry *dentry; struct dentry *dentry;
vnode_t *vp; bhv_vnode_t *vp;
xfs_fsop_handlereq_t hreq; xfs_fsop_handlereq_t hreq;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -362,7 +360,7 @@ xfs_readlink_by_handle( ...@@ -362,7 +360,7 @@ xfs_readlink_by_handle(
struct uio auio; struct uio auio;
struct inode *inode; struct inode *inode;
xfs_fsop_handlereq_t hreq; xfs_fsop_handlereq_t hreq;
vnode_t *vp; bhv_vnode_t *vp;
__u32 olen; __u32 olen;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -393,9 +391,11 @@ xfs_readlink_by_handle( ...@@ -393,9 +391,11 @@ xfs_readlink_by_handle(
auio.uio_segflg = UIO_USERSPACE; auio.uio_segflg = UIO_USERSPACE;
auio.uio_resid = olen; auio.uio_resid = olen;
VOP_READLINK(vp, &auio, IO_INVIS, NULL, error); error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL);
VN_RELE(vp); VN_RELE(vp);
if (error)
return -error;
return (olen - auio.uio_resid); return (olen - auio.uio_resid);
} }
...@@ -411,7 +411,7 @@ xfs_fssetdm_by_handle( ...@@ -411,7 +411,7 @@ xfs_fssetdm_by_handle(
xfs_fsop_setdm_handlereq_t dmhreq; xfs_fsop_setdm_handlereq_t dmhreq;
struct inode *inode; struct inode *inode;
bhv_desc_t *bdp; bhv_desc_t *bdp;
vnode_t *vp; bhv_vnode_t *vp;
if (!capable(CAP_MKNOD)) if (!capable(CAP_MKNOD))
return -XFS_ERROR(EPERM); return -XFS_ERROR(EPERM);
...@@ -452,7 +452,7 @@ xfs_attrlist_by_handle( ...@@ -452,7 +452,7 @@ xfs_attrlist_by_handle(
attrlist_cursor_kern_t *cursor; attrlist_cursor_kern_t *cursor;
xfs_fsop_attrlist_handlereq_t al_hreq; xfs_fsop_attrlist_handlereq_t al_hreq;
struct inode *inode; struct inode *inode;
vnode_t *vp; bhv_vnode_t *vp;
char *kbuf; char *kbuf;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -472,8 +472,8 @@ xfs_attrlist_by_handle( ...@@ -472,8 +472,8 @@ xfs_attrlist_by_handle(
goto out_vn_rele; goto out_vn_rele;
cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
VOP_ATTR_LIST(vp, kbuf, al_hreq.buflen, al_hreq.flags, error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags,
cursor, NULL, error); cursor, NULL);
if (error) if (error)
goto out_kfree; goto out_kfree;
...@@ -490,7 +490,7 @@ xfs_attrlist_by_handle( ...@@ -490,7 +490,7 @@ xfs_attrlist_by_handle(
STATIC int STATIC int
xfs_attrmulti_attr_get( xfs_attrmulti_attr_get(
struct vnode *vp, bhv_vnode_t *vp,
char *name, char *name,
char __user *ubuf, char __user *ubuf,
__uint32_t *len, __uint32_t *len,
...@@ -505,7 +505,7 @@ xfs_attrmulti_attr_get( ...@@ -505,7 +505,7 @@ xfs_attrmulti_attr_get(
if (!kbuf) if (!kbuf)
return ENOMEM; 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) if (error)
goto out_kfree; goto out_kfree;
...@@ -519,7 +519,7 @@ xfs_attrmulti_attr_get( ...@@ -519,7 +519,7 @@ xfs_attrmulti_attr_get(
STATIC int STATIC int
xfs_attrmulti_attr_set( xfs_attrmulti_attr_set(
struct vnode *vp, bhv_vnode_t *vp,
char *name, char *name,
const char __user *ubuf, const char __user *ubuf,
__uint32_t len, __uint32_t len,
...@@ -542,7 +542,7 @@ xfs_attrmulti_attr_set( ...@@ -542,7 +542,7 @@ xfs_attrmulti_attr_set(
if (copy_from_user(kbuf, ubuf, len)) if (copy_from_user(kbuf, ubuf, len))
goto out_kfree; 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: out_kfree:
kfree(kbuf); kfree(kbuf);
...@@ -551,20 +551,15 @@ xfs_attrmulti_attr_set( ...@@ -551,20 +551,15 @@ xfs_attrmulti_attr_set(
STATIC int STATIC int
xfs_attrmulti_attr_remove( xfs_attrmulti_attr_remove(
struct vnode *vp, bhv_vnode_t *vp,
char *name, char *name,
__uint32_t flags) __uint32_t flags)
{ {
int error;
if (IS_RDONLY(&vp->v_inode)) if (IS_RDONLY(&vp->v_inode))
return -EROFS; return -EROFS;
if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
return EPERM; return EPERM;
return bhv_vop_attr_remove(vp, name, flags, NULL);
VOP_ATTR_REMOVE(vp, name, flags, NULL, error);
return error;
} }
STATIC int STATIC int
...@@ -578,7 +573,7 @@ xfs_attrmulti_by_handle( ...@@ -578,7 +573,7 @@ xfs_attrmulti_by_handle(
xfs_attr_multiop_t *ops; xfs_attr_multiop_t *ops;
xfs_fsop_attrmulti_handlereq_t am_hreq; xfs_fsop_attrmulti_handlereq_t am_hreq;
struct inode *inode; struct inode *inode;
vnode_t *vp; bhv_vnode_t *vp;
unsigned int i, size; unsigned int i, size;
char *attr_name; char *attr_name;
...@@ -658,7 +653,7 @@ xfs_attrmulti_by_handle( ...@@ -658,7 +653,7 @@ xfs_attrmulti_by_handle(
STATIC int STATIC int
xfs_ioc_space( xfs_ioc_space(
bhv_desc_t *bdp, bhv_desc_t *bdp,
vnode_t *vp, bhv_vnode_t *vp,
struct file *filp, struct file *filp,
int flags, int flags,
unsigned int cmd, unsigned int cmd,
...@@ -682,7 +677,7 @@ xfs_ioc_fsgeometry( ...@@ -682,7 +677,7 @@ xfs_ioc_fsgeometry(
STATIC int STATIC int
xfs_ioc_xattr( xfs_ioc_xattr(
vnode_t *vp, bhv_vnode_t *vp,
xfs_inode_t *ip, xfs_inode_t *ip,
struct file *filp, struct file *filp,
unsigned int cmd, unsigned int cmd,
...@@ -711,7 +706,7 @@ xfs_ioctl( ...@@ -711,7 +706,7 @@ xfs_ioctl(
void __user *arg) void __user *arg)
{ {
int error; int error;
vnode_t *vp; bhv_vnode_t *vp;
xfs_inode_t *ip; xfs_inode_t *ip;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -962,7 +957,7 @@ xfs_ioctl( ...@@ -962,7 +957,7 @@ xfs_ioctl(
STATIC int STATIC int
xfs_ioc_space( xfs_ioc_space(
bhv_desc_t *bdp, bhv_desc_t *bdp,
vnode_t *vp, bhv_vnode_t *vp,
struct file *filp, struct file *filp,
int ioflags, int ioflags,
unsigned int cmd, unsigned int cmd,
...@@ -1153,14 +1148,14 @@ xfs_di2lxflags( ...@@ -1153,14 +1148,14 @@ xfs_di2lxflags(
STATIC int STATIC int
xfs_ioc_xattr( xfs_ioc_xattr(
vnode_t *vp, bhv_vnode_t *vp,
xfs_inode_t *ip, xfs_inode_t *ip,
struct file *filp, struct file *filp,
unsigned int cmd, unsigned int cmd,
void __user *arg) void __user *arg)
{ {
struct fsxattr fa; struct fsxattr fa;
struct vattr *vattr; struct bhv_vattr *vattr;
int error = 0; int error = 0;
int attr_flags; int attr_flags;
unsigned int flags; unsigned int flags;
...@@ -1173,7 +1168,7 @@ xfs_ioc_xattr( ...@@ -1173,7 +1168,7 @@ xfs_ioc_xattr(
case XFS_IOC_FSGETXATTR: { case XFS_IOC_FSGETXATTR: {
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
XFS_AT_NEXTENTS | XFS_AT_PROJID; XFS_AT_NEXTENTS | XFS_AT_PROJID;
VOP_GETATTR(vp, vattr, 0, NULL, error); error = bhv_vop_getattr(vp, vattr, 0, NULL);
if (unlikely(error)) { if (unlikely(error)) {
error = -error; error = -error;
break; break;
...@@ -1206,7 +1201,7 @@ xfs_ioc_xattr( ...@@ -1206,7 +1201,7 @@ xfs_ioc_xattr(
vattr->va_extsize = fa.fsx_extsize; vattr->va_extsize = fa.fsx_extsize;
vattr->va_projid = fa.fsx_projid; 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)) if (likely(!error))
__vn_revalidate(vp, vattr); /* update flags */ __vn_revalidate(vp, vattr); /* update flags */
error = -error; error = -error;
...@@ -1216,7 +1211,7 @@ xfs_ioc_xattr( ...@@ -1216,7 +1211,7 @@ xfs_ioc_xattr(
case XFS_IOC_FSGETXATTRA: { case XFS_IOC_FSGETXATTRA: {
vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
XFS_AT_ANEXTENTS | XFS_AT_PROJID; XFS_AT_ANEXTENTS | XFS_AT_PROJID;
VOP_GETATTR(vp, vattr, 0, NULL, error); error = bhv_vop_getattr(vp, vattr, 0, NULL);
if (unlikely(error)) { if (unlikely(error)) {
error = -error; error = -error;
break; break;
...@@ -1262,7 +1257,7 @@ xfs_ioc_xattr( ...@@ -1262,7 +1257,7 @@ xfs_ioc_xattr(
vattr->va_xflags = xfs_merge_ioc_xflags(flags, vattr->va_xflags = xfs_merge_ioc_xflags(flags,
xfs_ip2xflags(ip)); xfs_ip2xflags(ip));
VOP_SETATTR(vp, vattr, attr_flags, NULL, error); error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
if (likely(!error)) if (likely(!error))
__vn_revalidate(vp, vattr); /* update flags */ __vn_revalidate(vp, vattr); /* update flags */
error = -error; error = -error;
......
...@@ -114,7 +114,7 @@ xfs_compat_ioctl( ...@@ -114,7 +114,7 @@ xfs_compat_ioctl(
unsigned long arg) unsigned long arg)
{ {
struct inode *inode = file->f_dentry->d_inode; 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; int error;
switch (cmd) { switch (cmd) {
...@@ -193,7 +193,7 @@ xfs_compat_ioctl( ...@@ -193,7 +193,7 @@ xfs_compat_ioctl(
return -ENOIOCTLCMD; 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); VMODIFY(vp);
return error; return error;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -61,7 +59,7 @@ ...@@ -61,7 +59,7 @@
*/ */
xfs_inode_t * xfs_inode_t *
xfs_vtoi( xfs_vtoi(
struct vnode *vp) bhv_vnode_t *vp)
{ {
bhv_desc_t *bdp; bhv_desc_t *bdp;
...@@ -80,7 +78,7 @@ void ...@@ -80,7 +78,7 @@ void
xfs_synchronize_atime( xfs_synchronize_atime(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
vnode_t *vp; bhv_vnode_t *vp;
vp = XFS_ITOV_NULL(ip); vp = XFS_ITOV_NULL(ip);
if (vp) { if (vp) {
...@@ -200,14 +198,10 @@ xfs_ichgtime_fast( ...@@ -200,14 +198,10 @@ xfs_ichgtime_fast(
STATIC void STATIC void
xfs_validate_fields( xfs_validate_fields(
struct inode *ip, 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; vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
VOP_GETATTR(vp, vattr, ATTR_LAZY, NULL, error); if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) {
if (likely(!error)) {
ip->i_nlink = vattr->va_nlink; ip->i_nlink = vattr->va_nlink;
ip->i_blocks = vattr->va_nblocks; ip->i_blocks = vattr->va_nblocks;
...@@ -225,7 +219,7 @@ xfs_validate_fields( ...@@ -225,7 +219,7 @@ xfs_validate_fields(
*/ */
STATIC int STATIC int
xfs_init_security( xfs_init_security(
struct vnode *vp, bhv_vnode_t *vp,
struct inode *dir) struct inode *dir)
{ {
struct inode *ip = vn_to_inode(vp); struct inode *ip = vn_to_inode(vp);
...@@ -241,7 +235,7 @@ xfs_init_security( ...@@ -241,7 +235,7 @@ xfs_init_security(
return -error; 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) if (!error)
VMODIFY(vp); VMODIFY(vp);
...@@ -264,13 +258,12 @@ xfs_has_fs_struct(struct task_struct *task) ...@@ -264,13 +258,12 @@ xfs_has_fs_struct(struct task_struct *task)
STATIC inline void STATIC inline void
xfs_cleanup_inode( xfs_cleanup_inode(
vnode_t *dvp, bhv_vnode_t *dvp,
vnode_t *vp, bhv_vnode_t *vp,
struct dentry *dentry, struct dentry *dentry,
int mode) int mode)
{ {
struct dentry teardown = {}; struct dentry teardown = {};
int error;
/* Oh, the horror. /* Oh, the horror.
* If we can't add the ACL or we fail in * If we can't add the ACL or we fail in
...@@ -281,9 +274,9 @@ xfs_cleanup_inode( ...@@ -281,9 +274,9 @@ xfs_cleanup_inode(
teardown.d_name = dentry->d_name; teardown.d_name = dentry->d_name;
if (S_ISDIR(mode)) if (S_ISDIR(mode))
VOP_RMDIR(dvp, &teardown, NULL, error); bhv_vop_rmdir(dvp, &teardown, NULL);
else else
VOP_REMOVE(dvp, &teardown, NULL, error); bhv_vop_remove(dvp, &teardown, NULL);
VN_RELE(vp); VN_RELE(vp);
} }
...@@ -295,8 +288,8 @@ xfs_vn_mknod( ...@@ -295,8 +288,8 @@ xfs_vn_mknod(
dev_t rdev) dev_t rdev)
{ {
struct inode *ip; struct inode *ip;
vattr_t vattr = { 0 }; bhv_vattr_t vattr = { 0 };
vnode_t *vp = NULL, *dvp = vn_from_inode(dir); bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
xfs_acl_t *default_acl = NULL; xfs_acl_t *default_acl = NULL;
attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
int error; int error;
...@@ -330,10 +323,10 @@ xfs_vn_mknod( ...@@ -330,10 +323,10 @@ xfs_vn_mknod(
vattr.va_mask |= XFS_AT_RDEV; vattr.va_mask |= XFS_AT_RDEV;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case S_IFREG: case S_IFREG:
VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error); error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL);
break; break;
case S_IFDIR: case S_IFDIR:
VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error); error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL);
break; break;
default: default:
error = EINVAL; error = EINVAL;
...@@ -396,14 +389,14 @@ xfs_vn_lookup( ...@@ -396,14 +389,14 @@ xfs_vn_lookup(
struct dentry *dentry, struct dentry *dentry,
struct nameidata *nd) struct nameidata *nd)
{ {
struct vnode *vp = vn_from_inode(dir), *cvp; bhv_vnode_t *vp = vn_from_inode(dir), *cvp;
int error; int error;
if (dentry->d_name.len >= MAXNAMELEN) if (dentry->d_name.len >= MAXNAMELEN)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error); error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL);
if (error) { if (unlikely(error)) {
if (unlikely(error != ENOENT)) if (unlikely(error != ENOENT))
return ERR_PTR(-error); return ERR_PTR(-error);
d_add(dentry, NULL); d_add(dentry, NULL);
...@@ -420,9 +413,9 @@ xfs_vn_link( ...@@ -420,9 +413,9 @@ xfs_vn_link(
struct dentry *dentry) struct dentry *dentry)
{ {
struct inode *ip; /* inode of guy being linked to */ struct inode *ip; /* inode of guy being linked to */
vnode_t *tdvp; /* target directory for new name/link */ bhv_vnode_t *tdvp; /* target directory for new name/link */
vnode_t *vp; /* vp of name being linked */ bhv_vnode_t *vp; /* vp of name being linked */
vattr_t vattr; bhv_vattr_t vattr;
int error; int error;
ip = old_dentry->d_inode; /* inode being linked to */ ip = old_dentry->d_inode; /* inode being linked to */
...@@ -432,7 +425,7 @@ xfs_vn_link( ...@@ -432,7 +425,7 @@ xfs_vn_link(
tdvp = vn_from_inode(dir); tdvp = vn_from_inode(dir);
vp = vn_from_inode(ip); vp = vn_from_inode(ip);
VOP_LINK(tdvp, vp, dentry, NULL, error); error = bhv_vop_link(tdvp, vp, dentry, NULL);
if (likely(!error)) { if (likely(!error)) {
VMODIFY(tdvp); VMODIFY(tdvp);
VN_HOLD(vp); VN_HOLD(vp);
...@@ -448,14 +441,14 @@ xfs_vn_unlink( ...@@ -448,14 +441,14 @@ xfs_vn_unlink(
struct dentry *dentry) struct dentry *dentry)
{ {
struct inode *inode; struct inode *inode;
vnode_t *dvp; /* directory containing name to remove */ bhv_vnode_t *dvp; /* directory containing name to remove */
vattr_t vattr; bhv_vattr_t vattr;
int error; int error;
inode = dentry->d_inode; inode = dentry->d_inode;
dvp = vn_from_inode(dir); dvp = vn_from_inode(dir);
VOP_REMOVE(dvp, dentry, NULL, error); error = bhv_vop_remove(dvp, dentry, NULL);
if (likely(!error)) { if (likely(!error)) {
xfs_validate_fields(dir, &vattr); /* size needs update */ xfs_validate_fields(dir, &vattr); /* size needs update */
xfs_validate_fields(inode, &vattr); xfs_validate_fields(inode, &vattr);
...@@ -470,27 +463,26 @@ xfs_vn_symlink( ...@@ -470,27 +463,26 @@ xfs_vn_symlink(
const char *symname) const char *symname)
{ {
struct inode *ip; struct inode *ip;
vattr_t vattr = { 0 }; bhv_vattr_t va = { 0 };
vnode_t *dvp; /* directory containing name of symlink */ bhv_vnode_t *dvp; /* directory containing name of symlink */
vnode_t *cvp; /* used to lookup symlink to put in dentry */ bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */
int error; int error;
dvp = vn_from_inode(dir); dvp = vn_from_inode(dir);
cvp = NULL; cvp = NULL;
vattr.va_mode = S_IFLNK | va.va_mode = S_IFLNK |
(irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); (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; error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &cvp, NULL);
VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error);
if (likely(!error && cvp)) { if (likely(!error && cvp)) {
error = xfs_init_security(cvp, dir); error = xfs_init_security(cvp, dir);
if (likely(!error)) { if (likely(!error)) {
ip = vn_to_inode(cvp); ip = vn_to_inode(cvp);
d_instantiate(dentry, ip); d_instantiate(dentry, ip);
xfs_validate_fields(dir, &vattr); xfs_validate_fields(dir, &va);
xfs_validate_fields(ip, &vattr); xfs_validate_fields(ip, &va);
} else { } else {
xfs_cleanup_inode(dvp, cvp, dentry, 0); xfs_cleanup_inode(dvp, cvp, dentry, 0);
} }
...@@ -504,11 +496,11 @@ xfs_vn_rmdir( ...@@ -504,11 +496,11 @@ xfs_vn_rmdir(
struct dentry *dentry) struct dentry *dentry)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
vnode_t *dvp = vn_from_inode(dir); bhv_vnode_t *dvp = vn_from_inode(dir);
vattr_t vattr; bhv_vattr_t vattr;
int error; int error;
VOP_RMDIR(dvp, dentry, NULL, error); error = bhv_vop_rmdir(dvp, dentry, NULL);
if (likely(!error)) { if (likely(!error)) {
xfs_validate_fields(inode, &vattr); xfs_validate_fields(inode, &vattr);
xfs_validate_fields(dir, &vattr); xfs_validate_fields(dir, &vattr);
...@@ -524,15 +516,15 @@ xfs_vn_rename( ...@@ -524,15 +516,15 @@ xfs_vn_rename(
struct dentry *ndentry) struct dentry *ndentry)
{ {
struct inode *new_inode = ndentry->d_inode; struct inode *new_inode = ndentry->d_inode;
vnode_t *fvp; /* from directory */ bhv_vnode_t *fvp; /* from directory */
vnode_t *tvp; /* target directory */ bhv_vnode_t *tvp; /* target directory */
vattr_t vattr; bhv_vattr_t vattr;
int error; int error;
fvp = vn_from_inode(odir); fvp = vn_from_inode(odir);
tvp = vn_from_inode(ndir); 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 (likely(!error)) {
if (new_inode) if (new_inode)
xfs_validate_fields(new_inode, &vattr); xfs_validate_fields(new_inode, &vattr);
...@@ -553,7 +545,7 @@ xfs_vn_follow_link( ...@@ -553,7 +545,7 @@ xfs_vn_follow_link(
struct dentry *dentry, struct dentry *dentry,
struct nameidata *nd) struct nameidata *nd)
{ {
vnode_t *vp; bhv_vnode_t *vp;
uio_t *uio; uio_t *uio;
iovec_t iov; iovec_t iov;
int error; int error;
...@@ -586,8 +578,8 @@ xfs_vn_follow_link( ...@@ -586,8 +578,8 @@ xfs_vn_follow_link(
uio->uio_resid = MAXPATHLEN; uio->uio_resid = MAXPATHLEN;
uio->uio_iovcnt = 1; uio->uio_iovcnt = 1;
VOP_READLINK(vp, uio, 0, NULL, error); error = bhv_vop_readlink(vp, uio, 0, NULL);
if (error) { if (unlikely(error)) {
kfree(link); kfree(link);
link = ERR_PTR(-error); link = ERR_PTR(-error);
} else { } else {
...@@ -618,12 +610,7 @@ xfs_vn_permission( ...@@ -618,12 +610,7 @@ xfs_vn_permission(
int mode, int mode,
struct nameidata *nd) struct nameidata *nd)
{ {
vnode_t *vp = vn_from_inode(inode); return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL);
int error;
mode <<= 6; /* convert from linux to vnode access bits */
VOP_ACCESS(vp, mode, NULL, error);
return -error;
} }
#else #else
#define xfs_vn_permission NULL #define xfs_vn_permission NULL
...@@ -636,14 +623,14 @@ xfs_vn_getattr( ...@@ -636,14 +623,14 @@ xfs_vn_getattr(
struct kstat *stat) struct kstat *stat)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error = 0; int error = 0;
if (unlikely(vp->v_flag & VMODIFIED)) if (unlikely(vp->v_flag & VMODIFIED))
error = vn_revalidate(vp); error = vn_revalidate(vp);
if (!error) if (!error)
generic_fillattr(inode, stat); generic_fillattr(inode, stat);
return 0; return -error;
} }
STATIC int STATIC int
...@@ -653,8 +640,8 @@ xfs_vn_setattr( ...@@ -653,8 +640,8 @@ xfs_vn_setattr(
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
vattr_t vattr = { 0 }; bhv_vattr_t vattr = { 0 };
int flags = 0; int flags = 0;
int error; int error;
...@@ -697,7 +684,7 @@ xfs_vn_setattr( ...@@ -697,7 +684,7 @@ xfs_vn_setattr(
flags |= ATTR_NONBLOCK; flags |= ATTR_NONBLOCK;
#endif #endif
VOP_SETATTR(vp, &vattr, flags, NULL, error); error = bhv_vop_setattr(vp, &vattr, flags, NULL);
if (likely(!error)) if (likely(!error))
__vn_revalidate(vp, &vattr); __vn_revalidate(vp, &vattr);
return -error; return -error;
...@@ -718,7 +705,7 @@ xfs_vn_setxattr( ...@@ -718,7 +705,7 @@ xfs_vn_setxattr(
size_t size, size_t size,
int flags) 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; char *attr = (char *)name;
attrnames_t *namesp; attrnames_t *namesp;
int xflags = 0; int xflags = 0;
...@@ -748,7 +735,7 @@ xfs_vn_getxattr( ...@@ -748,7 +735,7 @@ xfs_vn_getxattr(
void *data, void *data,
size_t size) 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; char *attr = (char *)name;
attrnames_t *namesp; attrnames_t *namesp;
int xflags = 0; int xflags = 0;
...@@ -777,7 +764,7 @@ xfs_vn_listxattr( ...@@ -777,7 +764,7 @@ xfs_vn_listxattr(
char *data, char *data,
size_t size) 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; int error, xflags = ATTR_KERNAMELS;
ssize_t result; ssize_t result;
...@@ -796,7 +783,7 @@ xfs_vn_removexattr( ...@@ -796,7 +783,7 @@ xfs_vn_removexattr(
struct dentry *dentry, struct dentry *dentry,
const char *name) 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; char *attr = (char *)name;
attrnames_t *namesp; attrnames_t *namesp;
int xflags = 0; int xflags = 0;
......
...@@ -134,14 +134,21 @@ BUFFER_FNS(PrivateStart, unwritten); ...@@ -134,14 +134,21 @@ BUFFER_FNS(PrivateStart, unwritten);
#define xfs_buf_age_centisecs xfs_params.xfs_buf_age.val #define xfs_buf_age_centisecs xfs_params.xfs_buf_age.val
#define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val
#define xfs_rotorstep xfs_params.rotorstep.val #define xfs_rotorstep xfs_params.rotorstep.val
#define xfs_inherit_nodefrag xfs_params.inherit_nodfrg.val
#ifndef raw_smp_processor_id #define current_cpu() (raw_smp_processor_id())
#define raw_smp_processor_id() smp_processor_id()
#endif
#define current_cpu() raw_smp_processor_id()
#define current_pid() (current->pid) #define current_pid() (current->pid)
#define current_fsuid(cred) (current->fsuid) #define current_fsuid(cred) (current->fsuid)
#define current_fsgid(cred) (current->fsgid) #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 NBPP PAGE_SIZE
#define DPPSHFT (PAGE_SHIFT - 9) #define DPPSHFT (PAGE_SHIFT - 9)
...@@ -187,25 +194,9 @@ BUFFER_FNS(PrivateStart, unwritten); ...@@ -187,25 +194,9 @@ BUFFER_FNS(PrivateStart, unwritten);
/* bytes to clicks */ /* bytes to clicks */
#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
#ifndef ENOATTR
#define ENOATTR ENODATA /* Attribute not found */ #define ENOATTR ENODATA /* Attribute not found */
#endif
/* Note: EWRONGFS never visible outside the kernel */
#define EWRONGFS EINVAL /* Mount with wrong filesystem type */ #define EWRONGFS EINVAL /* Mount with wrong filesystem type */
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
/*
* 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 SYNCHRONIZE() barrier() #define SYNCHRONIZE() barrier()
#define __return_address __builtin_return_address(0) #define __return_address __builtin_return_address(0)
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -206,7 +204,7 @@ xfs_read( ...@@ -206,7 +204,7 @@ xfs_read(
xfs_fsize_t n; xfs_fsize_t n;
xfs_inode_t *ip; xfs_inode_t *ip;
xfs_mount_t *mp; xfs_mount_t *mp;
vnode_t *vp; bhv_vnode_t *vp;
unsigned long seg; unsigned long seg;
ip = XFS_BHVTOI(bdp); ip = XFS_BHVTOI(bdp);
...@@ -258,7 +256,7 @@ xfs_read( ...@@ -258,7 +256,7 @@ xfs_read(
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
!(ioflags & IO_INVIS)) { !(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); int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, ret = -XFS_SEND_DATA(mp, DM_EVENT_READ,
...@@ -271,7 +269,7 @@ xfs_read( ...@@ -271,7 +269,7 @@ xfs_read(
} }
if (unlikely((ioflags & IO_ISDIRECT) && VN_CACHED(vp))) 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); -1, FI_REMAPF_LOCKED);
xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
...@@ -313,7 +311,7 @@ xfs_sendfile( ...@@ -313,7 +311,7 @@ xfs_sendfile(
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) && if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
(!(ioflags & IO_INVIS))) { (!(ioflags & IO_INVIS))) {
vrwlock_t locktype = VRWLOCK_READ; bhv_vrwlock_t locktype = VRWLOCK_READ;
int error; int error;
error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
...@@ -357,7 +355,7 @@ xfs_splice_read( ...@@ -357,7 +355,7 @@ xfs_splice_read(
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) && if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
(!(ioflags & IO_INVIS))) { (!(ioflags & IO_INVIS))) {
vrwlock_t locktype = VRWLOCK_READ; bhv_vrwlock_t locktype = VRWLOCK_READ;
int error; int error;
error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp),
...@@ -401,7 +399,7 @@ xfs_splice_write( ...@@ -401,7 +399,7 @@ xfs_splice_write(
if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) && if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) &&
(!(ioflags & IO_INVIS))) { (!(ioflags & IO_INVIS))) {
vrwlock_t locktype = VRWLOCK_WRITE; bhv_vrwlock_t locktype = VRWLOCK_WRITE;
int error; int error;
error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp), error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp),
...@@ -458,7 +456,7 @@ xfs_zero_last_block( ...@@ -458,7 +456,7 @@ xfs_zero_last_block(
last_fsb = XFS_B_TO_FSBT(mp, isize); last_fsb = XFS_B_TO_FSBT(mp, isize);
nimaps = 1; nimaps = 1;
error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap, error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap,
&nimaps, NULL); &nimaps, NULL, NULL);
if (error) { if (error) {
return error; return error;
} }
...@@ -499,7 +497,7 @@ xfs_zero_last_block( ...@@ -499,7 +497,7 @@ xfs_zero_last_block(
int /* error (positive) */ int /* error (positive) */
xfs_zero_eof( xfs_zero_eof(
vnode_t *vp, bhv_vnode_t *vp,
xfs_iocore_t *io, xfs_iocore_t *io,
xfs_off_t offset, /* starting I/O offset */ xfs_off_t offset, /* starting I/O offset */
xfs_fsize_t isize, /* current inode size */ xfs_fsize_t isize, /* current inode size */
...@@ -510,7 +508,6 @@ xfs_zero_eof( ...@@ -510,7 +508,6 @@ xfs_zero_eof(
xfs_fileoff_t end_zero_fsb; xfs_fileoff_t end_zero_fsb;
xfs_fileoff_t zero_count_fsb; xfs_fileoff_t zero_count_fsb;
xfs_fileoff_t last_fsb; xfs_fileoff_t last_fsb;
xfs_extlen_t buf_len_fsb;
xfs_mount_t *mp = io->io_mount; xfs_mount_t *mp = io->io_mount;
int nimaps; int nimaps;
int error = 0; int error = 0;
...@@ -556,7 +553,7 @@ xfs_zero_eof( ...@@ -556,7 +553,7 @@ xfs_zero_eof(
nimaps = 1; nimaps = 1;
zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb, 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) { if (error) {
ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
...@@ -579,16 +576,7 @@ xfs_zero_eof( ...@@ -579,16 +576,7 @@ xfs_zero_eof(
} }
/* /*
* There are blocks in the range requested. * There are blocks we need to zero.
* 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);
/*
* Drop the inode lock while we're doing the I/O. * Drop the inode lock while we're doing the I/O.
* We'll still have the iolock to protect us. * We'll still have the iolock to protect us.
*/ */
...@@ -596,14 +584,13 @@ xfs_zero_eof( ...@@ -596,14 +584,13 @@ xfs_zero_eof(
error = xfs_iozero(ip, error = xfs_iozero(ip,
XFS_FSB_TO_B(mp, start_zero_fsb), 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); end_size);
if (error) { if (error) {
goto out_lock; 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)); ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
...@@ -637,11 +624,11 @@ xfs_write( ...@@ -637,11 +624,11 @@ xfs_write(
ssize_t ret = 0, error = 0; ssize_t ret = 0, error = 0;
xfs_fsize_t isize, new_size; xfs_fsize_t isize, new_size;
xfs_iocore_t *io; xfs_iocore_t *io;
vnode_t *vp; bhv_vnode_t *vp;
unsigned long seg; unsigned long seg;
int iolock; int iolock;
int eventsent = 0; int eventsent = 0;
vrwlock_t locktype; bhv_vrwlock_t locktype;
size_t ocount = 0, count; size_t ocount = 0, count;
loff_t pos; loff_t pos;
int need_i_mutex = 1, need_flush = 0; int need_i_mutex = 1, need_flush = 0;
...@@ -679,11 +666,11 @@ xfs_write( ...@@ -679,11 +666,11 @@ xfs_write(
io = &xip->i_iocore; io = &xip->i_iocore;
mp = io->io_mount; mp = io->io_mount;
vfs_wait_for_freeze(vp->v_vfsp, SB_FREEZE_WRITE);
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return -EIO; return -EIO;
fs_check_frozen(vp->v_vfsp, SB_FREEZE_WRITE);
if (ioflags & IO_ISDIRECT) { if (ioflags & IO_ISDIRECT) {
xfs_buftarg_t *target = xfs_buftarg_t *target =
(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
...@@ -814,7 +801,7 @@ xfs_write( ...@@ -814,7 +801,7 @@ xfs_write(
if (need_flush) { if (need_flush) {
xfs_inval_cached_trace(io, pos, -1, xfs_inval_cached_trace(io, pos, -1,
ctooff(offtoct(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); -1, FI_REMAPF_LOCKED);
} }
...@@ -903,79 +890,9 @@ xfs_write( ...@@ -903,79 +890,9 @@ xfs_write(
/* Handle various SYNC-type writes */ /* Handle various SYNC-type writes */
if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) { if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
/* error = xfs_write_sync_logforce(mp, xip);
* 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) if (error)
goto out_unlock_internal; goto out_unlock_internal;
}
xfs_rwunlock(bdp, locktype); xfs_rwunlock(bdp, locktype);
if (need_i_mutex) if (need_i_mutex)
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#ifndef __XFS_LRW_H__ #ifndef __XFS_LRW_H__
#define __XFS_LRW_H__ #define __XFS_LRW_H__
struct vnode;
struct bhv_desc; struct bhv_desc;
struct bhv_vnode;
struct xfs_mount; struct xfs_mount;
struct xfs_iocore; struct xfs_iocore;
struct xfs_inode; struct xfs_inode;
...@@ -49,7 +49,7 @@ struct xfs_iomap; ...@@ -49,7 +49,7 @@ struct xfs_iomap;
#define XFS_CTRUNC4 14 #define XFS_CTRUNC4 14
#define XFS_CTRUNC5 15 #define XFS_CTRUNC5 15
#define XFS_CTRUNC6 16 #define XFS_CTRUNC6 16
#define XFS_BUNMAPI 17 #define XFS_BUNMAP 17
#define XFS_INVAL_CACHED 18 #define XFS_INVAL_CACHED 18
#define XFS_DIORD_ENTER 19 #define XFS_DIORD_ENTER 19
#define XFS_DIOWR_ENTER 20 #define XFS_DIOWR_ENTER 20
...@@ -82,7 +82,7 @@ extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); ...@@ -82,7 +82,7 @@ extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
extern int xfs_bdstrat_cb(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_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); xfs_fsize_t, xfs_fsize_t);
extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *, extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
const struct iovec *, unsigned int, const struct iovec *, unsigned int,
......
/* /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -151,7 +149,7 @@ xfs_set_inodeops( ...@@ -151,7 +149,7 @@ xfs_set_inodeops(
STATIC __inline__ void STATIC __inline__ void
xfs_revalidate_inode( xfs_revalidate_inode(
xfs_mount_t *mp, xfs_mount_t *mp,
vnode_t *vp, bhv_vnode_t *vp,
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
struct inode *inode = vn_to_inode(vp); struct inode *inode = vn_to_inode(vp);
...@@ -206,7 +204,7 @@ xfs_revalidate_inode( ...@@ -206,7 +204,7 @@ xfs_revalidate_inode(
void void
xfs_initialize_vnode( xfs_initialize_vnode(
bhv_desc_t *bdp, bhv_desc_t *bdp,
vnode_t *vp, bhv_vnode_t *vp,
bhv_desc_t *inode_bhv, bhv_desc_t *inode_bhv,
int unlock) int unlock)
{ {
...@@ -336,7 +334,7 @@ STATIC struct inode * ...@@ -336,7 +334,7 @@ STATIC struct inode *
xfs_fs_alloc_inode( xfs_fs_alloc_inode(
struct super_block *sb) struct super_block *sb)
{ {
vnode_t *vp; bhv_vnode_t *vp;
vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP); vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP);
if (unlikely(!vp)) if (unlikely(!vp))
...@@ -359,13 +357,13 @@ xfs_fs_inode_init_once( ...@@ -359,13 +357,13 @@ xfs_fs_inode_init_once(
{ {
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
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 STATIC int
xfs_init_zones(void) 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_HWALIGN | KM_ZONE_RECLAIM |
KM_ZONE_SPREAD, KM_ZONE_SPREAD,
xfs_fs_inode_init_once); xfs_fs_inode_init_once);
...@@ -409,22 +407,17 @@ xfs_fs_write_inode( ...@@ -409,22 +407,17 @@ xfs_fs_write_inode(
struct inode *inode, struct inode *inode,
int sync) int sync)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error = 0, flags = FLUSH_INODE; int error = 0, flags = FLUSH_INODE;
if (vp) { if (vp) {
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
if (sync) if (sync)
flags |= FLUSH_SYNC; flags |= FLUSH_SYNC;
VOP_IFLUSH(vp, flags, error); error = bhv_vop_iflush(vp, flags);
if (error == EAGAIN) { if (error == EAGAIN)
if (sync) error = sync? bhv_vop_iflush(vp, flags | FLUSH_LOG) : 0;
VOP_IFLUSH(vp, flags | FLUSH_LOG, error);
else
error = 0;
}
} }
return -error; return -error;
} }
...@@ -432,8 +425,7 @@ STATIC void ...@@ -432,8 +425,7 @@ STATIC void
xfs_fs_clear_inode( xfs_fs_clear_inode(
struct inode *inode) struct inode *inode)
{ {
vnode_t *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
int error, cache;
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
...@@ -446,20 +438,18 @@ xfs_fs_clear_inode( ...@@ -446,20 +438,18 @@ xfs_fs_clear_inode(
* This can happen because xfs_iget_core calls xfs_idestroy if we * This can happen because xfs_iget_core calls xfs_idestroy if we
* find an inode with di_mode == 0 but without IGET_CREATE set. * find an inode with di_mode == 0 but without IGET_CREATE set.
*/ */
if (vp->v_fbhv) if (VNHEAD(vp))
VOP_INACTIVE(vp, NULL, cache); bhv_vop_inactive(vp, NULL);
VN_LOCK(vp); VN_LOCK(vp);
vp->v_flag &= ~VMODIFIED; vp->v_flag &= ~VMODIFIED;
VN_UNLOCK(vp, 0); VN_UNLOCK(vp, 0);
if (vp->v_fbhv) { if (VNHEAD(vp))
VOP_RECLAIM(vp, error); if (bhv_vop_reclaim(vp))
if (error) panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp);
panic("vn_purge: cannot reclaim");
}
ASSERT(vp->v_fbhv == NULL); ASSERT(VNHEAD(vp) == NULL);
#ifdef XFS_VNODE_TRACE #ifdef XFS_VNODE_TRACE
ktrace_free(vp->v_trace); ktrace_free(vp->v_trace);
...@@ -475,13 +465,13 @@ xfs_fs_clear_inode( ...@@ -475,13 +465,13 @@ xfs_fs_clear_inode(
*/ */
STATIC void STATIC void
xfs_syncd_queue_work( xfs_syncd_queue_work(
struct vfs *vfs, struct bhv_vfs *vfs,
void *data, 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); INIT_LIST_HEAD(&work->w_list);
work->w_syncer = syncer; work->w_syncer = syncer;
work->w_data = data; work->w_data = data;
...@@ -500,7 +490,7 @@ xfs_syncd_queue_work( ...@@ -500,7 +490,7 @@ xfs_syncd_queue_work(
*/ */
STATIC void STATIC void
xfs_flush_inode_work( xfs_flush_inode_work(
vfs_t *vfs, bhv_vfs_t *vfs,
void *inode) void *inode)
{ {
filemap_flush(((struct inode *)inode)->i_mapping); filemap_flush(((struct inode *)inode)->i_mapping);
...@@ -512,7 +502,7 @@ xfs_flush_inode( ...@@ -512,7 +502,7 @@ xfs_flush_inode(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
struct inode *inode = vn_to_inode(XFS_ITOV(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); igrab(inode);
xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work);
...@@ -525,7 +515,7 @@ xfs_flush_inode( ...@@ -525,7 +515,7 @@ xfs_flush_inode(
*/ */
STATIC void STATIC void
xfs_flush_device_work( xfs_flush_device_work(
vfs_t *vfs, bhv_vfs_t *vfs,
void *inode) void *inode)
{ {
sync_blockdev(vfs->vfs_super->s_bdev); sync_blockdev(vfs->vfs_super->s_bdev);
...@@ -537,7 +527,7 @@ xfs_flush_device( ...@@ -537,7 +527,7 @@ xfs_flush_device(
xfs_inode_t *ip) xfs_inode_t *ip)
{ {
struct inode *inode = vn_to_inode(XFS_ITOV(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); igrab(inode);
xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work);
...@@ -545,16 +535,16 @@ xfs_flush_device( ...@@ -545,16 +535,16 @@ xfs_flush_device(
xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); 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 STATIC void
vfs_sync_worker( vfs_sync_worker(
vfs_t *vfsp, bhv_vfs_t *vfsp,
void *unused) void *unused)
{ {
int error; int error;
if (!(vfsp->vfs_flag & VFS_RDONLY)) 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++; vfsp->vfs_sync_seq++;
wmb(); wmb();
wake_up(&vfsp->vfs_wait_single_sync_task); wake_up(&vfsp->vfs_wait_single_sync_task);
...@@ -565,8 +555,8 @@ xfssyncd( ...@@ -565,8 +555,8 @@ xfssyncd(
void *arg) void *arg)
{ {
long timeleft; long timeleft;
vfs_t *vfsp = (vfs_t *) arg; bhv_vfs_t *vfsp = (bhv_vfs_t *) arg;
struct vfs_sync_work *work, *n; bhv_vfs_sync_work_t *work, *n;
LIST_HEAD (tmp); LIST_HEAD (tmp);
timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10); timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
...@@ -600,7 +590,7 @@ xfssyncd( ...@@ -600,7 +590,7 @@ xfssyncd(
list_del(&work->w_list); list_del(&work->w_list);
if (work == &vfsp->vfs_sync_work) if (work == &vfsp->vfs_sync_work)
continue; continue;
kmem_free(work, sizeof(struct vfs_sync_work)); kmem_free(work, sizeof(struct bhv_vfs_sync_work));
} }
} }
...@@ -609,7 +599,7 @@ xfssyncd( ...@@ -609,7 +599,7 @@ xfssyncd(
STATIC int STATIC int
xfs_fs_start_syncd( 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_syncer = vfs_sync_worker;
vfsp->vfs_sync_work.w_vfs = vfsp; vfsp->vfs_sync_work.w_vfs = vfsp;
...@@ -621,7 +611,7 @@ xfs_fs_start_syncd( ...@@ -621,7 +611,7 @@ xfs_fs_start_syncd(
STATIC void STATIC void
xfs_fs_stop_syncd( xfs_fs_stop_syncd(
vfs_t *vfsp) bhv_vfs_t *vfsp)
{ {
kthread_stop(vfsp->vfs_sync_task); kthread_stop(vfsp->vfs_sync_task);
} }
...@@ -630,35 +620,26 @@ STATIC void ...@@ -630,35 +620,26 @@ STATIC void
xfs_fs_put_super( xfs_fs_put_super(
struct super_block *sb) struct super_block *sb)
{ {
vfs_t *vfsp = vfs_from_sb(sb); bhv_vfs_t *vfsp = vfs_from_sb(sb);
int error; int error;
xfs_fs_stop_syncd(vfsp); xfs_fs_stop_syncd(vfsp);
VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error); bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL);
if (!error) error = bhv_vfs_unmount(vfsp, 0, NULL);
VFS_UNMOUNT(vfsp, 0, NULL, error);
if (error) { if (error) {
printk("XFS unmount got error %d\n", error); printk("XFS: unmount got error=%d\n", error);
printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp); printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp);
return; } else {
}
vfs_deallocate(vfsp); vfs_deallocate(vfsp);
}
} }
STATIC void STATIC void
xfs_fs_write_super( xfs_fs_write_super(
struct super_block *sb) struct super_block *sb)
{ {
vfs_t *vfsp = vfs_from_sb(sb); if (!(sb->s_flags & MS_RDONLY))
int error; bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL);
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);
sb->s_dirt = 0; sb->s_dirt = 0;
} }
...@@ -667,16 +648,16 @@ xfs_fs_sync_super( ...@@ -667,16 +648,16 @@ xfs_fs_sync_super(
struct super_block *sb, struct super_block *sb,
int wait) int wait)
{ {
vfs_t *vfsp = vfs_from_sb(sb); bhv_vfs_t *vfsp = vfs_from_sb(sb);
int error; int error;
int flags = SYNC_FSDATA; int flags;
if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) if (unlikely(sb->s_frozen == SB_FREEZE_WRITE))
flags = SYNC_QUIESCE; flags = SYNC_QUIESCE;
else else
flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
VFS_SYNC(vfsp, flags, NULL, error); error = bhv_vfs_sync(vfsp, flags, NULL);
sb->s_dirt = 0; sb->s_dirt = 0;
if (unlikely(laptop_mode)) { if (unlikely(laptop_mode)) {
...@@ -706,11 +687,7 @@ xfs_fs_statfs( ...@@ -706,11 +687,7 @@ xfs_fs_statfs(
struct super_block *sb, struct super_block *sb,
struct kstatfs *statp) struct kstatfs *statp)
{ {
vfs_t *vfsp = vfs_from_sb(sb); return -bhv_vfs_statvfs(vfs_from_sb(sb), statp, NULL);
int error;
VFS_STATVFS(vfsp, statp, NULL, error);
return -error;
} }
STATIC int STATIC int
...@@ -719,13 +696,13 @@ xfs_fs_remount( ...@@ -719,13 +696,13 @@ xfs_fs_remount(
int *flags, int *flags,
char *options) 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); struct xfs_mount_args *args = xfs_args_allocate(sb, 0);
int error; int error;
VFS_PARSEARGS(vfsp, options, args, 1, error); error = bhv_vfs_parseargs(vfsp, options, args, 1);
if (!error) if (!error)
VFS_MNTUPDATE(vfsp, flags, args, error); error = bhv_vfs_mntupdate(vfsp, flags, args);
kmem_free(args, sizeof(*args)); kmem_free(args, sizeof(*args));
return -error; return -error;
} }
...@@ -734,7 +711,7 @@ STATIC void ...@@ -734,7 +711,7 @@ STATIC void
xfs_fs_lockfs( xfs_fs_lockfs(
struct super_block *sb) struct super_block *sb)
{ {
VFS_FREEZE(vfs_from_sb(sb)); bhv_vfs_freeze(vfs_from_sb(sb));
} }
STATIC int STATIC int
...@@ -742,11 +719,7 @@ xfs_fs_show_options( ...@@ -742,11 +719,7 @@ xfs_fs_show_options(
struct seq_file *m, struct seq_file *m,
struct vfsmount *mnt) struct vfsmount *mnt)
{ {
struct vfs *vfsp = vfs_from_sb(mnt->mnt_sb); return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m);
int error;
VFS_SHOWARGS(vfsp, m, error);
return error;
} }
STATIC int STATIC int
...@@ -754,11 +727,7 @@ xfs_fs_quotasync( ...@@ -754,11 +727,7 @@ xfs_fs_quotasync(
struct super_block *sb, struct super_block *sb,
int type) int type)
{ {
struct vfs *vfsp = vfs_from_sb(sb); return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL);
int error;
VFS_QUOTACTL(vfsp, Q_XQUOTASYNC, 0, (caddr_t)NULL, error);
return -error;
} }
STATIC int STATIC int
...@@ -766,11 +735,7 @@ xfs_fs_getxstate( ...@@ -766,11 +735,7 @@ xfs_fs_getxstate(
struct super_block *sb, struct super_block *sb,
struct fs_quota_stat *fqs) struct fs_quota_stat *fqs)
{ {
struct vfs *vfsp = vfs_from_sb(sb); return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
int error;
VFS_QUOTACTL(vfsp, Q_XGETQSTAT, 0, (caddr_t)fqs, error);
return -error;
} }
STATIC int STATIC int
...@@ -779,11 +744,7 @@ xfs_fs_setxstate( ...@@ -779,11 +744,7 @@ xfs_fs_setxstate(
unsigned int flags, unsigned int flags,
int op) int op)
{ {
struct vfs *vfsp = vfs_from_sb(sb); return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags);
int error;
VFS_QUOTACTL(vfsp, op, 0, (caddr_t)&flags, error);
return -error;
} }
STATIC int STATIC int
...@@ -793,13 +754,10 @@ xfs_fs_getxquota( ...@@ -793,13 +754,10 @@ xfs_fs_getxquota(
qid_t id, qid_t id,
struct fs_disk_quota *fdq) struct fs_disk_quota *fdq)
{ {
struct vfs *vfsp = vfs_from_sb(sb); return -bhv_vfs_quotactl(vfs_from_sb(sb),
int error, getmode; (type == USRQUOTA) ? Q_XGETQUOTA :
((type == GRPQUOTA) ? Q_XGETGQUOTA :
getmode = (type == USRQUOTA) ? Q_XGETQUOTA : Q_XGETPQUOTA), id, (caddr_t)fdq);
((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA);
VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error);
return -error;
} }
STATIC int STATIC int
...@@ -809,13 +767,10 @@ xfs_fs_setxquota( ...@@ -809,13 +767,10 @@ xfs_fs_setxquota(
qid_t id, qid_t id,
struct fs_disk_quota *fdq) struct fs_disk_quota *fdq)
{ {
struct vfs *vfsp = vfs_from_sb(sb); return -bhv_vfs_quotactl(vfs_from_sb(sb),
int error, setmode; (type == USRQUOTA) ? Q_XSETQLIM :
((type == GRPQUOTA) ? Q_XSETGQLIM :
setmode = (type == USRQUOTA) ? Q_XSETQLIM : Q_XSETPQLIM), id, (caddr_t)fdq);
((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM);
VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error);
return -error;
} }
STATIC int STATIC int
...@@ -824,34 +779,32 @@ xfs_fs_fill_super( ...@@ -824,34 +779,32 @@ xfs_fs_fill_super(
void *data, void *data,
int silent) int silent)
{ {
vnode_t *rootvp; struct bhv_vnode *rootvp;
struct vfs *vfsp = vfs_allocate(sb); struct bhv_vfs *vfsp = vfs_allocate(sb);
struct xfs_mount_args *args = xfs_args_allocate(sb, silent); struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
struct kstatfs statvfs; struct kstatfs statvfs;
int error, error2; int error;
bhv_insert_all_vfsops(vfsp); bhv_insert_all_vfsops(vfsp);
VFS_PARSEARGS(vfsp, (char *)data, args, 0, error); error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0);
if (error) { if (error) {
bhv_remove_all_vfsops(vfsp, 1); bhv_remove_all_vfsops(vfsp, 1);
goto fail_vfsop; goto fail_vfsop;
} }
sb_min_blocksize(sb, BBSIZE); sb_min_blocksize(sb, BBSIZE);
#ifdef CONFIG_XFS_EXPORT
sb->s_export_op = &xfs_export_operations; sb->s_export_op = &xfs_export_operations;
#endif
sb->s_qcop = &xfs_quotactl_operations; sb->s_qcop = &xfs_quotactl_operations;
sb->s_op = &xfs_super_operations; sb->s_op = &xfs_super_operations;
VFS_MOUNT(vfsp, args, NULL, error); error = bhv_vfs_mount(vfsp, args, NULL);
if (error) { if (error) {
bhv_remove_all_vfsops(vfsp, 1); bhv_remove_all_vfsops(vfsp, 1);
goto fail_vfsop; goto fail_vfsop;
} }
VFS_STATVFS(vfsp, &statvfs, NULL, error); error = bhv_vfs_statvfs(vfsp, &statvfs, NULL);
if (error) if (error)
goto fail_unmount; goto fail_unmount;
...@@ -863,7 +816,7 @@ xfs_fs_fill_super( ...@@ -863,7 +816,7 @@ xfs_fs_fill_super(
sb->s_time_gran = 1; sb->s_time_gran = 1;
set_posix_acl_flag(sb); set_posix_acl_flag(sb);
VFS_ROOT(vfsp, &rootvp, error); error = bhv_vfs_root(vfsp, &rootvp);
if (error) if (error)
goto fail_unmount; goto fail_unmount;
...@@ -892,7 +845,7 @@ xfs_fs_fill_super( ...@@ -892,7 +845,7 @@ xfs_fs_fill_super(
} }
fail_unmount: fail_unmount:
VFS_UNMOUNT(vfsp, 0, NULL, error2); bhv_vfs_unmount(vfsp, 0, NULL);
fail_vfsop: fail_vfsop:
vfs_deallocate(vfsp); vfs_deallocate(vfsp);
......
...@@ -105,7 +105,7 @@ struct block_device; ...@@ -105,7 +105,7 @@ struct block_device;
extern __uint64_t xfs_max_file_offset(unsigned int); 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_inode(struct xfs_inode *);
extern void xfs_flush_device(struct xfs_inode *); extern void xfs_flush_device(struct xfs_inode *);
......
...@@ -120,6 +120,11 @@ STATIC ctl_table xfs_table[] = { ...@@ -120,6 +120,11 @@ STATIC ctl_table xfs_table[] = {
&sysctl_intvec, NULL, &sysctl_intvec, NULL,
&xfs_params.rotorstep.min, &xfs_params.rotorstep.max}, &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
{XFS_INHERIT_NODFRG, "inherit_nodefrag", &xfs_params.inherit_nodfrg.val,
sizeof(int), 0644, NULL, &proc_dointvec_minmax,
&sysctl_intvec, NULL,
&xfs_params.inherit_nodfrg.min, &xfs_params.inherit_nodfrg.max},
/* please keep this the last entry */ /* please keep this the last entry */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
{XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val, {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
......
...@@ -46,6 +46,7 @@ typedef struct xfs_param { ...@@ -46,6 +46,7 @@ typedef struct xfs_param {
xfs_sysctl_val_t xfs_buf_age; /* Metadata buffer age before flush. */ xfs_sysctl_val_t xfs_buf_age; /* Metadata buffer age before flush. */
xfs_sysctl_val_t inherit_nosym; /* Inherit the "nosymlinks" flag. */ xfs_sysctl_val_t inherit_nosym; /* Inherit the "nosymlinks" flag. */
xfs_sysctl_val_t rotorstep; /* inode32 AG rotoring control knob */ xfs_sysctl_val_t rotorstep; /* inode32 AG rotoring control knob */
xfs_sysctl_val_t inherit_nodfrg;/* Inherit the "nodefrag" inode flag. */
} xfs_param_t; } xfs_param_t;
/* /*
...@@ -84,6 +85,7 @@ enum { ...@@ -84,6 +85,7 @@ enum {
/* XFS_IO_BYPASS = 18 */ /* XFS_IO_BYPASS = 18 */
XFS_INHERIT_NOSYM = 19, XFS_INHERIT_NOSYM = 19,
XFS_ROTORSTEP = 20, XFS_ROTORSTEP = 20,
XFS_INHERIT_NODFRG = 21,
}; };
extern xfs_param_t xfs_params; extern xfs_param_t xfs_params;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_imap.h" #include "xfs_imap.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
...@@ -104,7 +103,7 @@ vfs_mntupdate( ...@@ -104,7 +103,7 @@ vfs_mntupdate(
int int
vfs_root( vfs_root(
struct bhv_desc *bdp, struct bhv_desc *bdp,
struct vnode **vpp) struct bhv_vnode **vpp)
{ {
struct bhv_desc *next = bdp; struct bhv_desc *next = bdp;
...@@ -117,15 +116,15 @@ vfs_root( ...@@ -117,15 +116,15 @@ vfs_root(
int int
vfs_statvfs( vfs_statvfs(
struct bhv_desc *bdp, struct bhv_desc *bdp,
xfs_statfs_t *sp, bhv_statvfs_t *statp,
struct vnode *vp) struct bhv_vnode *vp)
{ {
struct bhv_desc *next = bdp; struct bhv_desc *next = bdp;
ASSERT(next); ASSERT(next);
while (! (bhvtovfsops(next))->vfs_statvfs) while (! (bhvtovfsops(next))->vfs_statvfs)
next = BHV_NEXT(next); next = BHV_NEXT(next);
return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp)); return ((*bhvtovfsops(next)->vfs_statvfs)(next, statp, vp));
} }
int int
...@@ -145,7 +144,7 @@ vfs_sync( ...@@ -145,7 +144,7 @@ vfs_sync(
int int
vfs_vget( vfs_vget(
struct bhv_desc *bdp, struct bhv_desc *bdp,
struct vnode **vpp, struct bhv_vnode **vpp,
struct fid *fidp) struct fid *fidp)
{ {
struct bhv_desc *next = bdp; struct bhv_desc *next = bdp;
...@@ -187,7 +186,7 @@ vfs_quotactl( ...@@ -187,7 +186,7 @@ vfs_quotactl(
void void
vfs_init_vnode( vfs_init_vnode(
struct bhv_desc *bdp, struct bhv_desc *bdp,
struct vnode *vp, struct bhv_vnode *vp,
struct bhv_desc *bp, struct bhv_desc *bp,
int unlock) int unlock)
{ {
...@@ -226,13 +225,13 @@ vfs_freeze( ...@@ -226,13 +225,13 @@ vfs_freeze(
((*bhvtovfsops(next)->vfs_freeze)(next)); ((*bhvtovfsops(next)->vfs_freeze)(next));
} }
vfs_t * bhv_vfs_t *
vfs_allocate( vfs_allocate(
struct super_block *sb) struct super_block *sb)
{ {
struct vfs *vfsp; struct bhv_vfs *vfsp;
vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP); vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP);
bhv_head_init(VFS_BHVHEAD(vfsp), "vfs"); bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
INIT_LIST_HEAD(&vfsp->vfs_sync_list); INIT_LIST_HEAD(&vfsp->vfs_sync_list);
spin_lock_init(&vfsp->vfs_sync_lock); spin_lock_init(&vfsp->vfs_sync_lock);
...@@ -247,25 +246,25 @@ vfs_allocate( ...@@ -247,25 +246,25 @@ vfs_allocate(
return vfsp; return vfsp;
} }
vfs_t * bhv_vfs_t *
vfs_from_sb( vfs_from_sb(
struct super_block *sb) struct super_block *sb)
{ {
return (vfs_t *)sb->s_fs_info; return (bhv_vfs_t *)sb->s_fs_info;
} }
void void
vfs_deallocate( vfs_deallocate(
struct vfs *vfsp) struct bhv_vfs *vfsp)
{ {
bhv_head_destroy(VFS_BHVHEAD(vfsp)); bhv_head_destroy(VFS_BHVHEAD(vfsp));
kmem_free(vfsp, sizeof(vfs_t)); kmem_free(vfsp, sizeof(bhv_vfs_t));
} }
void void
vfs_insertops( vfs_insertops(
struct vfs *vfsp, struct bhv_vfs *vfsp,
struct bhv_vfsops *vfsops) struct bhv_module_vfsops *vfsops)
{ {
struct bhv_desc *bdp; struct bhv_desc *bdp;
...@@ -276,9 +275,9 @@ vfs_insertops( ...@@ -276,9 +275,9 @@ vfs_insertops(
void void
vfs_insertbhv( vfs_insertbhv(
struct vfs *vfsp, struct bhv_vfs *vfsp,
struct bhv_desc *bdp, struct bhv_desc *bdp,
struct vfsops *vfsops, struct bhv_vfsops *vfsops,
void *mount) void *mount)
{ {
bhv_desc_init(bdp, mount, vfsp, vfsops); bhv_desc_init(bdp, mount, vfsp, vfsops);
...@@ -287,7 +286,7 @@ vfs_insertbhv( ...@@ -287,7 +286,7 @@ vfs_insertbhv(
void void
bhv_remove_vfsops( bhv_remove_vfsops(
struct vfs *vfsp, struct bhv_vfs *vfsp,
int pos) int pos)
{ {
struct bhv_desc *bhv; struct bhv_desc *bhv;
...@@ -301,7 +300,7 @@ bhv_remove_vfsops( ...@@ -301,7 +300,7 @@ bhv_remove_vfsops(
void void
bhv_remove_all_vfsops( bhv_remove_all_vfsops(
struct vfs *vfsp, struct bhv_vfs *vfsp,
int freebase) int freebase)
{ {
struct xfs_mount *mp; struct xfs_mount *mp;
...@@ -317,7 +316,7 @@ bhv_remove_all_vfsops( ...@@ -317,7 +316,7 @@ bhv_remove_all_vfsops(
void void
bhv_insert_all_vfsops( bhv_insert_all_vfsops(
struct vfs *vfsp) struct bhv_vfs *vfsp)
{ {
struct xfs_mount *mp; struct xfs_mount *mp;
......
/* /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -21,42 +21,40 @@ ...@@ -21,42 +21,40 @@
#include <linux/vfs.h> #include <linux/vfs.h>
#include "xfs_fs.h" #include "xfs_fs.h"
struct bhv_vfs;
struct bhv_vnode;
struct fid; struct fid;
struct vfs;
struct cred; struct cred;
struct vnode;
struct kstatfs;
struct seq_file; struct seq_file;
struct super_block; struct super_block;
struct xfs_mount_args; struct xfs_mount_args;
typedef struct kstatfs xfs_statfs_t; typedef struct kstatfs bhv_statvfs_t;
typedef struct vfs_sync_work { typedef struct bhv_vfs_sync_work {
struct list_head w_list; struct list_head w_list;
struct vfs *w_vfs; struct bhv_vfs *w_vfs;
void *w_data; /* syncer routine argument */ void *w_data; /* syncer routine argument */
void (*w_syncer)(struct vfs *, void *); void (*w_syncer)(struct bhv_vfs *, void *);
} vfs_sync_work_t; } bhv_vfs_sync_work_t;
typedef struct vfs { typedef struct bhv_vfs {
u_int vfs_flag; /* flags */ u_int vfs_flag; /* flags */
xfs_fsid_t vfs_fsid; /* file system ID */ xfs_fsid_t vfs_fsid; /* file system ID */
xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */ xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */
bhv_head_t vfs_bh; /* head of vfs behavior chain */ bhv_head_t vfs_bh; /* head of vfs behavior chain */
struct super_block *vfs_super; /* generic superblock pointer */ struct super_block *vfs_super; /* generic superblock pointer */
struct task_struct *vfs_sync_task; /* generalised sync thread */ struct task_struct *vfs_sync_task; /* generalised sync thread */
vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */ bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */
struct list_head vfs_sync_list; /* sync thread work item list */ struct list_head vfs_sync_list; /* sync thread work item list */
spinlock_t vfs_sync_lock; /* work item list lock */ spinlock_t vfs_sync_lock; /* work item list lock */
int vfs_sync_seq; /* sync thread generation no. */ int vfs_sync_seq; /* sync thread generation no. */
wait_queue_head_t vfs_wait_single_sync_task; wait_queue_head_t vfs_wait_single_sync_task;
} vfs_t; } bhv_vfs_t;
#define vfs_fbhv vfs_bh.bh_first /* 1st on vfs behavior chain */
#define bhvtovfs(bdp) ( (struct vfs *)BHV_VOBJ(bdp) ) #define bhvtovfs(bdp) ( (struct bhv_vfs *)BHV_VOBJ(bdp) )
#define bhvtovfsops(bdp) ( (struct vfsops *)BHV_OPS(bdp) ) #define bhvtovfsops(bdp) ( (struct bhv_vfsops *)BHV_OPS(bdp) )
#define VFS_BHVHEAD(vfs) ( &(vfs)->vfs_bh ) #define VFS_BHVHEAD(vfs) ( &(vfs)->vfs_bh )
#define VFS_REMOVEBHV(vfs, bdp) ( bhv_remove(VFS_BHVHEAD(vfs), bdp) ) #define VFS_REMOVEBHV(vfs, bdp) ( bhv_remove(VFS_BHVHEAD(vfs), bdp) )
...@@ -71,7 +69,7 @@ typedef enum { ...@@ -71,7 +69,7 @@ typedef enum {
VFS_BHV_QM, /* quota manager */ VFS_BHV_QM, /* quota manager */
VFS_BHV_IO, /* IO path */ VFS_BHV_IO, /* IO path */
VFS_BHV_END /* housekeeping end-of-range */ VFS_BHV_END /* housekeeping end-of-range */
} vfs_bhv_t; } bhv_vfs_type_t;
#define VFS_POSITION_XFS (BHV_POSITION_BASE) #define VFS_POSITION_XFS (BHV_POSITION_BASE)
#define VFS_POSITION_DM (VFS_POSITION_BASE+10) #define VFS_POSITION_DM (VFS_POSITION_BASE+10)
...@@ -81,8 +79,9 @@ typedef enum { ...@@ -81,8 +79,9 @@ typedef enum {
#define VFS_RDONLY 0x0001 /* read-only vfs */ #define VFS_RDONLY 0x0001 /* read-only vfs */
#define VFS_GRPID 0x0002 /* group-ID assigned from directory */ #define VFS_GRPID 0x0002 /* group-ID assigned from directory */
#define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */
#define VFS_32BITINODES 0x0008 /* do not use inums above 32 bits */ #define VFS_UMOUNT 0x0008 /* unmount in progress */
#define VFS_END 0x0008 /* max flag */ #define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */
#define VFS_END 0x0010 /* max flag */
#define SYNC_ATTR 0x0001 /* sync attributes */ #define SYNC_ATTR 0x0001 /* sync attributes */
#define SYNC_CLOSE 0x0002 /* close file system down */ #define SYNC_CLOSE 0x0002 /* close file system down */
...@@ -92,7 +91,14 @@ typedef enum { ...@@ -92,7 +91,14 @@ typedef enum {
#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
#define SYNC_QUIESCE 0x0100 /* quiesce filesystem for a snapshot */ #define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */
#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
#define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
#define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */
#define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */
#define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */
typedef int (*vfs_mount_t)(bhv_desc_t *, typedef int (*vfs_mount_t)(bhv_desc_t *,
struct xfs_mount_args *, struct cred *); struct xfs_mount_args *, struct cred *);
...@@ -102,18 +108,19 @@ typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *); ...@@ -102,18 +108,19 @@ typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *); typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *, typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *,
struct xfs_mount_args *); struct xfs_mount_args *);
typedef int (*vfs_root_t)(bhv_desc_t *, struct vnode **); typedef int (*vfs_root_t)(bhv_desc_t *, struct bhv_vnode **);
typedef int (*vfs_statvfs_t)(bhv_desc_t *, xfs_statfs_t *, struct vnode *); typedef int (*vfs_statvfs_t)(bhv_desc_t *, bhv_statvfs_t *,
struct bhv_vnode *);
typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *); typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
typedef int (*vfs_vget_t)(bhv_desc_t *, struct vnode **, struct fid *); typedef int (*vfs_vget_t)(bhv_desc_t *, struct bhv_vnode **, struct fid *);
typedef int (*vfs_dmapiops_t)(bhv_desc_t *, caddr_t); typedef int (*vfs_dmapiops_t)(bhv_desc_t *, caddr_t);
typedef int (*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t); typedef int (*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t);
typedef void (*vfs_init_vnode_t)(bhv_desc_t *, typedef void (*vfs_init_vnode_t)(bhv_desc_t *,
struct vnode *, bhv_desc_t *, int); struct bhv_vnode *, bhv_desc_t *, int);
typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int); typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
typedef void (*vfs_freeze_t)(bhv_desc_t *); typedef void (*vfs_freeze_t)(bhv_desc_t *);
typedef struct vfsops { typedef struct bhv_vfsops {
bhv_position_t vf_position; /* behavior chain position */ bhv_position_t vf_position; /* behavior chain position */
vfs_mount_t vfs_mount; /* mount file system */ vfs_mount_t vfs_mount; /* mount file system */
vfs_parseargs_t vfs_parseargs; /* parse mount options */ vfs_parseargs_t vfs_parseargs; /* parse mount options */
...@@ -129,82 +136,82 @@ typedef struct vfsops { ...@@ -129,82 +136,82 @@ typedef struct vfsops {
vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */ vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */
vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */ vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */
vfs_freeze_t vfs_freeze; /* freeze fs for snapshot */ vfs_freeze_t vfs_freeze; /* freeze fs for snapshot */
} vfsops_t; } bhv_vfsops_t;
/* /*
* VFS's. Operates on vfs structure pointers (starts at bhv head). * Virtual filesystem operations, operating from head bhv.
*/ */
#define VHEAD(v) ((v)->vfs_fbhv) #define VFSHEAD(v) ((v)->vfs_bh.bh_first)
#define VFS_MOUNT(v, ma,cr, rv) ((rv) = vfs_mount(VHEAD(v), ma,cr)) #define bhv_vfs_mount(v, ma,cr) vfs_mount(VFSHEAD(v), ma,cr)
#define VFS_PARSEARGS(v, o,ma,f, rv) ((rv) = vfs_parseargs(VHEAD(v), o,ma,f)) #define bhv_vfs_parseargs(v, o,ma,f) vfs_parseargs(VFSHEAD(v), o,ma,f)
#define VFS_SHOWARGS(v, m, rv) ((rv) = vfs_showargs(VHEAD(v), m)) #define bhv_vfs_showargs(v, m) vfs_showargs(VFSHEAD(v), m)
#define VFS_UNMOUNT(v, f, cr, rv) ((rv) = vfs_unmount(VHEAD(v), f,cr)) #define bhv_vfs_unmount(v, f,cr) vfs_unmount(VFSHEAD(v), f,cr)
#define VFS_MNTUPDATE(v, fl, args, rv) ((rv) = vfs_mntupdate(VHEAD(v), fl, args)) #define bhv_vfs_mntupdate(v, fl,args) vfs_mntupdate(VFSHEAD(v), fl,args)
#define VFS_ROOT(v, vpp, rv) ((rv) = vfs_root(VHEAD(v), vpp)) #define bhv_vfs_root(v, vpp) vfs_root(VFSHEAD(v), vpp)
#define VFS_STATVFS(v, sp,vp, rv) ((rv) = vfs_statvfs(VHEAD(v), sp,vp)) #define bhv_vfs_statvfs(v, sp,vp) vfs_statvfs(VFSHEAD(v), sp,vp)
#define VFS_SYNC(v, flag,cr, rv) ((rv) = vfs_sync(VHEAD(v), flag,cr)) #define bhv_vfs_sync(v, flag,cr) vfs_sync(VFSHEAD(v), flag,cr)
#define VFS_VGET(v, vpp,fidp, rv) ((rv) = vfs_vget(VHEAD(v), vpp,fidp)) #define bhv_vfs_vget(v, vpp,fidp) vfs_vget(VFSHEAD(v), vpp,fidp)
#define VFS_DMAPIOPS(v, p, rv) ((rv) = vfs_dmapiops(VHEAD(v), p)) #define bhv_vfs_dmapiops(v, p) vfs_dmapiops(VFSHEAD(v), p)
#define VFS_QUOTACTL(v, c,id,p, rv) ((rv) = vfs_quotactl(VHEAD(v), c,id,p)) #define bhv_vfs_quotactl(v, c,id,p) vfs_quotactl(VFSHEAD(v), c,id,p)
#define VFS_INIT_VNODE(v, vp,b,ul) ( vfs_init_vnode(VHEAD(v), vp,b,ul) ) #define bhv_vfs_init_vnode(v, vp,b,ul) vfs_init_vnode(VFSHEAD(v), vp,b,ul)
#define VFS_FORCE_SHUTDOWN(v, fl,f,l) ( vfs_force_shutdown(VHEAD(v), fl,f,l) ) #define bhv_vfs_force_shutdown(v,u,f,l) vfs_force_shutdown(VFSHEAD(v), u,f,l)
#define VFS_FREEZE(v) ( vfs_freeze(VHEAD(v)) ) #define bhv_vfs_freeze(v) vfs_freeze(VFSHEAD(v))
/* /*
* PVFS's. Operates on behavior descriptor pointers. * Virtual filesystem operations, operating from next bhv.
*/ */
#define PVFS_MOUNT(b, ma,cr, rv) ((rv) = vfs_mount(b, ma,cr)) #define bhv_next_vfs_mount(b, ma,cr) vfs_mount(b, ma,cr)
#define PVFS_PARSEARGS(b, o,ma,f, rv) ((rv) = vfs_parseargs(b, o,ma,f)) #define bhv_next_vfs_parseargs(b, o,ma,f) vfs_parseargs(b, o,ma,f)
#define PVFS_SHOWARGS(b, m, rv) ((rv) = vfs_showargs(b, m)) #define bhv_next_vfs_showargs(b, m) vfs_showargs(b, m)
#define PVFS_UNMOUNT(b, f,cr, rv) ((rv) = vfs_unmount(b, f,cr)) #define bhv_next_vfs_unmount(b, f,cr) vfs_unmount(b, f,cr)
#define PVFS_MNTUPDATE(b, fl, args, rv) ((rv) = vfs_mntupdate(b, fl, args)) #define bhv_next_vfs_mntupdate(b, fl,args) vfs_mntupdate(b, fl, args)
#define PVFS_ROOT(b, vpp, rv) ((rv) = vfs_root(b, vpp)) #define bhv_next_vfs_root(b, vpp) vfs_root(b, vpp)
#define PVFS_STATVFS(b, sp,vp, rv) ((rv) = vfs_statvfs(b, sp,vp)) #define bhv_next_vfs_statvfs(b, sp,vp) vfs_statvfs(b, sp,vp)
#define PVFS_SYNC(b, flag,cr, rv) ((rv) = vfs_sync(b, flag,cr)) #define bhv_next_vfs_sync(b, flag,cr) vfs_sync(b, flag,cr)
#define PVFS_VGET(b, vpp,fidp, rv) ((rv) = vfs_vget(b, vpp,fidp)) #define bhv_next_vfs_vget(b, vpp,fidp) vfs_vget(b, vpp,fidp)
#define PVFS_DMAPIOPS(b, p, rv) ((rv) = vfs_dmapiops(b, p)) #define bhv_next_vfs_dmapiops(b, p) vfs_dmapiops(b, p)
#define PVFS_QUOTACTL(b, c,id,p, rv) ((rv) = vfs_quotactl(b, c,id,p)) #define bhv_next_vfs_quotactl(b, c,id,p) vfs_quotactl(b, c,id,p)
#define PVFS_INIT_VNODE(b, vp,b2,ul) ( vfs_init_vnode(b, vp,b2,ul) ) #define bhv_next_vfs_init_vnode(b, vp,b2,ul) vfs_init_vnode(b, vp,b2,ul)
#define PVFS_FORCE_SHUTDOWN(b, fl,f,l) ( vfs_force_shutdown(b, fl,f,l) ) #define bhv_next_force_shutdown(b, fl,f,l) vfs_force_shutdown(b, fl,f,l)
#define PVFS_FREEZE(b) ( vfs_freeze(b) ) #define bhv_next_vfs_freeze(b) vfs_freeze(b)
extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *); extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *);
extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int); extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
extern int vfs_showargs(bhv_desc_t *, struct seq_file *); extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
extern int vfs_unmount(bhv_desc_t *, int, struct cred *); extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *); extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
extern int vfs_root(bhv_desc_t *, struct vnode **); extern int vfs_root(bhv_desc_t *, struct bhv_vnode **);
extern int vfs_statvfs(bhv_desc_t *, xfs_statfs_t *, struct vnode *); extern int vfs_statvfs(bhv_desc_t *, bhv_statvfs_t *, struct bhv_vnode *);
extern int vfs_sync(bhv_desc_t *, int, struct cred *); extern int vfs_sync(bhv_desc_t *, int, struct cred *);
extern int vfs_vget(bhv_desc_t *, struct vnode **, struct fid *); extern int vfs_vget(bhv_desc_t *, struct bhv_vnode **, struct fid *);
extern int vfs_dmapiops(bhv_desc_t *, caddr_t); extern int vfs_dmapiops(bhv_desc_t *, caddr_t);
extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t); extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
extern void vfs_init_vnode(bhv_desc_t *, struct vnode *, bhv_desc_t *, int); extern void vfs_init_vnode(bhv_desc_t *, struct bhv_vnode *, bhv_desc_t *, int);
extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int); extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
extern void vfs_freeze(bhv_desc_t *); extern void vfs_freeze(bhv_desc_t *);
typedef struct bhv_vfsops { #define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen)
struct vfsops bhv_common; #define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l))
typedef struct bhv_module_vfsops {
struct bhv_vfsops bhv_common;
void * bhv_custom; void * bhv_custom;
} bhv_vfsops_t; } bhv_module_vfsops_t;
#define vfs_bhv_lookup(v, id) ( bhv_lookup_range(&(v)->vfs_bh, (id), (id)) ) #define vfs_bhv_lookup(v, id) (bhv_lookup_range(&(v)->vfs_bh, (id), (id)))
#define vfs_bhv_custom(b) ( ((bhv_vfsops_t *)BHV_OPS(b))->bhv_custom ) #define vfs_bhv_custom(b) (((bhv_module_vfsops_t*)BHV_OPS(b))->bhv_custom)
#define vfs_bhv_set_custom(b,o) ( (b)->bhv_custom = (void *)(o)) #define vfs_bhv_set_custom(b,o) ((b)->bhv_custom = (void *)(o))
#define vfs_bhv_clr_custom(b) ( (b)->bhv_custom = NULL ) #define vfs_bhv_clr_custom(b) ((b)->bhv_custom = NULL)
extern vfs_t *vfs_allocate(struct super_block *); extern bhv_vfs_t *vfs_allocate(struct super_block *);
extern vfs_t *vfs_from_sb(struct super_block *); extern bhv_vfs_t *vfs_from_sb(struct super_block *);
extern void vfs_deallocate(vfs_t *); extern void vfs_deallocate(bhv_vfs_t *);
extern void vfs_insertops(vfs_t *, bhv_vfsops_t *); extern void vfs_insertbhv(bhv_vfs_t *, bhv_desc_t *, bhv_vfsops_t *, void *);
extern void vfs_insertbhv(vfs_t *, bhv_desc_t *, vfsops_t *, void *);
extern void bhv_insert_all_vfsops(struct vfs *); extern void vfs_insertops(bhv_vfs_t *, bhv_module_vfsops_t *);
extern void bhv_remove_all_vfsops(struct vfs *, int);
extern void bhv_remove_vfsops(struct vfs *, int);
#define fs_frozen(vfsp) ((vfsp)->vfs_super->s_frozen) extern void bhv_insert_all_vfsops(struct bhv_vfs *);
#define fs_check_frozen(vfsp, level) \ extern void bhv_remove_all_vfsops(struct bhv_vfs *, int);
vfs_check_frozen(vfsp->vfs_super, level); extern void bhv_remove_vfsops(struct bhv_vfs *, int);
#endif /* __XFS_VFS_H__ */ #endif /* __XFS_VFS_H__ */
...@@ -39,7 +39,7 @@ vn_init(void) ...@@ -39,7 +39,7 @@ vn_init(void)
void void
vn_iowait( vn_iowait(
struct vnode *vp) bhv_vnode_t *vp)
{ {
wait_queue_head_t *wq = vptosync(vp); wait_queue_head_t *wq = vptosync(vp);
...@@ -48,17 +48,33 @@ vn_iowait( ...@@ -48,17 +48,33 @@ vn_iowait(
void void
vn_iowake( vn_iowake(
struct vnode *vp) bhv_vnode_t *vp)
{ {
if (atomic_dec_and_test(&vp->v_iocount)) if (atomic_dec_and_test(&vp->v_iocount))
wake_up(vptosync(vp)); wake_up(vptosync(vp));
} }
struct vnode * /*
* Volume managers supporting multiple paths can send back ENODEV when the
* final path disappears. In this case continuing to fill the page cache
* with dirty data which cannot be written out is evil, so prevent that.
*/
void
vn_ioerror(
bhv_vnode_t *vp,
int error,
char *f,
int l)
{
if (unlikely(error == -ENODEV))
bhv_vfs_force_shutdown(vp->v_vfsp, SHUTDOWN_DEVICE_REQ, f, l);
}
bhv_vnode_t *
vn_initialize( vn_initialize(
struct inode *inode) struct inode *inode)
{ {
struct vnode *vp = vn_from_inode(inode); bhv_vnode_t *vp = vn_from_inode(inode);
XFS_STATS_INC(vn_active); XFS_STATS_INC(vn_active);
XFS_STATS_INC(vn_alloc); XFS_STATS_INC(vn_alloc);
...@@ -94,8 +110,8 @@ vn_initialize( ...@@ -94,8 +110,8 @@ vn_initialize(
*/ */
void void
vn_revalidate_core( vn_revalidate_core(
struct vnode *vp, bhv_vnode_t *vp,
vattr_t *vap) bhv_vattr_t *vap)
{ {
struct inode *inode = vn_to_inode(vp); struct inode *inode = vn_to_inode(vp);
...@@ -130,14 +146,14 @@ vn_revalidate_core( ...@@ -130,14 +146,14 @@ vn_revalidate_core(
*/ */
int int
__vn_revalidate( __vn_revalidate(
struct vnode *vp, bhv_vnode_t *vp,
struct vattr *vattr) bhv_vattr_t *vattr)
{ {
int error; int error;
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS; vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS;
VOP_GETATTR(vp, vattr, 0, NULL, error); error = bhv_vop_getattr(vp, vattr, 0, NULL);
if (likely(!error)) { if (likely(!error)) {
vn_revalidate_core(vp, vattr); vn_revalidate_core(vp, vattr);
VUNMODIFY(vp); VUNMODIFY(vp);
...@@ -147,9 +163,9 @@ __vn_revalidate( ...@@ -147,9 +163,9 @@ __vn_revalidate(
int int
vn_revalidate( vn_revalidate(
struct vnode *vp) bhv_vnode_t *vp)
{ {
vattr_t vattr; bhv_vattr_t vattr;
return __vn_revalidate(vp, &vattr); return __vn_revalidate(vp, &vattr);
} }
...@@ -157,9 +173,9 @@ vn_revalidate( ...@@ -157,9 +173,9 @@ vn_revalidate(
/* /*
* Add a reference to a referenced vnode. * Add a reference to a referenced vnode.
*/ */
struct vnode * bhv_vnode_t *
vn_hold( vn_hold(
struct vnode *vp) bhv_vnode_t *vp)
{ {
struct inode *inode; struct inode *inode;
...@@ -192,31 +208,31 @@ vn_hold( ...@@ -192,31 +208,31 @@ vn_hold(
* Vnode tracing code. * Vnode tracing code.
*/ */
void void
vn_trace_entry(vnode_t *vp, const char *func, inst_t *ra) vn_trace_entry(bhv_vnode_t *vp, const char *func, inst_t *ra)
{ {
KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra); KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra);
} }
void void
vn_trace_exit(vnode_t *vp, const char *func, inst_t *ra) vn_trace_exit(bhv_vnode_t *vp, const char *func, inst_t *ra)
{ {
KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra); KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra);
} }
void void
vn_trace_hold(vnode_t *vp, char *file, int line, inst_t *ra) vn_trace_hold(bhv_vnode_t *vp, char *file, int line, inst_t *ra)
{ {
KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra); KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra);
} }
void void
vn_trace_ref(vnode_t *vp, char *file, int line, inst_t *ra) vn_trace_ref(bhv_vnode_t *vp, char *file, int line, inst_t *ra)
{ {
KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra); KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra);
} }
void void
vn_trace_rele(vnode_t *vp, char *file, int line, inst_t *ra) vn_trace_rele(bhv_vnode_t *vp, char *file, int line, inst_t *ra)
{ {
KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra); KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra);
} }
......
此差异已折叠。
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -444,7 +442,7 @@ xfs_qm_dqalloc( ...@@ -444,7 +442,7 @@ xfs_qm_dqalloc(
XFS_BMAPI_METADATA | XFS_BMAPI_WRITE, XFS_BMAPI_METADATA | XFS_BMAPI_WRITE,
&firstblock, &firstblock,
XFS_QM_DQALLOC_SPACE_RES(mp), XFS_QM_DQALLOC_SPACE_RES(mp),
&map, &nmaps, &flist))) { &map, &nmaps, &flist, NULL))) {
goto error0; goto error0;
} }
ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB); ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB);
...@@ -559,7 +557,7 @@ xfs_qm_dqtobp( ...@@ -559,7 +557,7 @@ xfs_qm_dqtobp(
error = xfs_bmapi(NULL, quotip, dqp->q_fileoffset, error = xfs_bmapi(NULL, quotip, dqp->q_fileoffset,
XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_DQUOT_CLUSTER_SIZE_FSB,
XFS_BMAPI_METADATA, XFS_BMAPI_METADATA,
NULL, 0, &map, &nmaps, NULL); NULL, 0, &map, &nmaps, NULL, NULL);
xfs_iunlock(quotip, XFS_ILOCK_SHARED); xfs_iunlock(quotip, XFS_ILOCK_SHARED);
if (error) if (error)
...@@ -1261,7 +1259,7 @@ xfs_qm_dqflush( ...@@ -1261,7 +1259,7 @@ xfs_qm_dqflush(
if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id), if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id),
0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); xfs_force_shutdown(dqp->q_mount, SHUTDOWN_CORRUPT_INCORE);
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
} }
......
...@@ -119,7 +119,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) ...@@ -119,7 +119,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
*/ */
#define xfs_dqflock(dqp) { psema(&((dqp)->q_flock), PINOD | PRECALC);\ #define xfs_dqflock(dqp) { psema(&((dqp)->q_flock), PINOD | PRECALC);\
(dqp)->dq_flags |= XFS_DQ_FLOCKED; } (dqp)->dq_flags |= XFS_DQ_FLOCKED; }
#define xfs_dqfunlock(dqp) { ASSERT(valusema(&((dqp)->q_flock)) <= 0); \ #define xfs_dqfunlock(dqp) { ASSERT(issemalocked(&((dqp)->q_flock))); \
vsema(&((dqp)->q_flock)); \ vsema(&((dqp)->q_flock)); \
(dqp)->dq_flags &= ~(XFS_DQ_FLOCKED); } (dqp)->dq_flags &= ~(XFS_DQ_FLOCKED); }
...@@ -128,7 +128,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) ...@@ -128,7 +128,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
#define XFS_DQ_PINUNLOCK(dqp, s) mutex_spinunlock( \ #define XFS_DQ_PINUNLOCK(dqp, s) mutex_spinunlock( \
&(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s) &(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s)
#define XFS_DQ_IS_FLUSH_LOCKED(dqp) (valusema(&((dqp)->q_flock)) <= 0) #define XFS_DQ_IS_FLUSH_LOCKED(dqp) (issemalocked(&((dqp)->q_flock)))
#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp)) #define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp))
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER)
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -248,7 +246,7 @@ xfs_qm_dquot_logitem_pushbuf( ...@@ -248,7 +246,7 @@ xfs_qm_dquot_logitem_pushbuf(
* inode flush completed and the inode was taken off the AIL. * inode flush completed and the inode was taken off the AIL.
* So, just get out. * So, just get out.
*/ */
if ((valusema(&(dqp->q_flock)) > 0) || if (!issemalocked(&(dqp->q_flock)) ||
((qip->qli_item.li_flags & XFS_LI_IN_AIL) == 0)) { ((qip->qli_item.li_flags & XFS_LI_IN_AIL) == 0)) {
qip->qli_pushbuf_flag = 0; qip->qli_pushbuf_flag = 0;
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
...@@ -261,7 +259,7 @@ xfs_qm_dquot_logitem_pushbuf( ...@@ -261,7 +259,7 @@ xfs_qm_dquot_logitem_pushbuf(
if (bp != NULL) { if (bp != NULL) {
if (XFS_BUF_ISDELAYWRITE(bp)) { if (XFS_BUF_ISDELAYWRITE(bp)) {
dopush = ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && dopush = ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
(valusema(&(dqp->q_flock)) <= 0)); issemalocked(&(dqp->q_flock)));
qip->qli_pushbuf_flag = 0; qip->qli_pushbuf_flag = 0;
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -1603,7 +1601,7 @@ xfs_qm_dqiterate( ...@@ -1603,7 +1601,7 @@ xfs_qm_dqiterate(
maxlblkcnt - lblkno, maxlblkcnt - lblkno,
XFS_BMAPI_METADATA, XFS_BMAPI_METADATA,
NULL, NULL,
0, map, &nmaps, NULL); 0, map, &nmaps, NULL, NULL);
xfs_iunlock(qip, XFS_ILOCK_SHARED); xfs_iunlock(qip, XFS_ILOCK_SHARED);
if (error) if (error)
break; break;
...@@ -1905,9 +1903,7 @@ xfs_qm_quotacheck( ...@@ -1905,9 +1903,7 @@ xfs_qm_quotacheck(
*/ */
if ((error = xfs_bulkstat(mp, &lastino, &count, if ((error = xfs_bulkstat(mp, &lastino, &count,
xfs_qm_dqusage_adjust, NULL, xfs_qm_dqusage_adjust, NULL,
structsz, NULL, structsz, NULL, BULKSTAT_FG_IGET, &done)))
BULKSTAT_FG_IGET|BULKSTAT_FG_VFSLOCKED,
&done)))
break; break;
} while (! done); } while (! done);
......
/* /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -129,7 +127,7 @@ xfs_qm_parseargs( ...@@ -129,7 +127,7 @@ xfs_qm_parseargs(
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
PVFS_PARSEARGS(BHV_NEXT(bhv), options, args, update, error); error = bhv_next_vfs_parseargs(BHV_NEXT(bhv), options, args, update);
if (!error && !referenced) if (!error && !referenced)
bhv_remove_vfsops(bhvtovfs(bhv), VFS_POSITION_QM); bhv_remove_vfsops(bhvtovfs(bhv), VFS_POSITION_QM);
return error; return error;
...@@ -140,9 +138,8 @@ xfs_qm_showargs( ...@@ -140,9 +138,8 @@ xfs_qm_showargs(
struct bhv_desc *bhv, struct bhv_desc *bhv,
struct seq_file *m) struct seq_file *m)
{ {
struct vfs *vfsp = bhvtovfs(bhv); struct bhv_vfs *vfsp = bhvtovfs(bhv);
struct xfs_mount *mp = XFS_VFSTOM(vfsp); struct xfs_mount *mp = XFS_VFSTOM(vfsp);
int error;
if (mp->m_qflags & XFS_UQUOTA_ACCT) { if (mp->m_qflags & XFS_UQUOTA_ACCT) {
(mp->m_qflags & XFS_UQUOTA_ENFD) ? (mp->m_qflags & XFS_UQUOTA_ENFD) ?
...@@ -165,8 +162,7 @@ xfs_qm_showargs( ...@@ -165,8 +162,7 @@ xfs_qm_showargs(
if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
seq_puts(m, "," MNTOPT_NOQUOTA); seq_puts(m, "," MNTOPT_NOQUOTA);
PVFS_SHOWARGS(BHV_NEXT(bhv), m, error); return bhv_next_vfs_showargs(BHV_NEXT(bhv), m);
return error;
} }
STATIC int STATIC int
...@@ -175,14 +171,67 @@ xfs_qm_mount( ...@@ -175,14 +171,67 @@ xfs_qm_mount(
struct xfs_mount_args *args, struct xfs_mount_args *args,
struct cred *cr) struct cred *cr)
{ {
struct vfs *vfsp = bhvtovfs(bhv); struct bhv_vfs *vfsp = bhvtovfs(bhv);
struct xfs_mount *mp = XFS_VFSTOM(vfsp); struct xfs_mount *mp = XFS_VFSTOM(vfsp);
int error;
if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA | XFSMNT_PQUOTA)) if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA | XFSMNT_PQUOTA))
xfs_qm_mount_quotainit(mp, args->flags); xfs_qm_mount_quotainit(mp, args->flags);
PVFS_MOUNT(BHV_NEXT(bhv), args, cr, error); return bhv_next_vfs_mount(BHV_NEXT(bhv), args, cr);
}
/*
* Directory tree accounting is implemented using project quotas, where
* the project identifier is inherited from parent directories.
* A statvfs (df, etc.) of a directory that is using project quota should
* return a statvfs of the project, not the entire filesystem.
* This makes such trees appear as if they are filesystems in themselves.
*/
STATIC int
xfs_qm_statvfs(
struct bhv_desc *bhv,
bhv_statvfs_t *statp,
struct bhv_vnode *vnode)
{
xfs_mount_t *mp;
xfs_inode_t *ip;
xfs_dquot_t *dqp;
xfs_disk_dquot_t *dp;
__uint64_t limit;
int error;
error = bhv_next_vfs_statvfs(BHV_NEXT(bhv), statp, vnode);
if (error || !vnode)
return error; return error;
mp = XFS_BHVTOM(bhv);
ip = xfs_vtoi(vnode);
if (!(ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT))
return 0;
if (!(mp->m_qflags & XFS_PQUOTA_ACCT))
return 0;
if (!(mp->m_qflags & XFS_OQUOTA_ENFD))
return 0;
if (xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp))
return 0;
dp = &dqp->q_core;
limit = dp->d_blk_softlimit ? dp->d_blk_softlimit : dp->d_blk_hardlimit;
if (limit && statp->f_blocks > limit) {
statp->f_blocks = limit;
statp->f_bfree = (statp->f_blocks > dp->d_bcount) ?
(statp->f_blocks - dp->d_bcount) : 0;
}
limit = dp->d_ino_softlimit ? dp->d_ino_softlimit : dp->d_ino_hardlimit;
if (limit && statp->f_files > limit) {
statp->f_files = limit;
statp->f_ffree = (statp->f_files > dp->d_icount) ?
(statp->f_ffree - dp->d_icount) : 0;
}
xfs_qm_dqput(dqp);
return 0;
} }
STATIC int STATIC int
...@@ -191,7 +240,7 @@ xfs_qm_syncall( ...@@ -191,7 +240,7 @@ xfs_qm_syncall(
int flags, int flags,
cred_t *credp) cred_t *credp)
{ {
struct vfs *vfsp = bhvtovfs(bhv); struct bhv_vfs *vfsp = bhvtovfs(bhv);
struct xfs_mount *mp = XFS_VFSTOM(vfsp); struct xfs_mount *mp = XFS_VFSTOM(vfsp);
int error; int error;
...@@ -210,8 +259,7 @@ xfs_qm_syncall( ...@@ -210,8 +259,7 @@ xfs_qm_syncall(
} }
} }
} }
PVFS_SYNC(BHV_NEXT(bhv), flags, credp, error); return bhv_next_vfs_sync(BHV_NEXT(bhv), flags, credp);
return error;
} }
STATIC int STATIC int
...@@ -346,11 +394,12 @@ STATIC struct xfs_qmops xfs_qmcore_xfs = { ...@@ -346,11 +394,12 @@ STATIC struct xfs_qmops xfs_qmcore_xfs = {
.xfs_dqtrxops = &xfs_trans_dquot_ops, .xfs_dqtrxops = &xfs_trans_dquot_ops,
}; };
struct bhv_vfsops xfs_qmops = { { struct bhv_module_vfsops xfs_qmops = { {
BHV_IDENTITY_INIT(VFS_BHV_QM, VFS_POSITION_QM), BHV_IDENTITY_INIT(VFS_BHV_QM, VFS_POSITION_QM),
.vfs_parseargs = xfs_qm_parseargs, .vfs_parseargs = xfs_qm_parseargs,
.vfs_showargs = xfs_qm_showargs, .vfs_showargs = xfs_qm_showargs,
.vfs_mount = xfs_qm_mount, .vfs_mount = xfs_qm_mount,
.vfs_statvfs = xfs_qm_statvfs,
.vfs_sync = xfs_qm_syncall, .vfs_sync = xfs_qm_syncall,
.vfs_quotactl = xfs_qm_quotactl, }, .vfs_quotactl = xfs_qm_quotactl, },
}; };
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -35,7 +34,6 @@ ...@@ -35,7 +34,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -91,8 +89,8 @@ xfs_qm_quotactl( ...@@ -91,8 +89,8 @@ xfs_qm_quotactl(
xfs_caddr_t addr) xfs_caddr_t addr)
{ {
xfs_mount_t *mp; xfs_mount_t *mp;
bhv_vfs_t *vfsp;
int error; int error;
struct vfs *vfsp;
vfsp = bhvtovfs(bdp); vfsp = bhvtovfs(bdp);
mp = XFS_VFSTOM(vfsp); mp = XFS_VFSTOM(vfsp);
...@@ -1035,7 +1033,7 @@ xfs_qm_dqrele_all_inodes( ...@@ -1035,7 +1033,7 @@ xfs_qm_dqrele_all_inodes(
{ {
xfs_inode_t *ip, *topino; xfs_inode_t *ip, *topino;
uint ireclaims; uint ireclaims;
vnode_t *vp; bhv_vnode_t *vp;
boolean_t vnode_refd; boolean_t vnode_refd;
ASSERT(mp->m_quotainfo); ASSERT(mp->m_quotainfo);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
#include "xfs_inode.h" #include "xfs_inode.h"
......
...@@ -47,7 +47,7 @@ cmn_err(register int level, char *fmt, ...) ...@@ -47,7 +47,7 @@ cmn_err(register int level, char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
if (*fmt == '!') fp++; if (*fmt == '!') fp++;
len = vsprintf(message, fp, ap); len = vsprintf(message, fp, ap);
if (message[len-1] != '\n') if (level != CE_DEBUG && message[len-1] != '\n')
strcat(message, "\n"); strcat(message, "\n");
printk("%s%s", err_level[level], message); printk("%s%s", err_level[level], message);
va_end(ap); va_end(ap);
...@@ -68,7 +68,7 @@ icmn_err(register int level, char *fmt, va_list ap) ...@@ -68,7 +68,7 @@ icmn_err(register int level, char *fmt, va_list ap)
level = XFS_MAX_ERR_LEVEL; level = XFS_MAX_ERR_LEVEL;
spin_lock_irqsave(&xfs_err_lock,flags); spin_lock_irqsave(&xfs_err_lock,flags);
len = vsprintf(message, fmt, ap); len = vsprintf(message, fmt, ap);
if (message[len-1] != '\n') if (level != CE_DEBUG && message[len-1] != '\n')
strcat(message, "\n"); strcat(message, "\n");
spin_unlock_irqrestore(&xfs_err_lock,flags); spin_unlock_irqrestore(&xfs_err_lock,flags);
printk("%s%s", err_level[level], message); printk("%s%s", err_level[level], message);
......
...@@ -33,9 +33,6 @@ extern void cmn_err(int, char *, ...) ...@@ -33,9 +33,6 @@ extern void cmn_err(int, char *, ...)
__attribute__ ((format (printf, 2, 3))); __attribute__ ((format (printf, 2, 3)));
extern void assfail(char *expr, char *f, int l); extern void assfail(char *expr, char *f, int l);
#define prdev(fmt,targ,args...) \
printk("Device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)
#define ASSERT_ALWAYS(expr) \ #define ASSERT_ALWAYS(expr) \
(unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) (unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
......
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
#include "xfs_bit.h" #include "xfs_bit.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -39,15 +37,15 @@ ...@@ -39,15 +37,15 @@
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/posix_acl_xattr.h> #include <linux/posix_acl_xattr.h>
STATIC int xfs_acl_setmode(vnode_t *, xfs_acl_t *, int *); STATIC int xfs_acl_setmode(bhv_vnode_t *, xfs_acl_t *, int *);
STATIC void xfs_acl_filter_mode(mode_t, xfs_acl_t *); STATIC void xfs_acl_filter_mode(mode_t, xfs_acl_t *);
STATIC void xfs_acl_get_endian(xfs_acl_t *); STATIC void xfs_acl_get_endian(xfs_acl_t *);
STATIC int xfs_acl_access(uid_t, gid_t, xfs_acl_t *, mode_t, cred_t *); STATIC int xfs_acl_access(uid_t, gid_t, xfs_acl_t *, mode_t, cred_t *);
STATIC int xfs_acl_invalid(xfs_acl_t *); STATIC int xfs_acl_invalid(xfs_acl_t *);
STATIC void xfs_acl_sync_mode(mode_t, xfs_acl_t *); STATIC void xfs_acl_sync_mode(mode_t, xfs_acl_t *);
STATIC void xfs_acl_get_attr(vnode_t *, xfs_acl_t *, int, int, int *); STATIC void xfs_acl_get_attr(bhv_vnode_t *, xfs_acl_t *, int, int, int *);
STATIC void xfs_acl_set_attr(vnode_t *, xfs_acl_t *, int, int *); STATIC void xfs_acl_set_attr(bhv_vnode_t *, xfs_acl_t *, int, int *);
STATIC int xfs_acl_allow_set(vnode_t *, int); STATIC int xfs_acl_allow_set(bhv_vnode_t *, int);
kmem_zone_t *xfs_acl_zone; kmem_zone_t *xfs_acl_zone;
...@@ -57,7 +55,7 @@ kmem_zone_t *xfs_acl_zone; ...@@ -57,7 +55,7 @@ kmem_zone_t *xfs_acl_zone;
*/ */
int int
xfs_acl_vhasacl_access( xfs_acl_vhasacl_access(
vnode_t *vp) bhv_vnode_t *vp)
{ {
int error; int error;
...@@ -70,7 +68,7 @@ xfs_acl_vhasacl_access( ...@@ -70,7 +68,7 @@ xfs_acl_vhasacl_access(
*/ */
int int
xfs_acl_vhasacl_default( xfs_acl_vhasacl_default(
vnode_t *vp) bhv_vnode_t *vp)
{ {
int error; int error;
...@@ -209,7 +207,7 @@ posix_acl_xfs_to_xattr( ...@@ -209,7 +207,7 @@ posix_acl_xfs_to_xattr(
int int
xfs_acl_vget( xfs_acl_vget(
vnode_t *vp, bhv_vnode_t *vp,
void *acl, void *acl,
size_t size, size_t size,
int kind) int kind)
...@@ -241,10 +239,10 @@ xfs_acl_vget( ...@@ -241,10 +239,10 @@ xfs_acl_vget(
goto out; goto out;
} }
if (kind == _ACL_TYPE_ACCESS) { if (kind == _ACL_TYPE_ACCESS) {
vattr_t va; bhv_vattr_t va;
va.va_mask = XFS_AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); error = bhv_vop_getattr(vp, &va, 0, sys_cred);
if (error) if (error)
goto out; goto out;
xfs_acl_sync_mode(va.va_mode, xfs_acl); xfs_acl_sync_mode(va.va_mode, xfs_acl);
...@@ -260,7 +258,7 @@ xfs_acl_vget( ...@@ -260,7 +258,7 @@ xfs_acl_vget(
int int
xfs_acl_vremove( xfs_acl_vremove(
vnode_t *vp, bhv_vnode_t *vp,
int kind) int kind)
{ {
int error; int error;
...@@ -268,9 +266,9 @@ xfs_acl_vremove( ...@@ -268,9 +266,9 @@ xfs_acl_vremove(
VN_HOLD(vp); VN_HOLD(vp);
error = xfs_acl_allow_set(vp, kind); error = xfs_acl_allow_set(vp, kind);
if (!error) { if (!error) {
VOP_ATTR_REMOVE(vp, kind == _ACL_TYPE_DEFAULT? error = bhv_vop_attr_remove(vp, kind == _ACL_TYPE_DEFAULT?
SGI_ACL_DEFAULT: SGI_ACL_FILE, SGI_ACL_DEFAULT: SGI_ACL_FILE,
ATTR_ROOT, sys_cred, error); ATTR_ROOT, sys_cred);
if (error == ENOATTR) if (error == ENOATTR)
error = 0; /* 'scool */ error = 0; /* 'scool */
} }
...@@ -280,7 +278,7 @@ xfs_acl_vremove( ...@@ -280,7 +278,7 @@ xfs_acl_vremove(
int int
xfs_acl_vset( xfs_acl_vset(
vnode_t *vp, bhv_vnode_t *vp,
void *acl, void *acl,
size_t size, size_t size,
int kind) int kind)
...@@ -370,10 +368,10 @@ xfs_acl_iaccess( ...@@ -370,10 +368,10 @@ xfs_acl_iaccess(
STATIC int STATIC int
xfs_acl_allow_set( xfs_acl_allow_set(
vnode_t *vp, bhv_vnode_t *vp,
int kind) int kind)
{ {
vattr_t va; bhv_vattr_t va;
int error; int error;
if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND)) if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND))
...@@ -383,7 +381,7 @@ xfs_acl_allow_set( ...@@ -383,7 +381,7 @@ xfs_acl_allow_set(
if (vp->v_vfsp->vfs_flag & VFS_RDONLY) if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
return EROFS; return EROFS;
va.va_mask = XFS_AT_UID; va.va_mask = XFS_AT_UID;
VOP_GETATTR(vp, &va, 0, NULL, error); error = bhv_vop_getattr(vp, &va, 0, NULL);
if (error) if (error)
return error; return error;
if (va.va_uid != current->fsuid && !capable(CAP_FOWNER)) if (va.va_uid != current->fsuid && !capable(CAP_FOWNER))
...@@ -606,7 +604,7 @@ xfs_acl_get_endian( ...@@ -606,7 +604,7 @@ xfs_acl_get_endian(
*/ */
STATIC void STATIC void
xfs_acl_get_attr( xfs_acl_get_attr(
vnode_t *vp, bhv_vnode_t *vp,
xfs_acl_t *aclp, xfs_acl_t *aclp,
int kind, int kind,
int flags, int flags,
...@@ -616,9 +614,9 @@ xfs_acl_get_attr( ...@@ -616,9 +614,9 @@ xfs_acl_get_attr(
ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1); ASSERT((flags & ATTR_KERNOVAL) ? (aclp == NULL) : 1);
flags |= ATTR_ROOT; flags |= ATTR_ROOT;
VOP_ATTR_GET(vp, *error = bhv_vop_attr_get(vp, kind == _ACL_TYPE_ACCESS ?
kind == _ACL_TYPE_ACCESS ? SGI_ACL_FILE : SGI_ACL_DEFAULT, SGI_ACL_FILE : SGI_ACL_DEFAULT,
(char *)aclp, &len, flags, sys_cred, *error); (char *)aclp, &len, flags, sys_cred);
if (*error || (flags & ATTR_KERNOVAL)) if (*error || (flags & ATTR_KERNOVAL))
return; return;
xfs_acl_get_endian(aclp); xfs_acl_get_endian(aclp);
...@@ -629,7 +627,7 @@ xfs_acl_get_attr( ...@@ -629,7 +627,7 @@ xfs_acl_get_attr(
*/ */
STATIC void STATIC void
xfs_acl_set_attr( xfs_acl_set_attr(
vnode_t *vp, bhv_vnode_t *vp,
xfs_acl_t *aclp, xfs_acl_t *aclp,
int kind, int kind,
int *error) int *error)
...@@ -654,19 +652,19 @@ xfs_acl_set_attr( ...@@ -654,19 +652,19 @@ xfs_acl_set_attr(
INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm); INT_SET(newace->ae_perm, ARCH_CONVERT, ace->ae_perm);
} }
INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt); INT_SET(newacl->acl_cnt, ARCH_CONVERT, aclp->acl_cnt);
VOP_ATTR_SET(vp, *error = bhv_vop_attr_set(vp, kind == _ACL_TYPE_ACCESS ?
kind == _ACL_TYPE_ACCESS ? SGI_ACL_FILE: SGI_ACL_DEFAULT, SGI_ACL_FILE: SGI_ACL_DEFAULT,
(char *)newacl, len, ATTR_ROOT, sys_cred, *error); (char *)newacl, len, ATTR_ROOT, sys_cred);
_ACL_FREE(newacl); _ACL_FREE(newacl);
} }
int int
xfs_acl_vtoacl( xfs_acl_vtoacl(
vnode_t *vp, bhv_vnode_t *vp,
xfs_acl_t *access_acl, xfs_acl_t *access_acl,
xfs_acl_t *default_acl) xfs_acl_t *default_acl)
{ {
vattr_t va; bhv_vattr_t va;
int error = 0; int error = 0;
if (access_acl) { if (access_acl) {
...@@ -678,7 +676,7 @@ xfs_acl_vtoacl( ...@@ -678,7 +676,7 @@ xfs_acl_vtoacl(
if (!error) { if (!error) {
/* Got the ACL, need the mode... */ /* Got the ACL, need the mode... */
va.va_mask = XFS_AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); error = bhv_vop_getattr(vp, &va, 0, sys_cred);
} }
if (error) if (error)
...@@ -701,8 +699,8 @@ xfs_acl_vtoacl( ...@@ -701,8 +699,8 @@ xfs_acl_vtoacl(
*/ */
int int
xfs_acl_inherit( xfs_acl_inherit(
vnode_t *vp, bhv_vnode_t *vp,
vattr_t *vap, bhv_vattr_t *vap,
xfs_acl_t *pdaclp) xfs_acl_t *pdaclp)
{ {
xfs_acl_t *cacl; xfs_acl_t *cacl;
...@@ -757,11 +755,11 @@ xfs_acl_inherit( ...@@ -757,11 +755,11 @@ xfs_acl_inherit(
*/ */
STATIC int STATIC int
xfs_acl_setmode( xfs_acl_setmode(
vnode_t *vp, bhv_vnode_t *vp,
xfs_acl_t *acl, xfs_acl_t *acl,
int *basicperms) int *basicperms)
{ {
vattr_t va; bhv_vattr_t va;
xfs_acl_entry_t *ap; xfs_acl_entry_t *ap;
xfs_acl_entry_t *gap = NULL; xfs_acl_entry_t *gap = NULL;
int i, error, nomask = 1; int i, error, nomask = 1;
...@@ -776,7 +774,7 @@ xfs_acl_setmode( ...@@ -776,7 +774,7 @@ xfs_acl_setmode(
* mode. The m:: bits take precedence over the g:: bits. * mode. The m:: bits take precedence over the g:: bits.
*/ */
va.va_mask = XFS_AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); error = bhv_vop_getattr(vp, &va, 0, sys_cred);
if (error) if (error)
return error; return error;
...@@ -810,8 +808,7 @@ xfs_acl_setmode( ...@@ -810,8 +808,7 @@ xfs_acl_setmode(
if (gap && nomask) if (gap && nomask)
va.va_mode |= gap->ae_perm << 3; va.va_mode |= gap->ae_perm << 3;
VOP_SETATTR(vp, &va, 0, sys_cred, error); return bhv_vop_setattr(vp, &va, 0, sys_cred);
return error;
} }
/* /*
......
...@@ -50,7 +50,7 @@ typedef struct xfs_acl { ...@@ -50,7 +50,7 @@ typedef struct xfs_acl {
#ifdef CONFIG_XFS_POSIX_ACL #ifdef CONFIG_XFS_POSIX_ACL
struct vattr; struct vattr;
struct vnode; struct bhv_vnode;
struct xfs_inode; struct xfs_inode;
extern struct kmem_zone *xfs_acl_zone; extern struct kmem_zone *xfs_acl_zone;
...@@ -58,14 +58,14 @@ extern struct kmem_zone *xfs_acl_zone; ...@@ -58,14 +58,14 @@ extern struct kmem_zone *xfs_acl_zone;
(zone) = kmem_zone_init(sizeof(xfs_acl_t), (name)) (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name))
#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone) #define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone)
extern int xfs_acl_inherit(struct vnode *, struct vattr *, xfs_acl_t *); extern int xfs_acl_inherit(struct bhv_vnode *, struct bhv_vattr *, xfs_acl_t *);
extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *); extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
extern int xfs_acl_vtoacl(struct vnode *, xfs_acl_t *, xfs_acl_t *); extern int xfs_acl_vtoacl(struct bhv_vnode *, xfs_acl_t *, xfs_acl_t *);
extern int xfs_acl_vhasacl_access(struct vnode *); extern int xfs_acl_vhasacl_access(struct bhv_vnode *);
extern int xfs_acl_vhasacl_default(struct vnode *); extern int xfs_acl_vhasacl_default(struct bhv_vnode *);
extern int xfs_acl_vset(struct vnode *, void *, size_t, int); extern int xfs_acl_vset(struct bhv_vnode *, void *, size_t, int);
extern int xfs_acl_vget(struct vnode *, void *, size_t, int); extern int xfs_acl_vget(struct bhv_vnode *, void *, size_t, int);
extern int xfs_acl_vremove(struct vnode *vp, int); extern int xfs_acl_vremove(struct bhv_vnode *, int);
#define _ACL_TYPE_ACCESS 1 #define _ACL_TYPE_ACCESS 1
#define _ACL_TYPE_DEFAULT 2 #define _ACL_TYPE_DEFAULT 2
......
...@@ -24,14 +24,12 @@ ...@@ -24,14 +24,12 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -1862,7 +1860,7 @@ xfs_alloc_fix_freelist( ...@@ -1862,7 +1860,7 @@ xfs_alloc_fix_freelist(
(pag->pagf_longest - delta) : (pag->pagf_longest - delta) :
(pag->pagf_flcount > 0 || pag->pagf_longest > 0); (pag->pagf_flcount > 0 || pag->pagf_longest > 0);
if (args->minlen + args->alignment + args->minalignslop - 1 > longest || if (args->minlen + args->alignment + args->minalignslop - 1 > longest ||
(args->minleft && (!(flags & XFS_ALLOC_FLAG_FREEING) &&
(int)(pag->pagf_freeblks + pag->pagf_flcount - (int)(pag->pagf_freeblks + pag->pagf_flcount -
need - args->total) < need - args->total) <
(int)args->minleft)) { (int)args->minleft)) {
...@@ -1898,7 +1896,7 @@ xfs_alloc_fix_freelist( ...@@ -1898,7 +1896,7 @@ xfs_alloc_fix_freelist(
longest = (longest > delta) ? (longest - delta) : longest = (longest > delta) ? (longest - delta) :
(be32_to_cpu(agf->agf_flcount) > 0 || longest > 0); (be32_to_cpu(agf->agf_flcount) > 0 || longest > 0);
if (args->minlen + args->alignment + args->minalignslop - 1 > longest || if (args->minlen + args->alignment + args->minalignslop - 1 > longest ||
(args->minleft && (!(flags & XFS_ALLOC_FLAG_FREEING) &&
(int)(be32_to_cpu(agf->agf_freeblks) + (int)(be32_to_cpu(agf->agf_freeblks) +
be32_to_cpu(agf->agf_flcount) - need - args->total) < be32_to_cpu(agf->agf_flcount) - need - args->total) <
(int)args->minleft)) { (int)args->minleft)) {
...@@ -1951,8 +1949,14 @@ xfs_alloc_fix_freelist( ...@@ -1951,8 +1949,14 @@ xfs_alloc_fix_freelist(
* the restrictions correctly. Can happen for free calls * the restrictions correctly. Can happen for free calls
* on a completely full ag. * on a completely full ag.
*/ */
if (targs.agbno == NULLAGBLOCK) if (targs.agbno == NULLAGBLOCK) {
if (!(flags & XFS_ALLOC_FLAG_FREEING)) {
xfs_trans_brelse(tp, agflbp);
args->agbp = NULL;
return 0;
}
break; break;
}
/* /*
* Put each allocated block on the list. * Put each allocated block on the list.
*/ */
...@@ -2360,8 +2364,19 @@ xfs_alloc_vextent( ...@@ -2360,8 +2364,19 @@ xfs_alloc_vextent(
if (args->agno == sagno && if (args->agno == sagno &&
type == XFS_ALLOCTYPE_START_BNO) type == XFS_ALLOCTYPE_START_BNO)
args->type = XFS_ALLOCTYPE_THIS_AG; args->type = XFS_ALLOCTYPE_THIS_AG;
if (++(args->agno) == mp->m_sb.sb_agcount) /*
* For the first allocation, we can try any AG to get
* space. However, if we already have allocated a
* block, we don't want to try AGs whose number is below
* sagno. Otherwise, we may end up with out-of-order
* locking of AGF, which might cause deadlock.
*/
if (++(args->agno) == mp->m_sb.sb_agcount) {
if (args->firstblock != NULLFSBLOCK)
args->agno = sagno;
else
args->agno = 0; args->agno = 0;
}
/* /*
* Reached the starting a.g., must either be done * Reached the starting a.g., must either be done
* or switch to non-trylock mode. * or switch to non-trylock mode.
...@@ -2443,7 +2458,7 @@ xfs_free_extent( ...@@ -2443,7 +2458,7 @@ xfs_free_extent(
args.minlen = args.minleft = args.minalignslop = 0; args.minlen = args.minleft = args.minalignslop = 0;
down_read(&args.mp->m_peraglock); down_read(&args.mp->m_peraglock);
args.pag = &args.mp->m_perag[args.agno]; args.pag = &args.mp->m_perag[args.agno];
if ((error = xfs_alloc_fix_freelist(&args, 0))) if ((error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING)))
goto error0; goto error0;
#ifdef DEBUG #ifdef DEBUG
ASSERT(args.agbp != NULL); ASSERT(args.agbp != NULL);
......
...@@ -41,6 +41,7 @@ typedef enum xfs_alloctype ...@@ -41,6 +41,7 @@ typedef enum xfs_alloctype
* Flags for xfs_alloc_fix_freelist. * Flags for xfs_alloc_fix_freelist.
*/ */
#define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */ #define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */
#define XFS_ALLOC_FLAG_FREEING 0x00000002 /* indicate caller is freeing extents*/
/* /*
* Argument structure for xfs_alloc routines. * Argument structure for xfs_alloc routines.
...@@ -70,6 +71,7 @@ typedef struct xfs_alloc_arg { ...@@ -70,6 +71,7 @@ typedef struct xfs_alloc_arg {
char wasfromfl; /* set if allocation is from freelist */ char wasfromfl; /* set if allocation is from freelist */
char isfl; /* set if is freelist blocks - !acctg */ char isfl; /* set if is freelist blocks - !acctg */
char userdata; /* set if this is user data */ char userdata; /* set if this is user data */
xfs_fsblock_t firstblock; /* io first block allocated */
} xfs_alloc_arg_t; } xfs_alloc_arg_t;
/* /*
......
...@@ -24,14 +24,12 @@ ...@@ -24,14 +24,12 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
...@@ -35,7 +34,6 @@ ...@@ -35,7 +34,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -1910,7 +1908,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) ...@@ -1910,7 +1908,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno,
args->rmtblkcnt, args->rmtblkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
NULL, 0, map, &nmap, NULL); NULL, 0, map, &nmap, NULL, NULL);
if (error) if (error)
return(error); return(error);
ASSERT(nmap >= 1); ASSERT(nmap >= 1);
...@@ -1988,7 +1986,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -1988,7 +1986,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA |
XFS_BMAPI_WRITE, XFS_BMAPI_WRITE,
args->firstblock, args->total, &map, &nmap, args->firstblock, args->total, &map, &nmap,
args->flist); args->flist, NULL);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
*args->firstblock, &committed); *args->firstblock, &committed);
...@@ -2039,7 +2037,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -2039,7 +2037,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno,
args->rmtblkcnt, args->rmtblkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
args->firstblock, 0, &map, &nmap, NULL); args->firstblock, 0, &map, &nmap,
NULL, NULL);
if (error) { if (error) {
return(error); return(error);
} }
...@@ -2104,7 +2103,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) ...@@ -2104,7 +2103,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
args->rmtblkcnt, args->rmtblkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
args->firstblock, 0, &map, &nmap, args->firstblock, 0, &map, &nmap,
args->flist); args->flist, NULL);
if (error) { if (error) {
return(error); return(error);
} }
...@@ -2142,7 +2141,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) ...@@ -2142,7 +2141,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
XFS_BMAP_INIT(args->flist, args->firstblock); XFS_BMAP_INIT(args->flist, args->firstblock);
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
1, args->firstblock, args->flist, &done); 1, args->firstblock, args->flist,
NULL, &done);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
*args->firstblock, &committed); *args->firstblock, &committed);
...@@ -2322,56 +2322,56 @@ xfs_attr_trace_enter(int type, char *where, ...@@ -2322,56 +2322,56 @@ xfs_attr_trace_enter(int type, char *where,
STATIC int STATIC int
posix_acl_access_set( posix_acl_access_set(
vnode_t *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS); return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS);
} }
STATIC int STATIC int
posix_acl_access_remove( posix_acl_access_remove(
struct vnode *vp, char *name, int xflags) bhv_vnode_t *vp, char *name, int xflags)
{ {
return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS); return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
} }
STATIC int STATIC int
posix_acl_access_get( posix_acl_access_get(
vnode_t *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS); return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS);
} }
STATIC int STATIC int
posix_acl_access_exists( posix_acl_access_exists(
vnode_t *vp) bhv_vnode_t *vp)
{ {
return xfs_acl_vhasacl_access(vp); return xfs_acl_vhasacl_access(vp);
} }
STATIC int STATIC int
posix_acl_default_set( posix_acl_default_set(
vnode_t *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT); return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT);
} }
STATIC int STATIC int
posix_acl_default_get( posix_acl_default_get(
vnode_t *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT); return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT);
} }
STATIC int STATIC int
posix_acl_default_remove( posix_acl_default_remove(
struct vnode *vp, char *name, int xflags) bhv_vnode_t *vp, char *name, int xflags)
{ {
return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT); return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT);
} }
STATIC int STATIC int
posix_acl_default_exists( posix_acl_default_exists(
vnode_t *vp) bhv_vnode_t *vp)
{ {
return xfs_acl_vhasacl_default(vp); return xfs_acl_vhasacl_default(vp);
} }
...@@ -2404,21 +2404,18 @@ STATIC struct attrnames *attr_system_names[] = ...@@ -2404,21 +2404,18 @@ STATIC struct attrnames *attr_system_names[] =
STATIC int STATIC int
attr_generic_set( attr_generic_set(
struct vnode *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
int error; return -bhv_vop_attr_set(vp, name, data, size, xflags, NULL);
VOP_ATTR_SET(vp, name, data, size, xflags, NULL, error);
return -error;
} }
STATIC int STATIC int
attr_generic_get( attr_generic_get(
struct vnode *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
int error, asize = size; int error, asize = size;
VOP_ATTR_GET(vp, name, data, &asize, xflags, NULL, error); error = bhv_vop_attr_get(vp, name, data, &asize, xflags, NULL);
if (!error) if (!error)
return asize; return asize;
return -error; return -error;
...@@ -2426,12 +2423,9 @@ attr_generic_get( ...@@ -2426,12 +2423,9 @@ attr_generic_get(
STATIC int STATIC int
attr_generic_remove( attr_generic_remove(
struct vnode *vp, char *name, int xflags) bhv_vnode_t *vp, char *name, int xflags)
{ {
int error; return -bhv_vop_attr_remove(vp, name, xflags, NULL);
VOP_ATTR_REMOVE(vp, name, xflags, NULL, error);
return -error;
} }
STATIC int STATIC int
...@@ -2459,7 +2453,7 @@ attr_generic_listadd( ...@@ -2459,7 +2453,7 @@ attr_generic_listadd(
STATIC int STATIC int
attr_system_list( attr_system_list(
struct vnode *vp, bhv_vnode_t *vp,
void *data, void *data,
size_t size, size_t size,
ssize_t *result) ssize_t *result)
...@@ -2481,12 +2475,12 @@ attr_system_list( ...@@ -2481,12 +2475,12 @@ attr_system_list(
int int
attr_generic_list( attr_generic_list(
struct vnode *vp, void *data, size_t size, int xflags, ssize_t *result) bhv_vnode_t *vp, void *data, size_t size, int xflags, ssize_t *result)
{ {
attrlist_cursor_kern_t cursor = { 0 }; attrlist_cursor_kern_t cursor = { 0 };
int error; int error;
VOP_ATTR_LIST(vp, data, size, xflags, &cursor, NULL, error); error = bhv_vop_attr_list(vp, data, size, xflags, &cursor, NULL);
if (error > 0) if (error > 0)
return -error; return -error;
*result = -error; *result = -error;
...@@ -2514,7 +2508,7 @@ attr_lookup_namespace( ...@@ -2514,7 +2508,7 @@ attr_lookup_namespace(
*/ */
STATIC int STATIC int
attr_user_capable( attr_user_capable(
struct vnode *vp, bhv_vnode_t *vp,
cred_t *cred) cred_t *cred)
{ {
struct inode *inode = vn_to_inode(vp); struct inode *inode = vn_to_inode(vp);
...@@ -2532,7 +2526,7 @@ attr_user_capable( ...@@ -2532,7 +2526,7 @@ attr_user_capable(
STATIC int STATIC int
attr_trusted_capable( attr_trusted_capable(
struct vnode *vp, bhv_vnode_t *vp,
cred_t *cred) cred_t *cred)
{ {
struct inode *inode = vn_to_inode(vp); struct inode *inode = vn_to_inode(vp);
...@@ -2546,7 +2540,7 @@ attr_trusted_capable( ...@@ -2546,7 +2540,7 @@ attr_trusted_capable(
STATIC int STATIC int
attr_secure_capable( attr_secure_capable(
struct vnode *vp, bhv_vnode_t *vp,
cred_t *cred) cred_t *cred)
{ {
return -ENOSECURITY; return -ENOSECURITY;
...@@ -2554,7 +2548,7 @@ attr_secure_capable( ...@@ -2554,7 +2548,7 @@ attr_secure_capable(
STATIC int STATIC int
attr_system_set( attr_system_set(
struct vnode *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
attrnames_t *namesp; attrnames_t *namesp;
int error; int error;
...@@ -2573,7 +2567,7 @@ attr_system_set( ...@@ -2573,7 +2567,7 @@ attr_system_set(
STATIC int STATIC int
attr_system_get( attr_system_get(
struct vnode *vp, char *name, void *data, size_t size, int xflags) bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
{ {
attrnames_t *namesp; attrnames_t *namesp;
...@@ -2585,7 +2579,7 @@ attr_system_get( ...@@ -2585,7 +2579,7 @@ attr_system_get(
STATIC int STATIC int
attr_system_remove( attr_system_remove(
struct vnode *vp, char *name, int xflags) bhv_vnode_t *vp, char *name, int xflags)
{ {
attrnames_t *namesp; attrnames_t *namesp;
......
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
*========================================================================*/ *========================================================================*/
struct cred; struct cred;
struct vnode; struct bhv_vnode;
typedef int (*attrset_t)(struct vnode *, char *, void *, size_t, int); typedef int (*attrset_t)(struct bhv_vnode *, char *, void *, size_t, int);
typedef int (*attrget_t)(struct vnode *, char *, void *, size_t, int); typedef int (*attrget_t)(struct bhv_vnode *, char *, void *, size_t, int);
typedef int (*attrremove_t)(struct vnode *, char *, int); typedef int (*attrremove_t)(struct bhv_vnode *, char *, int);
typedef int (*attrexists_t)(struct vnode *); typedef int (*attrexists_t)(struct bhv_vnode *);
typedef int (*attrcapable_t)(struct vnode *, struct cred *); typedef int (*attrcapable_t)(struct bhv_vnode *, struct cred *);
typedef struct attrnames { typedef struct attrnames {
char * attr_name; char * attr_name;
...@@ -63,7 +63,7 @@ extern struct attrnames attr_trusted; ...@@ -63,7 +63,7 @@ extern struct attrnames attr_trusted;
extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT]; extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int); extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *); extern int attr_generic_list(struct bhv_vnode *, void *, size_t, int, ssize_t *);
#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */ #define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */
#define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */ #define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
...@@ -34,7 +33,6 @@ ...@@ -34,7 +33,6 @@
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -2990,7 +2988,7 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, ...@@ -2990,7 +2988,7 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
nmap = 1; nmap = 1;
error = xfs_bmapi(*trans, dp, (xfs_fileoff_t)tblkno, tblkcnt, error = xfs_bmapi(*trans, dp, (xfs_fileoff_t)tblkno, tblkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
NULL, 0, &map, &nmap, NULL); NULL, 0, &map, &nmap, NULL, NULL);
if (error) { if (error) {
return(error); return(error);
} }
......
此差异已折叠。
/* /*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. * Copyright (c) 2000-2006 Silicon Graphics, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -25,6 +25,20 @@ struct xfs_inode; ...@@ -25,6 +25,20 @@ struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
/*
* DELTA: describe a change to the in-core extent list.
*
* Internally the use of xed_blockount is somewhat funky.
* xed_blockcount contains an offset much of the time because this
* makes merging changes easier. (xfs_fileoff_t and xfs_filblks_t are
* the same underlying type).
*/
typedef struct xfs_extdelta
{
xfs_fileoff_t xed_startoff; /* offset of range */
xfs_filblks_t xed_blockcount; /* blocks in range */
} xfs_extdelta_t;
/* /*
* List of extents to be free "later". * List of extents to be free "later".
* The list is kept sorted on xbf_startblock. * The list is kept sorted on xbf_startblock.
...@@ -275,7 +289,9 @@ xfs_bmapi( ...@@ -275,7 +289,9 @@ xfs_bmapi(
xfs_extlen_t total, /* total blocks needed */ xfs_extlen_t total, /* total blocks needed */
struct xfs_bmbt_irec *mval, /* output: map values */ struct xfs_bmbt_irec *mval, /* output: map values */
int *nmap, /* i/o: mval size/count */ int *nmap, /* i/o: mval size/count */
xfs_bmap_free_t *flist); /* i/o: list extents to free */ xfs_bmap_free_t *flist, /* i/o: list extents to free */
xfs_extdelta_t *delta); /* o: change made to incore
extents */
/* /*
* Map file blocks to filesystem blocks, simple version. * Map file blocks to filesystem blocks, simple version.
...@@ -309,6 +325,8 @@ xfs_bunmapi( ...@@ -309,6 +325,8 @@ xfs_bunmapi(
xfs_fsblock_t *firstblock, /* first allocated block xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */ controls a.g. for allocs */
xfs_bmap_free_t *flist, /* i/o: list extents to free */ xfs_bmap_free_t *flist, /* i/o: list extents to free */
xfs_extdelta_t *delta, /* o: change made to incore
extents */
int *done); /* set if not done yet */ int *done); /* set if not done yet */
/* /*
......
...@@ -24,14 +24,12 @@ ...@@ -24,14 +24,12 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -1569,12 +1567,11 @@ xfs_bmbt_split( ...@@ -1569,12 +1567,11 @@ xfs_bmbt_split(
lbno = XFS_DADDR_TO_FSB(args.mp, XFS_BUF_ADDR(lbp)); lbno = XFS_DADDR_TO_FSB(args.mp, XFS_BUF_ADDR(lbp));
left = XFS_BUF_TO_BMBT_BLOCK(lbp); left = XFS_BUF_TO_BMBT_BLOCK(lbp);
args.fsbno = cur->bc_private.b.firstblock; args.fsbno = cur->bc_private.b.firstblock;
args.firstblock = args.fsbno;
if (args.fsbno == NULLFSBLOCK) { if (args.fsbno == NULLFSBLOCK) {
args.fsbno = lbno; args.fsbno = lbno;
args.type = XFS_ALLOCTYPE_START_BNO; args.type = XFS_ALLOCTYPE_START_BNO;
} else if (cur->bc_private.b.flist->xbf_low) } else
args.type = XFS_ALLOCTYPE_FIRST_AG;
else
args.type = XFS_ALLOCTYPE_NEAR_BNO; args.type = XFS_ALLOCTYPE_NEAR_BNO;
args.mod = args.minleft = args.alignment = args.total = args.isfl = args.mod = args.minleft = args.alignment = args.total = args.isfl =
args.userdata = args.minalignslop = 0; args.userdata = args.minalignslop = 0;
...@@ -2356,6 +2353,7 @@ xfs_bmbt_newroot( ...@@ -2356,6 +2353,7 @@ xfs_bmbt_newroot(
args.userdata = args.minalignslop = 0; args.userdata = args.minalignslop = 0;
args.minlen = args.maxlen = args.prod = 1; args.minlen = args.maxlen = args.prod = 1;
args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL; args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL;
args.firstblock = args.fsbno;
if (args.fsbno == NULLFSBLOCK) { if (args.fsbno == NULLFSBLOCK) {
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) {
...@@ -2365,9 +2363,7 @@ xfs_bmbt_newroot( ...@@ -2365,9 +2363,7 @@ xfs_bmbt_newroot(
#endif #endif
args.fsbno = INT_GET(*pp, ARCH_CONVERT); args.fsbno = INT_GET(*pp, ARCH_CONVERT);
args.type = XFS_ALLOCTYPE_START_BNO; args.type = XFS_ALLOCTYPE_START_BNO;
} else if (args.wasdel) } else
args.type = XFS_ALLOCTYPE_FIRST_AG;
else
args.type = XFS_ALLOCTYPE_NEAR_BNO; args.type = XFS_ALLOCTYPE_NEAR_BNO;
if ((error = xfs_alloc_vextent(&args))) { if ((error = xfs_alloc_vextent(&args))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
......
...@@ -24,14 +24,12 @@ ...@@ -24,14 +24,12 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_dir.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
...@@ -1030,9 +1029,9 @@ xfs_buf_iodone_callbacks( ...@@ -1030,9 +1029,9 @@ xfs_buf_iodone_callbacks(
if ((XFS_BUF_TARGET(bp) != lasttarg) || if ((XFS_BUF_TARGET(bp) != lasttarg) ||
(time_after(jiffies, (lasttime + 5*HZ)))) { (time_after(jiffies, (lasttime + 5*HZ)))) {
lasttime = jiffies; lasttime = jiffies;
prdev("XFS write error in file system meta-data " cmn_err(CE_ALERT, "Device %s, XFS metadata write error"
"block 0x%llx in %s", " block 0x%llx in %s",
XFS_BUF_TARGET(bp), XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
(__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname); (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
} }
lasttarg = XFS_BUF_TARGET(bp); lasttarg = XFS_BUF_TARGET(bp);
...@@ -1108,7 +1107,7 @@ xfs_buf_error_relse( ...@@ -1108,7 +1107,7 @@ xfs_buf_error_relse(
XFS_BUF_ERROR(bp,0); XFS_BUF_ERROR(bp,0);
xfs_buftrace("BUF_ERROR_RELSE", bp); xfs_buftrace("BUF_ERROR_RELSE", bp);
if (! XFS_FORCED_SHUTDOWN(mp)) if (! XFS_FORCED_SHUTDOWN(mp))
xfs_force_shutdown(mp, XFS_METADATA_IO_ERROR); xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
/* /*
* We have to unpin the pinned buffers so do the * We have to unpin the pinned buffers so do the
* callbacks. * callbacks.
......
...@@ -49,12 +49,12 @@ typedef struct xfs_cap_set { ...@@ -49,12 +49,12 @@ typedef struct xfs_cap_set {
#include <linux/posix_cap_xattr.h> #include <linux/posix_cap_xattr.h>
struct vnode; struct bhv_vnode;
extern int xfs_cap_vhascap(struct vnode *); extern int xfs_cap_vhascap(struct bhv_vnode *);
extern int xfs_cap_vset(struct vnode *, void *, size_t); extern int xfs_cap_vset(struct bhv_vnode *, void *, size_t);
extern int xfs_cap_vget(struct vnode *, void *, size_t); extern int xfs_cap_vget(struct bhv_vnode *, void *, size_t);
extern int xfs_cap_vremove(struct vnode *vp); extern int xfs_cap_vremove(struct bhv_vnode *);
#define _CAP_EXISTS xfs_cap_vhascap #define _CAP_EXISTS xfs_cap_vhascap
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
...@@ -43,7 +41,6 @@ ...@@ -43,7 +41,6 @@
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_attr_leaf.h" #include "xfs_attr_leaf.h"
#include "xfs_dir_leaf.h"
#include "xfs_dir2_data.h" #include "xfs_dir2_data.h"
#include "xfs_dir2_leaf.h" #include "xfs_dir2_leaf.h"
#include "xfs_dir2_block.h" #include "xfs_dir2_block.h"
...@@ -159,7 +156,7 @@ xfs_da_split(xfs_da_state_t *state) ...@@ -159,7 +156,7 @@ xfs_da_split(xfs_da_state_t *state)
max = state->path.active - 1; max = state->path.active - 1;
ASSERT((max >= 0) && (max < XFS_DA_NODE_MAXDEPTH)); ASSERT((max >= 0) && (max < XFS_DA_NODE_MAXDEPTH));
ASSERT(state->path.blk[max].magic == XFS_ATTR_LEAF_MAGIC || ASSERT(state->path.blk[max].magic == XFS_ATTR_LEAF_MAGIC ||
state->path.blk[max].magic == XFS_DIRX_LEAF_MAGIC(state->mp)); state->path.blk[max].magic == XFS_DIR2_LEAFN_MAGIC);
addblk = &state->path.blk[max]; /* initial dummy value */ addblk = &state->path.blk[max]; /* initial dummy value */
for (i = max; (i >= 0) && addblk; state->path.active--, i--) { for (i = max; (i >= 0) && addblk; state->path.active--, i--) {
...@@ -199,38 +196,7 @@ xfs_da_split(xfs_da_state_t *state) ...@@ -199,38 +196,7 @@ xfs_da_split(xfs_da_state_t *state)
return(error); /* GROT: attr inconsistent */ return(error); /* GROT: attr inconsistent */
addblk = newblk; addblk = newblk;
break; break;
case XFS_DIR_LEAF_MAGIC:
ASSERT(XFS_DIR_IS_V1(state->mp));
error = xfs_dir_leaf_split(state, oldblk, newblk);
if ((error != 0) && (error != ENOSPC)) {
return(error); /* GROT: dir is inconsistent */
}
if (!error) {
addblk = newblk;
break;
}
/*
* Entry wouldn't fit, split the leaf again.
*/
state->extravalid = 1;
if (state->inleaf) {
state->extraafter = 0; /* before newblk */
error = xfs_dir_leaf_split(state, oldblk,
&state->extrablk);
if (error)
return(error); /* GROT: dir incon. */
addblk = newblk;
} else {
state->extraafter = 1; /* after newblk */
error = xfs_dir_leaf_split(state, newblk,
&state->extrablk);
if (error)
return(error); /* GROT: dir incon. */
addblk = newblk;
}
break;
case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR2_LEAFN_MAGIC:
ASSERT(XFS_DIR_IS_V2(state->mp));
error = xfs_dir2_leafn_split(state, oldblk, newblk); error = xfs_dir2_leafn_split(state, oldblk, newblk);
if (error) if (error)
return error; return error;
...@@ -363,7 +329,6 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, ...@@ -363,7 +329,6 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
size = (int)((char *)&oldroot->btree[be16_to_cpu(oldroot->hdr.count)] - size = (int)((char *)&oldroot->btree[be16_to_cpu(oldroot->hdr.count)] -
(char *)oldroot); (char *)oldroot);
} else { } else {
ASSERT(XFS_DIR_IS_V2(mp));
ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); ASSERT(be16_to_cpu(oldroot->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
leaf = (xfs_dir2_leaf_t *)oldroot; leaf = (xfs_dir2_leaf_t *)oldroot;
size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] - size = (int)((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] -
...@@ -379,8 +344,7 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, ...@@ -379,8 +344,7 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
* Set up the new root node. * Set up the new root node.
*/ */
error = xfs_da_node_create(args, error = xfs_da_node_create(args,
args->whichfork == XFS_DATA_FORK && (args->whichfork == XFS_DATA_FORK) ? mp->m_dirleafblk : 0,
XFS_DIR_IS_V2(mp) ? mp->m_dirleafblk : 0,
be16_to_cpu(node->hdr.level) + 1, &bp, args->whichfork); be16_to_cpu(node->hdr.level) + 1, &bp, args->whichfork);
if (error) if (error)
return(error); return(error);
...@@ -427,10 +391,9 @@ xfs_da_node_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, ...@@ -427,10 +391,9 @@ xfs_da_node_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
/* /*
* With V2 the extra block is data or freespace. * With V2 dirs the extra block is data or freespace.
*/ */
useextra = state->extravalid && (XFS_DIR_IS_V1(state->mp) || useextra = state->extravalid && state->args->whichfork == XFS_ATTR_FORK;
state->args->whichfork == XFS_ATTR_FORK);
newcount = 1 + useextra; newcount = 1 + useextra;
/* /*
* Do we have to split the node? * Do we have to split the node?
...@@ -624,7 +587,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, ...@@ -624,7 +587,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC); ASSERT(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count))); ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count)));
ASSERT(newblk->blkno != 0); ASSERT(newblk->blkno != 0);
if (state->args->whichfork == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) if (state->args->whichfork == XFS_DATA_FORK)
ASSERT(newblk->blkno >= mp->m_dirleafblk && ASSERT(newblk->blkno >= mp->m_dirleafblk &&
newblk->blkno < mp->m_dirfreeblk); newblk->blkno < mp->m_dirfreeblk);
...@@ -670,7 +633,7 @@ xfs_da_join(xfs_da_state_t *state) ...@@ -670,7 +633,7 @@ xfs_da_join(xfs_da_state_t *state)
save_blk = &state->altpath.blk[ state->path.active-1 ]; save_blk = &state->altpath.blk[ state->path.active-1 ];
ASSERT(state->path.blk[0].magic == XFS_DA_NODE_MAGIC); ASSERT(state->path.blk[0].magic == XFS_DA_NODE_MAGIC);
ASSERT(drop_blk->magic == XFS_ATTR_LEAF_MAGIC || ASSERT(drop_blk->magic == XFS_ATTR_LEAF_MAGIC ||
drop_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp)); drop_blk->magic == XFS_DIR2_LEAFN_MAGIC);
/* /*
* Walk back up the tree joining/deallocating as necessary. * Walk back up the tree joining/deallocating as necessary.
...@@ -693,17 +656,7 @@ xfs_da_join(xfs_da_state_t *state) ...@@ -693,17 +656,7 @@ xfs_da_join(xfs_da_state_t *state)
return(0); return(0);
xfs_attr_leaf_unbalance(state, drop_blk, save_blk); xfs_attr_leaf_unbalance(state, drop_blk, save_blk);
break; break;
case XFS_DIR_LEAF_MAGIC:
ASSERT(XFS_DIR_IS_V1(state->mp));
error = xfs_dir_leaf_toosmall(state, &action);
if (error)
return(error);
if (action == 0)
return(0);
xfs_dir_leaf_unbalance(state, drop_blk, save_blk);
break;
case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR2_LEAFN_MAGIC:
ASSERT(XFS_DIR_IS_V2(state->mp));
error = xfs_dir2_leafn_toosmall(state, &action); error = xfs_dir2_leafn_toosmall(state, &action);
if (error) if (error)
return error; return error;
...@@ -790,7 +743,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) ...@@ -790,7 +743,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)
ASSERT(bp != NULL); ASSERT(bp != NULL);
blkinfo = bp->data; blkinfo = bp->data;
if (be16_to_cpu(oldroot->hdr.level) == 1) { if (be16_to_cpu(oldroot->hdr.level) == 1) {
ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DIR2_LEAFN_MAGIC ||
be16_to_cpu(blkinfo->magic) == XFS_ATTR_LEAF_MAGIC); be16_to_cpu(blkinfo->magic) == XFS_ATTR_LEAF_MAGIC);
} else { } else {
ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DA_NODE_MAGIC); ASSERT(be16_to_cpu(blkinfo->magic) == XFS_DA_NODE_MAGIC);
...@@ -951,14 +904,7 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) ...@@ -951,14 +904,7 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path)
if (count == 0) if (count == 0)
return; return;
break; break;
case XFS_DIR_LEAF_MAGIC:
ASSERT(XFS_DIR_IS_V1(state->mp));
lasthash = xfs_dir_leaf_lasthash(blk->bp, &count);
if (count == 0)
return;
break;
case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR2_LEAFN_MAGIC:
ASSERT(XFS_DIR_IS_V2(state->mp));
lasthash = xfs_dir2_leafn_lasthash(blk->bp, &count); lasthash = xfs_dir2_leafn_lasthash(blk->bp, &count);
if (count == 0) if (count == 0)
return; return;
...@@ -1117,10 +1063,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) ...@@ -1117,10 +1063,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
* Descend thru the B-tree searching each level for the right * Descend thru the B-tree searching each level for the right
* node to use, until the right hashval is found. * node to use, until the right hashval is found.
*/ */
if (args->whichfork == XFS_DATA_FORK && XFS_DIR_IS_V2(state->mp)) blkno = (args->whichfork == XFS_DATA_FORK)? state->mp->m_dirleafblk : 0;
blkno = state->mp->m_dirleafblk;
else
blkno = 0;
for (blk = &state->path.blk[0], state->path.active = 1; for (blk = &state->path.blk[0], state->path.active = 1;
state->path.active <= XFS_DA_NODE_MAXDEPTH; state->path.active <= XFS_DA_NODE_MAXDEPTH;
blk++, state->path.active++) { blk++, state->path.active++) {
...@@ -1137,7 +1080,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) ...@@ -1137,7 +1080,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
} }
curr = blk->bp->data; curr = blk->bp->data;
ASSERT(be16_to_cpu(curr->magic) == XFS_DA_NODE_MAGIC || ASSERT(be16_to_cpu(curr->magic) == XFS_DA_NODE_MAGIC ||
be16_to_cpu(curr->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || be16_to_cpu(curr->magic) == XFS_DIR2_LEAFN_MAGIC ||
be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC); be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC);
/* /*
...@@ -1190,16 +1133,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) ...@@ -1190,16 +1133,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
blk->index = probe; blk->index = probe;
blkno = be32_to_cpu(btree->before); blkno = be32_to_cpu(btree->before);
} }
} } else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) {
else if (be16_to_cpu(curr->magic) == XFS_ATTR_LEAF_MAGIC) {
blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL); blk->hashval = xfs_attr_leaf_lasthash(blk->bp, NULL);
break; break;
} } else if (be16_to_cpu(curr->magic) == XFS_DIR2_LEAFN_MAGIC) {
else if (be16_to_cpu(curr->magic) == XFS_DIR_LEAF_MAGIC) {
blk->hashval = xfs_dir_leaf_lasthash(blk->bp, NULL);
break;
}
else if (be16_to_cpu(curr->magic) == XFS_DIR2_LEAFN_MAGIC) {
blk->hashval = xfs_dir2_leafn_lasthash(blk->bp, NULL); blk->hashval = xfs_dir2_leafn_lasthash(blk->bp, NULL);
break; break;
} }
...@@ -1212,12 +1149,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result) ...@@ -1212,12 +1149,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
* next leaf and keep searching. * next leaf and keep searching.
*/ */
for (;;) { for (;;) {
if (blk->magic == XFS_DIR_LEAF_MAGIC) { if (blk->magic == XFS_DIR2_LEAFN_MAGIC) {
ASSERT(XFS_DIR_IS_V1(state->mp));
retval = xfs_dir_leaf_lookup_int(blk->bp, args,
&blk->index);
} else if (blk->magic == XFS_DIR2_LEAFN_MAGIC) {
ASSERT(XFS_DIR_IS_V2(state->mp));
retval = xfs_dir2_leafn_lookup_int(blk->bp, args, retval = xfs_dir2_leafn_lookup_int(blk->bp, args,
&blk->index, state); &blk->index, state);
} }
...@@ -1270,7 +1202,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, ...@@ -1270,7 +1202,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
old_info = old_blk->bp->data; old_info = old_blk->bp->data;
new_info = new_blk->bp->data; new_info = new_blk->bp->data;
ASSERT(old_blk->magic == XFS_DA_NODE_MAGIC || ASSERT(old_blk->magic == XFS_DA_NODE_MAGIC ||
old_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || old_blk->magic == XFS_DIR2_LEAFN_MAGIC ||
old_blk->magic == XFS_ATTR_LEAF_MAGIC); old_blk->magic == XFS_ATTR_LEAF_MAGIC);
ASSERT(old_blk->magic == be16_to_cpu(old_info->magic)); ASSERT(old_blk->magic == be16_to_cpu(old_info->magic));
ASSERT(new_blk->magic == be16_to_cpu(new_info->magic)); ASSERT(new_blk->magic == be16_to_cpu(new_info->magic));
...@@ -1280,12 +1212,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, ...@@ -1280,12 +1212,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
case XFS_ATTR_LEAF_MAGIC: case XFS_ATTR_LEAF_MAGIC:
before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp); before = xfs_attr_leaf_order(old_blk->bp, new_blk->bp);
break; break;
case XFS_DIR_LEAF_MAGIC:
ASSERT(XFS_DIR_IS_V1(state->mp));
before = xfs_dir_leaf_order(old_blk->bp, new_blk->bp);
break;
case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR2_LEAFN_MAGIC:
ASSERT(XFS_DIR_IS_V2(state->mp));
before = xfs_dir2_leafn_order(old_blk->bp, new_blk->bp); before = xfs_dir2_leafn_order(old_blk->bp, new_blk->bp);
break; break;
case XFS_DA_NODE_MAGIC: case XFS_DA_NODE_MAGIC:
...@@ -1404,7 +1331,7 @@ xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, ...@@ -1404,7 +1331,7 @@ xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
save_info = save_blk->bp->data; save_info = save_blk->bp->data;
drop_info = drop_blk->bp->data; drop_info = drop_blk->bp->data;
ASSERT(save_blk->magic == XFS_DA_NODE_MAGIC || ASSERT(save_blk->magic == XFS_DA_NODE_MAGIC ||
save_blk->magic == XFS_DIRX_LEAF_MAGIC(state->mp) || save_blk->magic == XFS_DIR2_LEAFN_MAGIC ||
save_blk->magic == XFS_ATTR_LEAF_MAGIC); save_blk->magic == XFS_ATTR_LEAF_MAGIC);
ASSERT(save_blk->magic == be16_to_cpu(save_info->magic)); ASSERT(save_blk->magic == be16_to_cpu(save_info->magic));
ASSERT(drop_blk->magic == be16_to_cpu(drop_info->magic)); ASSERT(drop_blk->magic == be16_to_cpu(drop_info->magic));
...@@ -1529,7 +1456,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, ...@@ -1529,7 +1456,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
ASSERT(blk->bp != NULL); ASSERT(blk->bp != NULL);
info = blk->bp->data; info = blk->bp->data;
ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC || ASSERT(be16_to_cpu(info->magic) == XFS_DA_NODE_MAGIC ||
be16_to_cpu(info->magic) == XFS_DIRX_LEAF_MAGIC(state->mp) || be16_to_cpu(info->magic) == XFS_DIR2_LEAFN_MAGIC ||
be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC); be16_to_cpu(info->magic) == XFS_ATTR_LEAF_MAGIC);
blk->magic = be16_to_cpu(info->magic); blk->magic = be16_to_cpu(info->magic);
if (blk->magic == XFS_DA_NODE_MAGIC) { if (blk->magic == XFS_DA_NODE_MAGIC) {
...@@ -1548,20 +1475,13 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, ...@@ -1548,20 +1475,13 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
blk->hashval = xfs_attr_leaf_lasthash(blk->bp, blk->hashval = xfs_attr_leaf_lasthash(blk->bp,
NULL); NULL);
break; break;
case XFS_DIR_LEAF_MAGIC:
ASSERT(XFS_DIR_IS_V1(state->mp));
blk->hashval = xfs_dir_leaf_lasthash(blk->bp,
NULL);
break;
case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR2_LEAFN_MAGIC:
ASSERT(XFS_DIR_IS_V2(state->mp));
blk->hashval = xfs_dir2_leafn_lasthash(blk->bp, blk->hashval = xfs_dir2_leafn_lasthash(blk->bp,
NULL); NULL);
break; break;
default: default:
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC || ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC ||
blk->magic == blk->magic == XFS_DIR2_LEAFN_MAGIC);
XFS_DIRX_LEAF_MAGIC(state->mp));
break; break;
} }
} }
...@@ -1620,7 +1540,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1620,7 +1540,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
xfs_bmbt_irec_t *mapp; xfs_bmbt_irec_t *mapp;
xfs_inode_t *dp; xfs_inode_t *dp;
int nmap, error, w, count, c, got, i, mapi; int nmap, error, w, count, c, got, i, mapi;
xfs_fsize_t size;
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -1631,7 +1550,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1631,7 +1550,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
/* /*
* For new directories adjust the file offset and block count. * For new directories adjust the file offset and block count.
*/ */
if (w == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) { if (w == XFS_DATA_FORK) {
bno = mp->m_dirleafblk; bno = mp->m_dirleafblk;
count = mp->m_dirblkfsbs; count = mp->m_dirblkfsbs;
} else { } else {
...@@ -1641,10 +1560,9 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1641,10 +1560,9 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
/* /*
* Find a spot in the file space to put the new block. * Find a spot in the file space to put the new block.
*/ */
if ((error = xfs_bmap_first_unused(tp, dp, count, &bno, w))) { if ((error = xfs_bmap_first_unused(tp, dp, count, &bno, w)))
return error; return error;
} if (w == XFS_DATA_FORK)
if (w == XFS_DATA_FORK && XFS_DIR_IS_V2(mp))
ASSERT(bno >= mp->m_dirleafblk && bno < mp->m_dirfreeblk); ASSERT(bno >= mp->m_dirleafblk && bno < mp->m_dirfreeblk);
/* /*
* Try mapping it in one filesystem block. * Try mapping it in one filesystem block.
...@@ -1655,7 +1573,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1655,7 +1573,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA| XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|
XFS_BMAPI_CONTIG, XFS_BMAPI_CONTIG,
args->firstblock, args->total, &map, &nmap, args->firstblock, args->total, &map, &nmap,
args->flist))) { args->flist, NULL))) {
return error; return error;
} }
ASSERT(nmap <= 1); ASSERT(nmap <= 1);
...@@ -1676,7 +1594,8 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1676,7 +1594,8 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE| XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|
XFS_BMAPI_METADATA, XFS_BMAPI_METADATA,
args->firstblock, args->total, args->firstblock, args->total,
&mapp[mapi], &nmap, args->flist))) { &mapp[mapi], &nmap, args->flist,
NULL))) {
kmem_free(mapp, sizeof(*mapp) * count); kmem_free(mapp, sizeof(*mapp) * count);
return error; return error;
} }
...@@ -1705,19 +1624,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1705,19 +1624,6 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
if (mapp != &map) if (mapp != &map)
kmem_free(mapp, sizeof(*mapp) * count); kmem_free(mapp, sizeof(*mapp) * count);
*new_blkno = (xfs_dablk_t)bno; *new_blkno = (xfs_dablk_t)bno;
/*
* For version 1 directories, adjust the file size if it changed.
*/
if (w == XFS_DATA_FORK && XFS_DIR_IS_V1(mp)) {
ASSERT(mapi == 1);
if ((error = xfs_bmap_last_offset(tp, dp, &bno, w)))
return error;
size = XFS_FSB_TO_B(mp, bno);
if (size != dp->i_d.di_size) {
dp->i_d.di_size = size;
xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
}
}
return 0; return 0;
} }
...@@ -1742,7 +1648,6 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, ...@@ -1742,7 +1648,6 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
int error, w, entno, level, dead_level; int error, w, entno, level, dead_level;
xfs_da_blkinfo_t *dead_info, *sib_info; xfs_da_blkinfo_t *dead_info, *sib_info;
xfs_da_intnode_t *par_node, *dead_node; xfs_da_intnode_t *par_node, *dead_node;
xfs_dir_leafblock_t *dead_leaf;
xfs_dir2_leaf_t *dead_leaf2; xfs_dir2_leaf_t *dead_leaf2;
xfs_dahash_t dead_hash; xfs_dahash_t dead_hash;
...@@ -1753,11 +1658,8 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, ...@@ -1753,11 +1658,8 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
w = args->whichfork; w = args->whichfork;
ASSERT(w == XFS_DATA_FORK); ASSERT(w == XFS_DATA_FORK);
mp = ip->i_mount; mp = ip->i_mount;
if (XFS_DIR_IS_V2(mp)) {
lastoff = mp->m_dirfreeblk; lastoff = mp->m_dirfreeblk;
error = xfs_bmap_last_before(tp, ip, &lastoff, w); error = xfs_bmap_last_before(tp, ip, &lastoff, w);
} else
error = xfs_bmap_last_offset(tp, ip, &lastoff, w);
if (error) if (error)
return error; return error;
if (unlikely(lastoff == 0)) { if (unlikely(lastoff == 0)) {
...@@ -1780,14 +1682,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, ...@@ -1780,14 +1682,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
/* /*
* Get values from the moved block. * Get values from the moved block.
*/ */
if (be16_to_cpu(dead_info->magic) == XFS_DIR_LEAF_MAGIC) { if (be16_to_cpu(dead_info->magic) == XFS_DIR2_LEAFN_MAGIC) {
ASSERT(XFS_DIR_IS_V1(mp));
dead_leaf = (xfs_dir_leafblock_t *)dead_info;
dead_level = 0;
dead_hash =
INT_GET(dead_leaf->entries[INT_GET(dead_leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT);
} else if (be16_to_cpu(dead_info->magic) == XFS_DIR2_LEAFN_MAGIC) {
ASSERT(XFS_DIR_IS_V2(mp));
dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; dead_leaf2 = (xfs_dir2_leaf_t *)dead_info;
dead_level = 0; dead_level = 0;
dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval);
...@@ -1842,7 +1737,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, ...@@ -1842,7 +1737,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
xfs_da_buf_done(sib_buf); xfs_da_buf_done(sib_buf);
sib_buf = NULL; sib_buf = NULL;
} }
par_blkno = XFS_DIR_IS_V1(mp) ? 0 : mp->m_dirleafblk; par_blkno = mp->m_dirleafblk;
level = -1; level = -1;
/* /*
* Walk down the tree looking for the parent of the moved block. * Walk down the tree looking for the parent of the moved block.
...@@ -1941,8 +1836,6 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, ...@@ -1941,8 +1836,6 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
{ {
xfs_inode_t *dp; xfs_inode_t *dp;
int done, error, w, count; int done, error, w, count;
xfs_fileoff_t bno;
xfs_fsize_t size;
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_mount_t *mp; xfs_mount_t *mp;
...@@ -1950,7 +1843,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, ...@@ -1950,7 +1843,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
w = args->whichfork; w = args->whichfork;
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
if (w == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) if (w == XFS_DATA_FORK)
count = mp->m_dirblkfsbs; count = mp->m_dirblkfsbs;
else else
count = 1; count = 1;
...@@ -1961,34 +1854,17 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, ...@@ -1961,34 +1854,17 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
*/ */
if ((error = xfs_bunmapi(tp, dp, dead_blkno, count, if ((error = xfs_bunmapi(tp, dp, dead_blkno, count,
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_METADATA, XFS_BMAPI_AFLAG(w)|XFS_BMAPI_METADATA,
0, args->firstblock, args->flist, 0, args->firstblock, args->flist, NULL,
&done)) == ENOSPC) { &done)) == ENOSPC) {
if (w != XFS_DATA_FORK) if (w != XFS_DATA_FORK)
goto done; break;
if ((error = xfs_da_swap_lastblock(args, &dead_blkno, if ((error = xfs_da_swap_lastblock(args, &dead_blkno,
&dead_buf))) &dead_buf)))
goto done;
} else if (error)
goto done;
else
break; break;
} } else {
ASSERT(done); break;
xfs_da_binval(tp, dead_buf);
/*
* Adjust the directory size for version 1.
*/
if (w == XFS_DATA_FORK && XFS_DIR_IS_V1(mp)) {
if ((error = xfs_bmap_last_offset(tp, dp, &bno, w)))
return error;
size = XFS_FSB_TO_B(dp->i_mount, bno);
if (size != dp->i_d.di_size) {
dp->i_d.di_size = size;
xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
} }
} }
return 0;
done:
xfs_da_binval(tp, dead_buf); xfs_da_binval(tp, dead_buf);
return error; return error;
} }
...@@ -2049,10 +1925,7 @@ xfs_da_do_buf( ...@@ -2049,10 +1925,7 @@ xfs_da_do_buf(
xfs_dabuf_t *rbp; xfs_dabuf_t *rbp;
mp = dp->i_mount; mp = dp->i_mount;
if (whichfork == XFS_DATA_FORK && XFS_DIR_IS_V2(mp)) nfsb = (whichfork == XFS_DATA_FORK) ? mp->m_dirblkfsbs : 1;
nfsb = mp->m_dirblkfsbs;
else
nfsb = 1;
mappedbno = *mappedbnop; mappedbno = *mappedbnop;
/* /*
* Caller doesn't have a mapping. -2 means don't complain * Caller doesn't have a mapping. -2 means don't complain
...@@ -2086,7 +1959,7 @@ xfs_da_do_buf( ...@@ -2086,7 +1959,7 @@ xfs_da_do_buf(
nfsb, nfsb,
XFS_BMAPI_METADATA | XFS_BMAPI_METADATA |
XFS_BMAPI_AFLAG(whichfork), XFS_BMAPI_AFLAG(whichfork),
NULL, 0, mapp, &nmap, NULL))) NULL, 0, mapp, &nmap, NULL, NULL)))
goto exit0; goto exit0;
} }
} else { } else {
...@@ -2198,7 +2071,6 @@ xfs_da_do_buf( ...@@ -2198,7 +2071,6 @@ xfs_da_do_buf(
magic1 = be32_to_cpu(data->hdr.magic); magic1 = be32_to_cpu(data->hdr.magic);
if (unlikely( if (unlikely(
XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) && XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) &&
(magic != XFS_DIR_LEAF_MAGIC) &&
(magic != XFS_ATTR_LEAF_MAGIC) && (magic != XFS_ATTR_LEAF_MAGIC) &&
(magic != XFS_DIR2_LEAF1_MAGIC) && (magic != XFS_DIR2_LEAF1_MAGIC) &&
(magic != XFS_DIR2_LEAFN_MAGIC) && (magic != XFS_DIR2_LEAFN_MAGIC) &&
......
...@@ -36,14 +36,10 @@ struct zone; ...@@ -36,14 +36,10 @@ struct zone;
* level in the Btree, and to identify which type of block this is. * level in the Btree, and to identify which type of block this is.
*/ */
#define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */ #define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */
#define XFS_DIR_LEAF_MAGIC 0xfeeb /* magic number: directory leaf blks */
#define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks */ #define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks */
#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */ #define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */
#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */ #define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */
#define XFS_DIRX_LEAF_MAGIC(mp) \
(XFS_DIR_IS_V1(mp) ? XFS_DIR_LEAF_MAGIC : XFS_DIR2_LEAFN_MAGIC)
typedef struct xfs_da_blkinfo { typedef struct xfs_da_blkinfo {
__be32 forw; /* previous block in list */ __be32 forw; /* previous block in list */
__be32 back; /* following block in list */ __be32 back; /* following block in list */
......
此差异已折叠。
...@@ -48,6 +48,9 @@ typedef struct xfs_swapext ...@@ -48,6 +48,9 @@ typedef struct xfs_swapext
*/ */
int xfs_swapext(struct xfs_swapext __user *sx); int xfs_swapext(struct xfs_swapext __user *sx);
int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
struct xfs_swapext *sxp);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_DFRAG_H__ */ #endif /* __XFS_DFRAG_H__ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -19,11 +19,9 @@ ...@@ -19,11 +19,9 @@
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_dir.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_da_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_dir_sf.h"
#include "xfs_dir2_sf.h" #include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h" #include "xfs_attr_sf.h"
#include "xfs_dinode.h" #include "xfs_dinode.h"
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册