Commit 52ab3f3d authored by Linus Torvalds's avatar 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
  ...
parents 43104f1d 98174e46
...@@ -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);
......
This diff is collapsed.
/* /*
* 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 #define EWRONGFS EINVAL /* Mount with wrong filesystem type */
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
/* Note: EWRONGFS never visible outside the kernel */
#define EWRONGFS EINVAL /* Mount with wrong filesystem type */
/*
* XXX EFSCORRUPTED needs a real value in errno.h. asm-i386/errno.h won't
* return codes out of its known range in errno.
* XXX Also note: needs to be < 1000 and fairly unique on Linux (mustn't
* conflict with any code we use already or any code a driver may use)
* XXX Some options (currently we do #2):
* 1/ New error code ["Filesystem is corrupted", _after_ glibc updated]
* 2/ 990 ["Unknown error 990"]
* 3/ EUCLEAN ["Structure needs cleaning"]
* 4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace]
*/
#define EFSCORRUPTED 990 /* Filesystem is corrupted */
#define 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 if (error)
* size, force the log. goto out_unlock_internal;
*/
if (!(mp->m_flags & XFS_MOUNT_OSYNCISOSYNC) &&
!(xip->i_update_size)) {
xfs_inode_log_item_t *iip = xip->i_itemp;
/*
* If an allocation transaction occurred
* without extending the size, then we have to force
* the log up the proper point to ensure that the
* allocation is permanent. We can't count on
* the fact that buffered writes lock out direct I/O
* writes - the direct I/O write could have extended
* the size nontransactionally, then finished before
* we started. xfs_write_file will think that the file
* didn't grow but the update isn't safe unless the
* size change is logged.
*
* Force the log if we've committed a transaction
* against the inode or if someone else has and
* the commit record hasn't gone to disk (e.g.
* the inode is pinned). This guarantees that
* all changes affecting the inode are permanent
* when we return.
*/
if (iip && iip->ili_last_lsn) {
xfs_log_force(mp, iip->ili_last_lsn,
XFS_LOG_FORCE | XFS_LOG_SYNC);
} else if (xfs_ipincount(xip) > 0) {
xfs_log_force(mp, (xfs_lsn_t)0,
XFS_LOG_FORCE | XFS_LOG_SYNC);
}
} else {
xfs_trans_t *tp;
/*
* O_SYNC or O_DSYNC _with_ a size update are handled
* the same way.
*
* If the write was synchronous then we need to make
* sure that the inode modification time is permanent.
* We'll have updated the timestamp above, so here
* we use a synchronous transaction to log the inode.
* It's not fast, but it's necessary.
*
* If this a dsync write and the size got changed
* non-transactionally, then we need to ensure that
* the size change gets logged in a synchronous
* transaction.
*/
tp = xfs_trans_alloc(mp, XFS_TRANS_WRITE_SYNC);
if ((error = xfs_trans_reserve(tp, 0,
XFS_SWRITE_LOG_RES(mp),
0, 0, 0))) {
/* Transaction reserve failed */
xfs_trans_cancel(tp, 0);
} else {
/* Transaction reserve successful */
xfs_ilock(xip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, xip, XFS_ILOCK_EXCL);
xfs_trans_ihold(tp, xip);
xfs_trans_log_inode(tp, xip, XFS_ILOG_CORE);
xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp, 0, NULL);
xfs_iunlock(xip, XFS_ILOCK_EXCL);
}
if (error)
goto out_unlock_internal;
}
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,
......
This diff is collapsed.
...@@ -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;
......
This diff is collapsed.
...@@ -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);
} }
......
This diff is collapsed.
...@@ -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);
return error; }
/*
* 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;
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) /*
args->agno = 0; * 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;
}
/* /*
* 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);
} }
......
This diff is collapsed.
/* /*
* 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
......
This diff is collapsed.
...@@ -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 */
......
This diff is collapsed.
...@@ -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__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment