# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet v2.5.67 -> 1.1044 # fs/xfs/linux/xfs_lrw.c 1.18 -> 1.19 # fs/xfs/xfs_mount.h 1.11 -> 1.12 # fs/xfs/support/atomic.h 1.2 -> (deleted) # fs/xfs/linux/xfs_lrw.h 1.10 -> 1.11 # fs/xfs/xfs_rw.h 1.4 -> 1.5 # fs/xfs/xfs_vfsops.c 1.27 -> 1.28 # fs/xfs/xfs.h 1.4 -> 1.5 # fs/xfs/xfs_fs.h 1.5 -> 1.7 # fs/xfs/xfs_mount.c 1.23 -> 1.24 # fs/xfs/linux/xfs_globals.h 1.4 -> 1.5 # fs/xfs/support/ktrace.c 1.1 -> 1.2 # fs/xfs/xfs_bmap_btree.h 1.5 -> 1.6 # fs/xfs/linux/xfs_file.c 1.11 -> 1.12 # fs/xfs/xfs_ialloc.c 1.4 -> 1.5 # fs/xfs/linux/xfs_globals.c 1.10 -> 1.11 # fs/xfs/xfs_inode.h 1.12 -> 1.13 # fs/xfs/linux/xfs_ioctl.c 1.12 -> 1.13 # fs/xfs/linux/xfs_aops.c 1.28 -> 1.30 # fs/xfs/linux/xfs_super.c 1.33 -> 1.34 # fs/xfs/xfs_dmapi.h 1.7 -> 1.8 # fs/xfs/xfs_inode.c 1.17 -> 1.18 # fs/xfs/xfs_iget.c 1.11 -> 1.12 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/04/07 torvalds@home.transmeta.com 1.1043 # Linux 2.5.67 # -------------------------------------------- # 03/04/07 hch@sgi.com 1.1041.1.1 # [XFS] remove busy inode check in the umount path - Linux checked it for us before calling into the filesystem. We're beyond the point of no return for umount anyway # # SGI Modid: 2.5.x-xfs:slinx:142731a # -------------------------------------------- # 03/04/07 nathans@sgi.com 1.1041.1.2 # [XFS] Fix definition of setresblks - nothing uses it yet, but DMF will (so fix now). # # SGI Modid: 2.5.x-xfs:slinx:142797a # -------------------------------------------- # 03/04/07 nathans@sgi.com 1.1041.1.3 # [XFS] Fix a pagebuf leak with the pagebufs used to coordinate IO completion # for unwritten extent writes. # # SGI Modid: 2.5.x-xfs:slinx:143052a # -------------------------------------------- # 03/04/07 nathans@sgi.com 1.1041.1.4 # [XFS] Fix up some minor namespace pollution problems. # # SGI Modid: 2.5.x-xfs:slinx:143053a # -------------------------------------------- # 03/04/07 hch@sgi.com 1.1041.1.5 # [XFS] remove atomicIncWithWrap # # SGI Modid: 2.5.x-xfs:slinx:143647a # -------------------------------------------- # 03/04/07 hch@sgi.com 1.1041.1.6 # [XFS] merge over some lost changes from the XFS tree # -------------------------------------------- # 03/04/07 hch@hera.kernel.org 1.1044 # Merge # -------------------------------------------- # diff -Nru a/fs/xfs/linux/xfs_aops.c b/fs/xfs/linux/xfs_aops.c --- a/fs/xfs/linux/xfs_aops.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_aops.c Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -48,8 +48,11 @@ clear_buffer_unwritten(bh); if (!uptodate) pagebuf_ioerror(pb, -EIO); - if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) + if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { pagebuf_iodone(pb, 1, 1); + pb->pb_flags &= ~_PBF_LOCKABLE; + pagebuf_rele(pb); + } end_buffer_async_write(bh, uptodate); } @@ -160,7 +163,7 @@ delta -= mp->pbm_offset; delta >>= block_bits; - sector_shift = block_bits - 9; + sector_shift = block_bits - BBSHIFT; bn = mp->pbm_bn >> sector_shift; bn += delta; ASSERT((bn << sector_shift) >= mp->pbm_bn); @@ -282,7 +285,7 @@ total += bh->b_size; } while ((bh = bh->b_this_page) != head); - /* if we reached the end of the page, sum forwards in + /* If we reached the end of the page, sum forwards in * following pages. */ if (bh == head) { @@ -438,8 +441,11 @@ XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode)->v_fbhv); XFS_BUF_SET_IODONE_FUNC(pb, xfs_unwritten_conv); - if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) + if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { pagebuf_iodone(pb, 1, 1); + pb->pb_flags &= ~_PBF_LOCKABLE; + pagebuf_rele(pb); + } return 0; } @@ -729,8 +735,8 @@ page_dirty = 0; } } else if (startio) { - if (buffer_uptodate(bh)) { - lock_buffer(bh); + if (buffer_uptodate(bh) && + !test_and_set_bit(BH_Lock, &bh->b_state)) { bh_arr[cnt++] = bh; page_dirty = 0; } @@ -753,8 +759,7 @@ } if (mp) { - cluster_write(inode, page->index + 1, mp, - startio, unmapped); + cluster_write(inode, page->index + 1, mp, startio, unmapped); } return page_dirty; @@ -763,7 +768,7 @@ for (i = 0; i < cnt; i++) { unlock_buffer(bh_arr[i]); } - + /* * If it's delalloc and we have nowhere to put it, * throw it away, unless the lower layers told @@ -806,8 +811,7 @@ size = 1 << inode->i_blkbits; VOP_BMAP(vp, offset, size, - create ? flags : PBF_READ, - (struct page_buf_bmap_s *)&pbmap, &retpbbm, error); + create ? flags : PBF_READ, &pbmap, &retpbbm, error); if (error) return -error; @@ -825,7 +829,7 @@ delta = offset - pbmap.pbm_offset; delta >>= inode->i_blkbits; - bn = pbmap.pbm_bn >> (inode->i_blkbits - 9); + bn = pbmap.pbm_bn >> (inode->i_blkbits - BBSHIFT); bn += delta; bh_result->b_blocknr = bn; diff -Nru a/fs/xfs/linux/xfs_file.c b/fs/xfs/linux/xfs_file.c --- a/fs/xfs/linux/xfs_file.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_file.c Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -136,6 +136,7 @@ return linvfs_writev(iocb->ki_filp, &iov, 1, &iocb->ki_pos); } + STATIC ssize_t linvfs_sendfile( struct file *filp, @@ -199,9 +200,7 @@ flags |= FSYNC_DATA; ASSERT(vp); - VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); - return -error; } @@ -287,6 +286,7 @@ kfree(read_buf); return -error; } + STATIC int linvfs_file_mmap( diff -Nru a/fs/xfs/linux/xfs_globals.c b/fs/xfs/linux/xfs_globals.c --- a/fs/xfs/linux/xfs_globals.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_globals.c Tue Apr 8 03:20:37 2003 @@ -49,11 +49,6 @@ xfs_param_t xfs_params = { 0, 1, 0, 0, 0, 3 }; /* - * Used to serialize atomicIncWithWrap. - */ -spinlock_t xfs_atomic_spin = SPIN_LOCK_UNLOCKED; - -/* * Global system credential structure. */ cred_t sys_cred_val, *sys_cred = &sys_cred_val; diff -Nru a/fs/xfs/linux/xfs_globals.h b/fs/xfs/linux/xfs_globals.h --- a/fs/xfs/linux/xfs_globals.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_globals.h Tue Apr 8 03:20:37 2003 @@ -38,11 +38,7 @@ */ extern uint64_t xfs_panic_mask; /* set to cause more panics */ - extern unsigned long xfs_physmem; - -extern spinlock_t xfs_atomic_spin; - extern struct cred *sys_cred; #endif /* __XFS_GLOBALS_H__ */ diff -Nru a/fs/xfs/linux/xfs_ioctl.c b/fs/xfs/linux/xfs_ioctl.c --- a/fs/xfs/linux/xfs_ioctl.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_ioctl.c Tue Apr 8 03:20:37 2003 @@ -39,11 +39,6 @@ #include -extern int xfs_change_file_space(bhv_desc_t *, int, - xfs_flock64_t *, xfs_off_t, cred_t *, int); -extern int xfs_set_dmattrs(bhv_desc_t *, u_int, u_int16_t, cred_t *); - - /* * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to * a file or fs handle. diff -Nru a/fs/xfs/linux/xfs_lrw.c b/fs/xfs/linux/xfs_lrw.c --- a/fs/xfs/linux/xfs_lrw.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_lrw.c Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff -Nru a/fs/xfs/linux/xfs_lrw.h b/fs/xfs/linux/xfs_lrw.h --- a/fs/xfs/linux/xfs_lrw.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_lrw.h Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff -Nru a/fs/xfs/linux/xfs_super.c b/fs/xfs/linux/xfs_super.c --- a/fs/xfs/linux/xfs_super.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/linux/xfs_super.c Tue Apr 8 03:20:37 2003 @@ -257,7 +257,7 @@ }; struct proc_xfs_info *xfs_infop; struct xfs_mount *mp = XFS_BHVTOM(bhv); - char b[BDEVNAME_SIZE]; + char b[BDEVNAME_SIZE]; for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { if (mp->m_flags & xfs_infop->flag) diff -Nru a/fs/xfs/support/atomic.h b/fs/xfs/support/atomic.h --- a/fs/xfs/support/atomic.h Tue Apr 8 03:20:37 2003 +++ /dev/null Wed Dec 31 16:00:00 1969 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ - */ -#ifndef __XFS_SUPPORT_ATOMIC_H__ -#define __XFS_SUPPORT_ATOMIC_H__ - -#include -#include -#include -#include -#include -#include - -/* - * This is used for two variables in XFS, one of which is a debug trace - * buffer index. They are not accessed via any other atomic operations - * so this is safe. All other atomic increments and decrements in XFS - * now use the Linux built-in functions. - */ - -extern spinlock_t xfs_atomic_spin; - -static __inline__ int atomicIncWithWrap(int *ip, int val) -{ - unsigned long flags; - int ret; - spin_lock_irqsave(&xfs_atomic_spin, flags); - ret = *ip; - (*ip)++; - if (*ip == val) *ip = 0; - spin_unlock_irqrestore(&xfs_atomic_spin, flags); - return ret; -} - -#endif /* __XFS_SUPPORT_ATOMIC_H__ */ diff -Nru a/fs/xfs/support/ktrace.c b/fs/xfs/support/ktrace.c --- a/fs/xfs/support/ktrace.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/support/ktrace.c Tue Apr 8 03:20:37 2003 @@ -37,7 +37,6 @@ #include "kmem.h" #include "spin.h" #include "debug.h" -#include "atomic.h" #include "ktrace.h" #if (defined(DEBUG) || defined(CONFIG_XFS_VNODE_TRACING)) @@ -181,6 +180,7 @@ void *val14, void *val15) { + static lock_t wrap_lock = SPIN_LOCK_UNLOCKED; int index; ktrace_entry_t *ktep; @@ -189,7 +189,11 @@ /* * Grab an entry by pushing the index up to the next one. */ - index = atomicIncWithWrap(&ktp->kt_index, ktp->kt_nentries); + spin_lock(&wrap_lock); + index = ktp->kt_index; + if (++ktp->kt_index == ktp->kt_nentries) + ktp->kt_index = 0; + spin_unlock(&wrap_lock); if (!ktp->kt_rollover && index == ktp->kt_nentries - 1) ktp->kt_rollover = 1; diff -Nru a/fs/xfs/xfs.h b/fs/xfs/xfs.h --- a/fs/xfs/xfs.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs.h Tue Apr 8 03:20:37 2003 @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff -Nru a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h --- a/fs/xfs/xfs_bmap_btree.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_bmap_btree.h Tue Apr 8 03:20:37 2003 @@ -459,6 +459,8 @@ #endif +#ifdef __KERNEL__ + /* * Prototypes for xfs_bmap.c to call. */ @@ -706,5 +708,6 @@ xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); +#endif /* __KERNEL__ */ #endif /* __XFS_BMAP_BTREE_H__ */ diff -Nru a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h --- a/fs/xfs/xfs_dmapi.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_dmapi.h Tue Apr 8 03:20:37 2003 @@ -186,7 +186,7 @@ extern struct bhv_vfsops xfs_dmops; -extern void xfs_dm_init(void); -extern void xfs_dm_exit(void); +extern int dmapi_init(void); +extern void dmapi_uninit(void); #endif /* __XFS_DMAPI_H__ */ diff -Nru a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h --- a/fs/xfs/xfs_fs.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_fs.h Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 1995-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License @@ -44,21 +44,25 @@ * d_miniosz is the min xfer size, xfer size multiple and file seek offset * alignment. */ +#ifndef HAVE_DIOATTR struct dioattr { __u32 d_mem; /* data buffer memory alignment */ __u32 d_miniosz; /* min xfer size */ __u32 d_maxiosz; /* max xfer size */ }; +#endif /* * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR. */ +#ifndef HAVE_FSXATTR struct fsxattr { __u32 fsx_xflags; /* xflags field value (get/set) */ __u32 fsx_extsize; /* extsize field value (get/set)*/ __u32 fsx_nextents; /* nextents field value (get) */ unsigned char fsx_pad[16]; }; +#endif /* * Flags for the bs_xflags/fsx_xflags field @@ -79,6 +83,7 @@ * number of array elements given. The first structure is updated on * return to give the offset and length for the next call. */ +#ifndef HAVE_GETBMAP struct getbmap { __s64 bmv_offset; /* file offset of segment in blocks */ __s64 bmv_block; /* starting block (64-bit daddr_t) */ @@ -86,6 +91,7 @@ __s32 bmv_count; /* # of entries in array incl. 1st */ __s32 bmv_entries; /* # of entries filled in (output) */ }; +#endif /* * Structure for XFS_IOC_GETBMAPX. Fields bmv_offset through bmv_entries @@ -96,6 +102,7 @@ * in by the XFS_IOC_GETBMAPX command for each returned structure after * the first. */ +#ifndef HAVE_GETBMAPX struct getbmapx { __s64 bmv_offset; /* file offset of segment in blocks */ __s64 bmv_block; /* starting block (64-bit daddr_t) */ @@ -107,6 +114,7 @@ __s32 bmv_unused1; /* future use */ __s32 bmv_unused2; /* future use */ }; +#endif /* bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */ #define BMV_IF_ATTRFORK 0x1 /* return attr fork rather than data */ @@ -136,11 +144,13 @@ * only values previously obtained via xfs_bulkstat! (Specifically the * xfs_bstat_t fields bs_dmevmask and bs_dmstate.) */ +#ifndef HAVE_FSDMIDATA struct fsdmidata { __u32 fsd_dmevmask; /* corresponds to di_dmevmask */ __u16 fsd_padding; __u16 fsd_dmstate; /* corresponds to di_dmstate */ }; +#endif /* * File segment locking set data type for 64 bit access. @@ -391,7 +401,7 @@ * This is typically called by a stateless file server in order to generate * "file handles". */ -#ifndef MAXFIDSZ +#ifndef HAVE_FID #define MAXFIDSZ 46 typedef struct fid { __u16 fid_len; /* length of data in bytes */ @@ -472,7 +482,7 @@ #define XFS_IOC_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log) #define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt) #define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts) -#define XFS_IOC_SET_RESBLKS _IOR ('X', 114, struct xfs_fsop_resblks) +#define XFS_IOC_SET_RESBLKS _IOWR('X', 114, struct xfs_fsop_resblks) #define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks) #define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection) #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection) @@ -486,6 +496,7 @@ /* XFS_IOC_GETFSUUID ---------- deprecated 140 */ +#ifndef HAVE_BBMACROS /* * Block I/O parameterization. A basic block (BB) is the lowest size of * filesystem allocation, and must equal 512. Length units given to bio @@ -497,5 +508,6 @@ #define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) #define BBTOB(bbs) ((bbs) << BBSHIFT) +#endif #endif /* __XFS_FS_H__ */ diff -Nru a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c --- a/fs/xfs/xfs_ialloc.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_ialloc.c Tue Apr 8 03:20:37 2003 @@ -336,6 +336,21 @@ return 0; } +STATIC __inline xfs_agnumber_t +xfs_ialloc_next_ag( + xfs_mount_t *mp) +{ + xfs_agnumber_t agno; + + spin_lock(&mp->m_agirotor_lock); + agno = mp->m_agirotor; + if (++mp->m_agirotor == mp->m_maxagi) + mp->m_agirotor = 0; + spin_unlock(&mp->m_agirotor_lock); + + return agno; +} + /* * Select an allocation group to look for a free inode in, based on the parent * inode and then mode. Return the allocation group buffer. @@ -366,7 +381,7 @@ mp = tp->t_mountp; agcount = mp->m_maxagi; if (S_ISDIR(mode)) - pagno = atomicIncWithWrap((int *)&mp->m_agirotor, agcount); + pagno = xfs_ialloc_next_ag(mp); else { pagno = XFS_INO_TO_AGNO(mp, parent); if (pagno >= agcount) @@ -394,7 +409,7 @@ agbp = NULL; if (!pag->pagi_inodeok) { - atomicIncWithWrap((int *)&mp->m_agirotor, agcount); + xfs_ialloc_next_ag(mp); goto unlock_nextag; } diff -Nru a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c --- a/fs/xfs/xfs_iget.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_iget.c Tue Apr 8 03:20:37 2003 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff -Nru a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c --- a/fs/xfs/xfs_inode.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_inode.c Tue Apr 8 03:20:37 2003 @@ -3608,31 +3608,6 @@ ip->i_update_core = 1; } -/* - * xfs_ibusy_check -- Checks whether inode reference count allows unmount - * - * The value returned is one if the reference count would prevent an unmount. - */ -int -xfs_ibusy_check( - xfs_inode_t *ip, - int refs) -{ - xfs_mount_t *mp = ip->i_mount; - - if ((refs == 1) && (ip == mp->m_rootip)) - return (0); - if ((refs == 1) && (ip == mp->m_rbmip)) - return (0); - if ((refs == 1) && (ip == mp->m_rsumip)) - return (0); - if (mp->m_quotainfo && ip->i_ino == mp->m_sb.sb_uquotino) - return (0); - if (mp->m_quotainfo && ip->i_ino == mp->m_sb.sb_gquotino) - return (0); - return (1); -} - #ifdef XFS_ILOCK_TRACE void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra) diff -Nru a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h --- a/fs/xfs/xfs_inode.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_inode.h Tue Apr 8 03:20:37 2003 @@ -516,7 +516,6 @@ int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int); int xfs_iflush(xfs_inode_t *, uint); int xfs_iflush_all(struct xfs_mount *, int); -int xfs_ibusy_check(xfs_inode_t *, int); int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *); uint xfs_iroundup(uint); void xfs_ichgtime(xfs_inode_t *, int); diff -Nru a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c --- a/fs/xfs/xfs_mount.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_mount.c Tue Apr 8 03:20:37 2003 @@ -509,6 +509,7 @@ int i; mp->m_agfrotor = mp->m_agirotor = 0; + spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock"); mp->m_maxagi = mp->m_sb.sb_agcount; mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG; mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT; diff -Nru a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h --- a/fs/xfs/xfs_mount.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_mount.h Tue Apr 8 03:20:37 2003 @@ -291,6 +291,7 @@ int m_bsize; /* fs logical block size */ xfs_agnumber_t m_agfrotor; /* last ag where space found */ xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ + lock_t m_agirotor_lock;/* .. and lock protecting it */ xfs_agnumber_t m_maxagi; /* highest inode alloc group */ int m_ihsize; /* size of next field */ struct xfs_ihash *m_ihash; /* fs private inode hash table*/ diff -Nru a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h --- a/fs/xfs/xfs_rw.h Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_rw.h Tue Apr 8 03:20:37 2003 @@ -153,39 +153,55 @@ xfs_bioerror( struct xfs_buf *b); -/* - * XFS I/O core functions - */ -extern int xfs_bioerror_relse(struct xfs_buf *); +int +xfs_bioerror_relse( + struct xfs_buf *b); + +int +xfs_read_buf( + struct xfs_mount *mp, + xfs_buftarg_t *target, + xfs_daddr_t blkno, + int len, + uint flags, + struct xfs_buf **bpp); + +void +xfs_ioerror_alert( + char *func, + struct xfs_mount *mp, + xfs_buf_t *bp, + xfs_daddr_t blkno); /* - * Needed by xfs_rw.c + * Prototypes for functions in xfs_vnodeops.c. */ + int xfs_rwlock( - bhv_desc_t *bdp, - vrwlock_t write_lock); + bhv_desc_t *bdp, + vrwlock_t write_lock); void xfs_rwunlock( - bhv_desc_t *bdp, - vrwlock_t write_lock); + bhv_desc_t *bdp, + vrwlock_t write_lock); int -xfs_read_buf( - struct xfs_mount *mp, - xfs_buftarg_t *target, - xfs_daddr_t blkno, - int len, - uint flags, - struct xfs_buf **bpp); +xfs_change_file_space( + bhv_desc_t *bdp, + int cmd, + xfs_flock64_t *bf, + xfs_off_t offset, + cred_t *credp, + int flags); -void -xfs_ioerror_alert( - char *func, - struct xfs_mount *mp, - xfs_buf_t *bp, - xfs_daddr_t blkno); +int +xfs_set_dmattrs( + bhv_desc_t *bdp, + u_int evmask, + u_int16_t state, + cred_t *credp); #endif /* __XFS_RW_H__ */ diff -Nru a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c --- a/fs/xfs/xfs_vfsops.c Tue Apr 8 03:20:37 2003 +++ b/fs/xfs/xfs_vfsops.c Tue Apr 8 03:20:37 2003 @@ -34,9 +34,7 @@ #include -STATIC int xfs_ibusy(xfs_mount_t *); STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); -STATIC int xfs_unmount(bhv_desc_t *, int, cred_t *); int xfs_init(void) @@ -485,59 +483,6 @@ return error; } -/* - * xfs_ibusy searches for a busy inode in the mounted file system. - * - * Return 0 if there are no active inodes otherwise return 1. - */ -STATIC int -xfs_ibusy( - xfs_mount_t *mp) -{ - xfs_inode_t *ip; - vnode_t *vp; - int busy; - - busy = 0; - - XFS_MOUNT_ILOCK(mp); - - ip = mp->m_inodes; - if (ip == NULL) { - XFS_MOUNT_IUNLOCK(mp); - return busy; - } - - do { - /* Skip markers inserted by xfs_sync */ - if (ip->i_mount == NULL) { - ip = ip->i_mnext; - continue; - } - - vp = XFS_ITOV_NULL(ip); - - if (vp && vn_count(vp) != 0) { - if (xfs_ibusy_check(ip, vn_count(vp)) == 0) { - ip = ip->i_mnext; - continue; - } -#ifdef DEBUG - cmn_err(CE_WARN, "%s: busy vp=0x%p ip=0x%p " - "inum %Ld count=%d", - __FUNCTION__, vp, ip, ip->i_ino, vn_count(vp)); -#endif - busy++; - } - ip = ip->i_mnext; - } while ((ip != mp->m_inodes) && !busy); - - XFS_MOUNT_IUNLOCK(mp); - - return busy; -} - - STATIC int xfs_unmount( bhv_desc_t *bdp, @@ -570,16 +515,6 @@ unmount_event_wanted = 1; unmount_event_flags = (mp->m_dmevmask & (1<m_ddev_targp);