diff options
165 files changed, 5250 insertions, 3678 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 738ebec594dc..0996377c34f9 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -11,7 +11,7 @@ # # 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 +# 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. diff --git a/fs/xfs/linux/xfs_aops.c b/fs/xfs/linux/xfs_aops.c index cd44f85944d7..c5e6d64030ca 100644 --- a/fs/xfs/linux/xfs_aops.c +++ b/fs/xfs/linux/xfs_aops.c @@ -30,7 +30,27 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_trans.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_alloc_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_error.h" +#include "xfs_rw.h" #include <linux/mpage.h> STATIC void convert_page(struct inode *, struct page *, @@ -50,8 +70,6 @@ linvfs_unwritten_done( pagebuf_ioerror(pb, -EIO); 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); } @@ -61,28 +79,21 @@ linvfs_unwritten_done( * to written extents. */ STATIC void -xfs_unwritten_conv( - xfs_buf_t *bp) +linvfs_unwritten_conv( + xfs_buf_t *bp) { - bhv_desc_t *bdp = XFS_BUF_FSPRIVATE(bp, bhv_desc_t *); - xfs_mount_t *mp; - xfs_inode_t *ip; + vnode_t *vp = XFS_BUF_FSPRIVATE(bp, vnode_t *); + int error; - ip = XFS_BHVTOI(bdp); - mp = ip->i_mount; + if (atomic_read(&bp->pb_hold) < 1) + BUG(); - if (XFS_TEST_ERROR(XFS_BUF_GETERROR(bp), mp, - XFS_ERRTAG_STRATCMPL_IOERR, - XFS_RANDOM_STRATCMPL_IOERR)) { - xfs_ioerror_alert(__FUNCTION__, mp, bp, XFS_BUF_ADDR(bp)); - } - - XFS_IOMAP_WRITE_UNWRITTEN(mp, &ip->i_iocore, - XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp)); + VOP_BMAP(vp, XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp), + BMAP_UNWRITTEN, NULL, NULL, error); XFS_BUF_SET_FSPRIVATE(bp, NULL); XFS_BUF_CLR_IODONE_FUNC(bp); XFS_BUF_UNDATAIO(bp); - xfs_biodone(bp); + pagebuf_iodone(bp, 0, 0); } STATIC int @@ -96,20 +107,20 @@ map_blocks( vnode_t *vp = LINVFS_GET_VP(inode); int error, nmaps = 1; - if (((flags & (PBF_DIRECT|PBF_SYNC)) == PBF_DIRECT) && + if (((flags & (BMAP_DIRECT|BMAP_SYNC)) == BMAP_DIRECT) && (offset >= inode->i_size)) count = max_t(ssize_t, count, XFS_WRITE_IO_LOG); retry: VOP_BMAP(vp, offset, count, flags, pbmapp, &nmaps, error); - if (error == EAGAIN) + if ((error == EAGAIN) || (error == EIO)) return -error; - if (unlikely((flags & (PBF_WRITE|PBF_DIRECT)) == - (PBF_WRITE|PBF_DIRECT) && nmaps && + if (unlikely((flags & (BMAP_WRITE|BMAP_DIRECT)) == + (BMAP_WRITE|BMAP_DIRECT) && nmaps && (pbmapp->pbm_flags & PBMF_DELAY))) { - flags = PBF_FILE_ALLOCATE; + flags = BMAP_ALLOCATE; goto retry; } - if (flags & (PBF_WRITE|PBF_FILE_ALLOCATE)) { + if (flags & (BMAP_WRITE|BMAP_ALLOCATE)) { VMODIFY(vp); } return -error; @@ -371,7 +382,7 @@ map_unwritten( offset += p_offset; pb = pagebuf_lookup(mp->pbm_target, - mp->pbm_offset, mp->pbm_bsize, _PBF_LOCKABLE); + mp->pbm_offset, mp->pbm_bsize, 0); if (!pb) return -ENOMEM; @@ -390,7 +401,6 @@ map_unwritten( tmp = match_offset_to_mapping(start_page, mp, p_offset); if (!tmp) break; - BUG_ON(!(tmp->pbm_flags & PBMF_UNWRITTEN)); map_buffer_at_offset(start_page, bh, p_offset, block_bits, mp); set_buffer_unwritten_io(bh); bh->b_private = pb; @@ -398,6 +408,12 @@ map_unwritten( nblocks++; } while ((bh = bh->b_this_page) != head); + if (unlikely(nblocks == 0)) { + printk("XFS: bad unwritten extent map: bh=0x%p, mp=0x%p\n", + curr, mp); + BUG(); + } + atomic_add(nblocks, &pb->pb_io_remaining); /* If we reached the end of the page, map forwards in any @@ -436,15 +452,14 @@ map_unwritten( size <<= block_bits; /* convert fsb's to byte range */ XFS_BUF_DATAIO(pb); + XFS_BUF_ASYNC(pb); XFS_BUF_SET_SIZE(pb, size); XFS_BUF_SET_OFFSET(pb, offset); - XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode)->v_fbhv); - XFS_BUF_SET_IODONE_FUNC(pb, xfs_unwritten_conv); + XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode)); + XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_conv); 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; @@ -546,6 +561,7 @@ convert_page( } else { set_buffer_dirty(bh); unlock_buffer(bh); + mark_buffer_dirty(bh); } } while (i++, (bh = bh->b_this_page) != head); @@ -583,7 +599,7 @@ cluster_write( /* * Calling this without startio set means we are being asked to make a dirty * page ready for freeing it's buffers. When called with startio set then - * we are coming from writepage. + * we are coming from writepage. * * When called with startio set it is important that we write the WHOLE * page if possible. @@ -611,7 +627,7 @@ page_state_convert( unsigned long p_offset = 0, end_index; loff_t offset, end_offset; int len, err, i, cnt = 0, uptodate = 1; - int flags = startio ? 0 : PBF_TRYLOCK; + int flags = startio ? 0 : BMAP_TRYLOCK; int page_dirty = 1; @@ -649,7 +665,7 @@ page_state_convert( if (buffer_unwritten(bh)) { if (!mp) { err = map_blocks(inode, offset, len, &map, - PBF_FILE_UNWRITTEN); + BMAP_READ|BMAP_IGNSTATE); if (err) { goto error; } @@ -671,6 +687,7 @@ page_state_convert( } else { set_buffer_dirty(bh); unlock_buffer(bh); + mark_buffer_dirty(bh); } page_dirty = 0; } @@ -681,7 +698,7 @@ page_state_convert( } else if (buffer_delay(bh)) { if (!mp) { err = map_blocks(inode, offset, len, &map, - PBF_FILE_ALLOCATE | flags); + BMAP_ALLOCATE | flags); if (err) { goto error; } @@ -696,6 +713,7 @@ page_state_convert( } else { set_buffer_dirty(bh); unlock_buffer(bh); + mark_buffer_dirty(bh); } page_dirty = 0; } @@ -714,8 +732,8 @@ page_state_convert( size = probe_unmapped_cluster( inode, page, bh, head); err = map_blocks(inode, offset, - size, &map, - PBF_WRITE | PBF_DIRECT); + size, &map, + BMAP_WRITE | BMAP_MMAP); if (err) { goto error; } @@ -731,6 +749,7 @@ page_state_convert( } else { set_buffer_dirty(bh); unlock_buffer(bh); + mark_buffer_dirty(bh); } page_dirty = 0; } @@ -754,13 +773,11 @@ next_bh: if (uptodate) SetPageUptodate(page); - if (startio) { + if (startio) submit_page(page, bh_arr, cnt); - } - if (mp) { + if (mp) cluster_write(inode, page->index + 1, mp, startio, unmapped); - } return page_dirty; @@ -791,7 +808,7 @@ linvfs_get_block_core( struct buffer_head *bh_result, int create, int direct, - page_buf_flags_t flags) + bmapi_flags_t flags) { vnode_t *vp = LINVFS_GET_VP(inode); page_buf_bmap_t pbmap; @@ -811,7 +828,7 @@ linvfs_get_block_core( size = 1 << inode->i_blkbits; VOP_BMAP(vp, offset, size, - create ? flags : PBF_READ, &pbmap, &retpbbm, error); + create ? flags : BMAP_READ, &pbmap, &retpbbm, error); if (error) return -error; @@ -881,7 +898,7 @@ linvfs_get_block( int create) { return linvfs_get_block_core(inode, iblock, 0, bh_result, - create, 0, PBF_WRITE); + create, 0, BMAP_WRITE); } STATIC int @@ -892,7 +909,7 @@ linvfs_get_block_sync( int create) { return linvfs_get_block_core(inode, iblock, 0, bh_result, - create, 0, PBF_SYNC|PBF_WRITE); + create, 0, BMAP_SYNC|BMAP_WRITE); } STATIC int @@ -904,7 +921,7 @@ linvfs_get_blocks_direct( int create) { return linvfs_get_block_core(inode, iblock, max_blocks, bh_result, - create, 1, PBF_WRITE|PBF_DIRECT); + create, 1, BMAP_WRITE|BMAP_DIRECT); } STATIC int diff --git a/fs/xfs/linux/xfs_behavior.c b/fs/xfs/linux/xfs_behavior.c index b69fb1d94c28..16088e175ecc 100644 --- a/fs/xfs/linux/xfs_behavior.c +++ b/fs/xfs/linux/xfs_behavior.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * */ -#include <xfs.h> +#include "xfs.h" /* * Source file used to associate/disassociate behaviors with virtualized @@ -94,7 +94,7 @@ bhv_insert(bhv_head_t *bhp, bhv_desc_t *bdp) prev->bd_next = bdp; } - return 0; + return 0; } /* diff --git a/fs/xfs/linux/xfs_behavior.h b/fs/xfs/linux/xfs_behavior.h index bae4c9359810..d5ed5a843921 100644 --- a/fs/xfs/linux/xfs_behavior.h +++ b/fs/xfs/linux/xfs_behavior.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,8 +36,8 @@ * Header file used to associate behaviors with virtualized objects. * * A virtualized object is an internal, virtualized representation of - * OS entities such as persistent files, processes, or sockets. Examples - * of virtualized objects include vnodes, vprocs, and vsockets. Often + * OS entities such as persistent files, processes, or sockets. Examples + * of virtualized objects include vnodes, vprocs, and vsockets. Often * a virtualized object is referred to simply as an "object." * * A behavior is essentially an implementation layer associated with @@ -91,7 +91,7 @@ * active object * */ - + struct bhv_head_lock; /* @@ -179,10 +179,10 @@ extern void bhv_insert_initial(bhv_head_t *, bhv_desc_t *); if ((bhp)->bh_first == (bdp)) { \ /* \ * Remove from front of chain. \ - * Atomic wrt oip's. \ + * Atomic wrt oip's. \ */ \ (bhp)->bh_first = (bdp)->bd_next; \ - } else { \ + } else { \ /* remove from non-front of chain */ \ bhv_remove_not_first(bhp, bdp); \ } \ diff --git a/fs/xfs/linux/xfs_cred.h b/fs/xfs/linux/xfs_cred.h index 1f20adc8fd21..00c45849d41a 100644 --- a/fs/xfs/linux/xfs_cred.h +++ b/fs/xfs/linux/xfs_cred.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -47,4 +47,4 @@ static __inline int capable_cred(cred_t *cr, int cid) return (cr == sys_cred) ? 1 : capable(cid); } -#endif /* __XFS_CRED_H__ */ +#endif /* __XFS_CRED_H__ */ diff --git a/fs/xfs/linux/xfs_file.c b/fs/xfs/linux/xfs_file.c index 7848ed4c4fac..e4e4f9f33ee6 100644 --- a/fs/xfs/linux/xfs_file.c +++ b/fs/xfs/linux/xfs_file.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,28 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_trans.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_alloc_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_error.h" +#include "xfs_rw.h" + #include <linux/dcache.h> #include <linux/mman.h> /* for PROT_WRITE */ @@ -209,7 +230,7 @@ linvfs_fsync( * We need to build a uio, cred, ... */ -#define nextdp(dp) ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen)) +#define nextdp(dp) ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen)) STATIC int linvfs_readdir( diff --git a/fs/xfs/linux/xfs_fs_subr.c b/fs/xfs/linux/xfs_fs_subr.c index 0ba2a3462480..afad97018512 100644 --- a/fs/xfs/linux/xfs_fs_subr.c +++ b/fs/xfs/linux/xfs_fs_subr.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" /* * Stub for no-op vnode operations that return error status. @@ -122,4 +122,3 @@ fs_flush_pages( return 0; } - diff --git a/fs/xfs/linux/xfs_fs_subr.h b/fs/xfs/linux/xfs_fs_subr.h index f6edf6aae595..198b8dd7818d 100644 --- a/fs/xfs/linux/xfs_fs_subr.h +++ b/fs/xfs/linux/xfs_fs_subr.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,7 +29,7 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_SUBR_H__ +#ifndef __XFS_SUBR_H__ #define __XFS_SUBR_H__ /* diff --git a/fs/xfs/linux/xfs_globals.c b/fs/xfs/linux/xfs_globals.c index da5d0fe00b63..c6618db530fa 100644 --- a/fs/xfs/linux/xfs_globals.c +++ b/fs/xfs/linux/xfs_globals.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,7 +35,9 @@ * somewhere else in IRIX. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_bmap_btree.h" +#include "xfs_bit.h" /* * System memory size - used to scale certain data structures in XFS. diff --git a/fs/xfs/linux/xfs_globals.h b/fs/xfs/linux/xfs_globals.h index 42d9f3ac180a..e81e2f38a853 100644 --- a/fs/xfs/linux/xfs_globals.h +++ b/fs/xfs/linux/xfs_globals.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -37,7 +37,7 @@ * somewhere else in IRIX. */ -extern uint64_t xfs_panic_mask; /* set to cause more panics */ +extern uint64_t xfs_panic_mask; /* set to cause more panics */ extern unsigned long xfs_physmem; extern struct cred *sys_cred; diff --git a/fs/xfs/linux/xfs_ioctl.c b/fs/xfs/linux/xfs_ioctl.c index a713421e24f8..8af21ab163b8 100644 --- a/fs/xfs/linux/xfs_ioctl.c +++ b/fs/xfs/linux/xfs_ioctl.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,9 +30,43 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <xfs_fsops.h> -#include <xfs_dfrag.h> +#include "xfs.h" + +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_utils.h" +#include "xfs_dfrag.h" +#include "xfs_fsops.h" + #include <linux/dcache.h> #include <linux/mount.h> #include <linux/namei.h> @@ -168,7 +202,7 @@ xfs_find_handle( STATIC int xfs_vget_fsop_handlereq( xfs_mount_t *mp, - struct inode *parinode, /* parent inode pointer */ + struct inode *parinode, /* parent inode pointer */ int cap, /* capability level for op */ unsigned long arg, /* userspace data pointer */ unsigned long size, /* size of expected struct */ @@ -362,10 +396,10 @@ xfs_readlink_by_handle( aiov.iov_base = hreq.ohandle; auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; + auio.uio_iovcnt = 1; auio.uio_fmode = FINVIS; - auio.uio_offset = 0; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_offset = 0; + auio.uio_segflg = UIO_USERSPACE; auio.uio_resid = olen; VOP_READLINK(vp, &auio, NULL, error); @@ -578,7 +612,7 @@ xfs_ioctl( case XFS_IOC_FREESP64: case XFS_IOC_RESVSP64: case XFS_IOC_UNRESVSP64: - /* + /* * Only allow the sys admin to reserve space unless * unwritten extents are enabled. */ @@ -986,7 +1020,7 @@ xfs_ioc_xattr( return -XFS_ERROR(EFAULT); return 0; } - + default: return -ENOTTY; diff --git a/fs/xfs/linux/xfs_iomap.c b/fs/xfs/linux/xfs_iomap.c index a96e2141e141..0dabea81e81a 100644 --- a/fs/xfs/linux/xfs_iomap.c +++ b/fs/xfs/linux/xfs_iomap.c @@ -30,7 +30,43 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_trans_space.h" +#include "xfs_utils.h" #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \ << mp->m_writeio_log) @@ -97,7 +133,7 @@ xfs_iomap( { xfs_mount_t *mp = io->io_mount; xfs_fileoff_t offset_fsb, end_fsb; - int error; + int error = 0; int lockmode = 0; xfs_bmbt_irec_t imap; int nimaps = 1; @@ -107,32 +143,31 @@ xfs_iomap( return XFS_ERROR(EIO); switch (flags & - (PBF_READ|PBF_WRITE|PBF_FILE_ALLOCATE|PBF_FILE_UNWRITTEN)) { - case PBF_READ: + (BMAP_READ|BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) { + case BMAP_READ: lockmode = XFS_LCK_MAP_SHARED(mp, io); bmap_flags = XFS_BMAPI_ENTIRE; + if (flags & BMAP_IGNSTATE) + bmap_flags |= XFS_BMAPI_IGSTATE; break; case PBF_WRITE: lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; bmap_flags = 0; XFS_ILOCK(mp, io, lockmode); break; - case PBF_FILE_ALLOCATE: + case BMAP_ALLOCATE: lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD; bmap_flags = XFS_BMAPI_ENTIRE; /* Attempt non-blocking lock */ - if (flags & PBF_TRYLOCK) { + if (flags & BMAP_TRYLOCK) { if (!XFS_ILOCK_NOWAIT(mp, io, lockmode)) return XFS_ERROR(EAGAIN); } else { XFS_ILOCK(mp, io, lockmode); } break; - case PBF_FILE_UNWRITTEN: - lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; - bmap_flags = XFS_BMAPI_ENTIRE|XFS_BMAPI_IGSTATE; - XFS_ILOCK(mp, io, lockmode); - break; + case BMAP_UNWRITTEN: + goto phase2; default: BUG(); } @@ -148,13 +183,14 @@ xfs_iomap( if (error) goto out; - switch (flags & (PBF_WRITE|PBF_FILE_ALLOCATE)) { - case PBF_WRITE: +phase2: + switch (flags & (BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) { + case BMAP_WRITE: /* If we found an extent, return it */ if (nimaps && (imap.br_startblock != HOLESTARTBLOCK)) break; - if (flags & PBF_DIRECT) { + if (flags & (BMAP_DIRECT|BMAP_MMAP)) { error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset, count, flags, &imap, &nimaps, nimaps); } else { @@ -162,7 +198,7 @@ xfs_iomap( flags, &imap, &nimaps); } break; - case PBF_FILE_ALLOCATE: + case BMAP_ALLOCATE: /* If we found an extent, return it */ XFS_IUNLOCK(mp, io, lockmode); lockmode = 0; @@ -172,12 +208,17 @@ xfs_iomap( error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); break; + case BMAP_UNWRITTEN: + lockmode = 0; + error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count); + nimaps = 0; + break; } if (nimaps) { *npbmaps = _xfs_imap_to_bmap(io, offset, &imap, pbmapp, nimaps, *npbmaps); - } else { + } else if (npbmaps) { *npbmaps = 0; } @@ -203,13 +244,13 @@ xfs_flush_space( xfs_ilock(ip, XFS_ILOCK_EXCL); *fsynced = 1; } else { - *ioflags |= PBF_SYNC; + *ioflags |= BMAP_SYNC; *fsynced = 2; } return 0; case 1: *fsynced = 2; - *ioflags |= PBF_SYNC; + *ioflags |= BMAP_SYNC; return 0; case 2: xfs_iunlock(ip, XFS_ILOCK_EXCL); @@ -228,7 +269,7 @@ xfs_iomap_write_direct( xfs_inode_t *ip, loff_t offset, size_t count, - int ioflag, + int flags, xfs_bmbt_irec_t *ret_imap, int *nmaps, int found) @@ -265,7 +306,7 @@ xfs_iomap_write_direct( maps = min(XFS_WRITE_IMAPS, *nmaps); nimaps = maps; - isize = ip->i_d.di_size; + isize = ip->i_d.di_size; aeof = (offset + count) > isize; if (io->io_new_size > isize) @@ -342,7 +383,7 @@ xfs_iomap_write_direct( xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_ihold(tp, ip); - if (offset < ip->i_d.di_size || rt) + if (!(flags & BMAP_MMAP) && (offset < ip->i_d.di_size || rt)) bmapi_flag |= XFS_BMAPI_PREALLOC; /* @@ -441,7 +482,7 @@ retry: * We don't bother with this for sync writes, because we need * to minimize the amount we write for good performance. */ - if (!(ioflag & PBF_SYNC) && ((offset + count) > ip->i_d.di_size)) { + if (!(ioflag & BMAP_SYNC) && ((offset + count) > ip->i_d.di_size)) { xfs_off_t aligned_offset; unsigned int iosize; xfs_fileoff_t ioalign; @@ -628,7 +669,7 @@ xfs_iomap_write_allocate( for (i = 0; i < nimaps; i++) { if ((map->br_startoff >= imap[i].br_startoff) && (map->br_startoff < (imap[i].br_startoff + - imap[i].br_blockcount))) { + imap[i].br_blockcount))) { *map = imap[i]; *retmap = 1; XFS_STATS_INC(xfsstats.xs_xstrat_quick); diff --git a/fs/xfs/linux/xfs_iops.c b/fs/xfs/linux/xfs_iops.c index 3ef73803fee0..f918e06b5989 100644 --- a/fs/xfs/linux/xfs_iops.c +++ b/fs/xfs/linux/xfs_iops.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,42 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_utils.h" + #include <linux/xattr.h> @@ -478,7 +513,7 @@ linvfs_setattr( VOP_SETATTR(vp, &vattr, flags, NULL, error); if (error) - return(-error); /* Positive error up from XFS */ + return(-error); /* Positive error up from XFS */ if (ia_valid & ATTR_SIZE) { error = vmtruncate(inode, attr->ia_size); } diff --git a/fs/xfs/linux/xfs_iops.h b/fs/xfs/linux/xfs_iops.h index 18e40c8ca56f..747f78677271 100644 --- a/fs/xfs/linux/xfs_iops.h +++ b/fs/xfs/linux/xfs_iops.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/linux/xfs_linux.h b/fs/xfs/linux/xfs_linux.h index aba0b1fdf2dc..1387dc68f477 100644 --- a/fs/xfs/linux/xfs_linux.h +++ b/fs/xfs/linux/xfs_linux.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -45,12 +45,15 @@ #include <linux/pagemap.h> #include <linux/vfs.h> #include <linux/seq_file.h> +#include <linux/init.h> +#include <linux/proc_fs.h> #include <asm/page.h> #include <asm/div64.h> #include <asm/param.h> #include <asm/uaccess.h> #include <asm/byteorder.h> +#include <asm/unaligned.h> #include <linux/xfs_behavior.h> #include <linux/xfs_vfs.h> @@ -98,41 +101,41 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) #define dpoff(DD) ((DD) & (NDPP-1)) #define NBBY 8 /* number of bits per byte */ -#define NBPC PAGE_SIZE /* Number of bytes per click */ -#define BPCSHIFT PAGE_SHIFT /* LOG2(NBPC) if exact */ +#define NBPC PAGE_SIZE /* Number of bytes per click */ +#define BPCSHIFT PAGE_SHIFT /* LOG2(NBPC) if exact */ /* * Size of block device i/o is parameterized here. * Currently the system supports page-sized i/o. */ -#define BLKDEV_IOSHIFT BPCSHIFT -#define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT) +#define BLKDEV_IOSHIFT BPCSHIFT +#define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT) /* number of BB's per block device block */ -#define BLKDEV_BB BTOBB(BLKDEV_IOSIZE) +#define BLKDEV_BB BTOBB(BLKDEV_IOSIZE) /* bytes to clicks */ -#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) -#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) -#define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) -#define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) -#define io_btoc(x) (((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT) -#define io_btoct(x) ((__psunsigned_t)(x)>>IO_BPCSHIFT) +#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) +#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) +#define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) +#define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) +#define io_btoc(x) (((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT) +#define io_btoct(x) ((__psunsigned_t)(x)>>IO_BPCSHIFT) /* off_t bytes to clicks */ -#define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) -#define offtoct(x) ((xfs_off_t)(x)>>BPCSHIFT) +#define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) +#define offtoct(x) ((xfs_off_t)(x)>>BPCSHIFT) /* clicks to off_t bytes */ -#define ctooff(x) ((xfs_off_t)(x)<<BPCSHIFT) +#define ctooff(x) ((xfs_off_t)(x)<<BPCSHIFT) /* clicks to bytes */ -#define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) -#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) -#define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) -#define io_ctob(x) ((__psunsigned_t)(x)<<IO_BPCSHIFT) +#define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) +#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) +#define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) +#define io_ctob(x) ((__psunsigned_t)(x)<<IO_BPCSHIFT) /* bytes to clicks */ -#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) +#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) #ifndef CELL_CAPABLE #define FSC_NOTIFY_NAME_CHANGED(vp) @@ -143,7 +146,7 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) #endif /* Note: EWRONGFS never visible outside the kernel */ -#define EWRONGFS EINVAL /* Mount with wrong filesystem type */ +#define EWRONGFS EINVAL /* Mount with wrong filesystem type */ /* * XXX EFSCORRUPTED needs a real value in errno.h. asm-i386/errno.h won't @@ -156,14 +159,14 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) * 3/ EUCLEAN ["Structure needs cleaning"] * 4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace] */ -#define EFSCORRUPTED 990 /* Filesystem is corrupted */ +#define EFSCORRUPTED 990 /* Filesystem is corrupted */ #define SYNCHRONIZE() barrier() #define __return_address __builtin_return_address(0) /* * IRIX (BSD) quotactl makes use of separate commands for user/group, - * whereas on Linux the syscall encodes this information into the cmd + * whereas on Linux the syscall encodes this information into the cmd * field (see the QCMD macro in quota.h). These macros help keep the * code portable - they are not visible from the syscall interface. */ diff --git a/fs/xfs/linux/xfs_lrw.c b/fs/xfs/linux/xfs_lrw.c index 6b13e270cf90..fc4a8beba1bd 100644 --- a/fs/xfs/linux/xfs_lrw.c +++ b/fs/xfs/linux/xfs_lrw.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,44 @@ * */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_inode_item.h" +#include "xfs_buf_item.h" +#include "xfs_utils.h" + #include <linux/capability.h> @@ -50,7 +87,7 @@ */ STATIC int xfs_iozero( - struct inode *ip, /* inode */ + struct inode *ip, /* inode */ loff_t pos, /* offset in file */ size_t count, /* size of data to zero */ loff_t end_size) /* max file size to set */ @@ -280,7 +317,7 @@ xfs_zero_last_block( int zero_len; int isize_fsb_offset; int error = 0; - xfs_bmbt_irec_t imap; + xfs_bmbt_irec_t imap; loff_t loff; size_t lsize; @@ -334,7 +371,7 @@ xfs_zero_last_block( /* * Zero any on disk space between the current EOF and the new, - * larger EOF. This handles the normal case of zeroing the remainder + * larger EOF. This handles the normal case of zeroing the remainder * of the last block in the file and the unusual case of zeroing blocks * out beyond the size of the file. This second case only happens * with fixed size extents and when the system crashes before the inode @@ -362,7 +399,7 @@ xfs_zero_eof( xfs_mount_t *mp; int nimaps; int error = 0; - xfs_bmbt_irec_t imap; + xfs_bmbt_irec_t imap; loff_t loff; size_t lsize; @@ -384,10 +421,10 @@ xfs_zero_eof( /* * Calculate the range between the new size and the old - * where blocks needing to be zeroed may exist. To get the + * where blocks needing to be zeroed may exist. To get the * block where the last byte in the file currently resides, * we need to subtract one from the size and truncate back - * to a block boundary. We subtract 1 in case the size is + * to a block boundary. We subtract 1 in case the size is * exactly on a block boundary. */ last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1; @@ -435,7 +472,7 @@ xfs_zero_eof( /* * There are blocks in the range requested. - * Zero them a single write at a time. We actually + * 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 @@ -709,7 +746,7 @@ retry: * 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 + * 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. * @@ -857,33 +894,6 @@ XFS_bflush(xfs_buftarg_t *target) pagebuf_delwri_flush(target, PBDF_WAIT, NULL); } - -/* Push all fs state out to disk - */ - -void -XFS_log_write_unmount_ro(bhv_desc_t *bdp) -{ - xfs_mount_t *mp; - int pincount = 0; - int count = 0; - int error; - - mp = XFS_BHVTOM(bdp); - pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount); - xfs_finish_reclaim_all(mp); - - do { - VFS_SYNC(XFS_MTOVFS(mp), SYNC_ATTR|SYNC_WAIT, NULL, error); - pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount); - if (pincount == 0) {delay(50); count++;} - } while (count < 2); - - /* Ok now write out an unmount record */ - xfs_log_unmount_write(mp); - xfs_unmountfs_writesb(mp); -} - /* * If the underlying (log or data) device is readonly, there are some * operations that cannot proceed. @@ -903,4 +913,3 @@ xfs_dev_is_read_only(xfs_mount_t *mp, char *message) return 0; } - diff --git a/fs/xfs/linux/xfs_lrw.h b/fs/xfs/linux/xfs_lrw.h index ad6be925c5bd..b85c45520fd9 100644 --- a/fs/xfs/linux/xfs_lrw.h +++ b/fs/xfs/linux/xfs_lrw.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -45,7 +45,7 @@ struct page_buf_bmap_s; /* * Maximum count of bmaps used by read and write paths. */ -#define XFS_MAX_RW_NBMAPS 4 +#define XFS_MAX_RW_NBMAPS 4 extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int, struct page_buf_bmap_s *, int *); @@ -76,8 +76,6 @@ extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t); extern int xfs_dev_is_read_only(struct xfs_mount *, char *); -extern void XFS_log_write_unmount_ro(struct bhv_desc *); - #define XFS_FSB_TO_DB_IO(io,fsb) \ (((io)->io_flags & XFS_IOCORE_RT) ? \ XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \ diff --git a/fs/xfs/linux/xfs_stats.c b/fs/xfs/linux/xfs_stats.c index 5face9af532b..d90f5bc6b78c 100644 --- a/fs/xfs/linux/xfs_stats.c +++ b/fs/xfs/linux/xfs_stats.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" #include <linux/proc_fs.h> struct xfsstats xfsstats; diff --git a/fs/xfs/linux/xfs_stats.h b/fs/xfs/linux/xfs_stats.h index c5eb3b848c5a..0393a8bfe590 100644 --- a/fs/xfs/linux/xfs_stats.h +++ b/fs/xfs/linux/xfs_stats.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/linux/xfs_super.c b/fs/xfs/linux/xfs_super.c index 73ef4ec19e95..0b63a997d69f 100644 --- a/fs/xfs/linux/xfs_super.c +++ b/fs/xfs/linux/xfs_super.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,34 +30,53 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_clnt.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_utils.h" +#include "xfs_version.h" + #include <linux/blkdev.h> #include <linux/namei.h> #include <linux/init.h> #include <linux/mount.h> -#include "xfs_version.h" STATIC struct quotactl_ops linvfs_qops; STATIC struct super_operations linvfs_sops; STATIC struct export_operations linvfs_export_ops; STATIC kmem_cache_t * linvfs_inode_cachep; -#define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */ -#define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */ -#define MNTOPT_LOGDEV "logdev" /* log device */ -#define MNTOPT_RTDEV "rtdev" /* realtime I/O device */ -#define MNTOPT_BIOSIZE "biosize" /* log2 of preferred buffered io size */ -#define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */ -#define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */ -#define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */ -#define MNTOPT_SUNIT "sunit" /* data volume stripe unit */ -#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */ -#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */ -#define MNTOPT_MTPT "mtpt" /* filesystem mount point */ -#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ -#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */ -#define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */ - STATIC struct xfs_mount_args * args_allocate( struct super_block *sb) @@ -78,221 +97,6 @@ args_allocate( return args; } -int -xfs_parseargs( - struct bhv_desc *bhv, - char *options, - struct xfs_mount_args *args, - int update) -{ - struct vfs *vfsp = bhvtovfs(bhv); - char *this_char, *value, *eov; - int dsunit, dswidth, vol_dsunit, vol_dswidth; - int iosize; - - if (!options) - return 0; - - iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0; - - while ((this_char = strsep(&options, ",")) != NULL) { - if (!*this_char) - continue; - if ((value = strchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!strcmp(this_char, MNTOPT_LOGBUFS)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_LOGBUFS); - return -EINVAL; - } - args->logbufs = simple_strtoul(value, &eov, 10); - } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { - int last, in_kilobytes = 0; - - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_LOGBSIZE); - return -EINVAL; - } - last = strlen(value) - 1; - if (value[last] == 'K' || value[last] == 'k') { - in_kilobytes = 1; - value[last] = '\0'; - } - args->logbufsize = simple_strtoul(value, &eov, 10); - if (in_kilobytes) - args->logbufsize <<= 10; - } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_LOGDEV); - return -EINVAL; - } - strncpy(args->logname, value, MAXNAMELEN); - } else if (!strcmp(this_char, MNTOPT_MTPT)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_MTPT); - return -EINVAL; - } - strncpy(args->mtpt, value, MAXNAMELEN); - } else if (!strcmp(this_char, MNTOPT_RTDEV)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_RTDEV); - return -EINVAL; - } - strncpy(args->rtname, value, MAXNAMELEN); - } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_BIOSIZE); - return -EINVAL; - } - iosize = simple_strtoul(value, &eov, 10); - args->flags |= XFSMNT_IOSIZE; - args->iosizelog = (uint8_t) iosize; - } else if (!strcmp(this_char, MNTOPT_WSYNC)) { - args->flags |= XFSMNT_WSYNC; - } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) { - args->flags |= XFSMNT_OSYNCISOSYNC; - } else if (!strcmp(this_char, MNTOPT_NORECOVERY)) { - args->flags |= XFSMNT_NORECOVERY; - } else if (!strcmp(this_char, MNTOPT_INO64)) { - args->flags |= XFSMNT_INO64; -#ifndef XFS_BIG_FILESYSTEMS - printk("XFS: %s option not allowed on this system\n", - MNTOPT_INO64); - return -EINVAL; -#endif - } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { - args->flags |= XFSMNT_NOALIGN; - } else if (!strcmp(this_char, MNTOPT_SUNIT)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_SUNIT); - return -EINVAL; - } - dsunit = simple_strtoul(value, &eov, 10); - } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { - if (!value || !*value) { - printk("XFS: %s option requires an argument\n", - MNTOPT_SWIDTH); - return -EINVAL; - } - dswidth = simple_strtoul(value, &eov, 10); - } else if (!strcmp(this_char, MNTOPT_NOUUID)) { - args->flags |= XFSMNT_NOUUID; - } else if (!strcmp(this_char, MNTOPT_NOLOGFLUSH)) { - args->flags |= XFSMNT_NOLOGFLUSH; - } else if (!strcmp(this_char, "osyncisdsync")) { - /* no-op, this is now the default */ -printk("XFS: osyncisdsync is now the default, option is deprecated.\n"); - } else if (!strcmp(this_char, "irixsgid")) { -printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n"); - } else { - printk("XFS: unknown mount option [%s].\n", this_char); - return -EINVAL; - } - } - - if (args->flags & XFSMNT_NORECOVERY) { - if ((vfsp->vfs_flag & VFS_RDONLY) == 0) { - printk("XFS: no-recovery mounts must be read-only.\n"); - return -EINVAL; - } - } - - if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) { - printk( - "XFS: sunit and swidth options incompatible with the noalign option\n"); - return -EINVAL; - } - - if ((dsunit && !dswidth) || (!dsunit && dswidth)) { - printk("XFS: sunit and swidth must be specified together\n"); - return -EINVAL; - } - - if (dsunit && (dswidth % dsunit != 0)) { - printk( - "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)\n", - dswidth, dsunit); - return -EINVAL; - } - - if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { - if (dsunit) { - args->sunit = dsunit; - args->flags |= XFSMNT_RETERR; - } else { - args->sunit = vol_dsunit; - } - dswidth ? (args->swidth = dswidth) : - (args->swidth = vol_dswidth); - } else { - args->sunit = args->swidth = 0; - } - - return 0; -} - -int -xfs_showargs( - struct bhv_desc *bhv, - struct seq_file *m) -{ - static struct proc_xfs_info { - int flag; - char *str; - } xfs_info[] = { - /* the few simple ones we can get from the mount struct */ - { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN }, - { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, - { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC }, - { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, - { 0, NULL } - }; - struct proc_xfs_info *xfs_infop; - struct xfs_mount *mp = XFS_BHVTOM(bhv); - char b[BDEVNAME_SIZE]; - - for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { - if (mp->m_flags & xfs_infop->flag) - seq_puts(m, xfs_infop->str); - } - - if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) - seq_printf(m, "," MNTOPT_BIOSIZE "=%d", mp->m_writeio_log); - - if (mp->m_logbufs > 0) - seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs); - - if (mp->m_logbsize > 0) - seq_printf(m, "," MNTOPT_LOGBSIZE "=%d", mp->m_logbsize); - - if (mp->m_ddev_targp->pbr_dev != mp->m_logdev_targp->pbr_dev) - seq_printf(m, "," MNTOPT_LOGDEV "=%s", - bdevname(mp->m_logdev_targp->pbr_bdev, b)); - - if (mp->m_rtdev_targp && - mp->m_ddev_targp->pbr_dev != mp->m_rtdev_targp->pbr_dev) - seq_printf(m, "," MNTOPT_RTDEV "=%s", - bdevname(mp->m_rtdev_targp->pbr_bdev, b)); - - if (mp->m_dalign > 0) - seq_printf(m, "," MNTOPT_SUNIT "=%d", - (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); - - if (mp->m_swidth > 0) - seq_printf(m, "," MNTOPT_SWIDTH "=%d", - (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); - - return 0; -} - STATIC __inline__ void xfs_set_inodeops( struct inode *inode) @@ -330,7 +134,7 @@ xfs_revalidate_inode( inode->i_mode = (ip->i_d.di_mode & MODEMASK) | VTTOIF(vp->v_type); inode->i_nlink = ip->i_d.di_nlink; inode->i_uid = ip->i_d.di_uid; - inode->i_gid = ip->i_d.di_gid; + inode->i_gid = ip->i_d.di_gid; if (((1 << vp->v_type) & ((1<<VBLK) | (1<<VCHR))) == 0) { inode->i_rdev = NODEV; } else { @@ -616,7 +420,6 @@ linvfs_remount( char *options) { vfs_t *vfsp = LINVFS_GET_VFS(sb); - xfs_mount_t *mp = XFS_VFSTOM(vfsp); struct xfs_mount_args *args = args_allocate(sb); int error; @@ -624,24 +427,7 @@ linvfs_remount( if (error) goto out; - if (args->flags & XFSMNT_NOATIME) - mp->m_flags |= XFS_MOUNT_NOATIME; - else - mp->m_flags &= ~XFS_MOUNT_NOATIME; - - set_posix_acl_flag(sb); - linvfs_write_super(sb); - - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) - goto out; - - if (*flags & MS_RDONLY) { - sb->s_flags |= MS_RDONLY; - XFS_log_write_unmount_ro(&mp->m_bhv); - vfsp->vfs_flag |= VFS_RDONLY; - } else { - vfsp->vfs_flag &= ~VFS_RDONLY; - } + VFS_MNTUPDATE(vfsp, flags, args, error); out: kmem_free(args, sizeof(*args)); @@ -941,7 +727,7 @@ init_xfs_fs( void ) int error; struct sysinfo si; static char message[] __initdata = - KERN_INFO "SGI XFS " XFS_VERSION_STRING " with " + KERN_INFO "SGI XFS " XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n"; printk(message); @@ -959,6 +745,7 @@ init_xfs_fs( void ) vn_init(); xfs_init(); + uuid_init(); vfs_initdmapi(); vfs_initquota(); @@ -991,7 +778,7 @@ exit_xfs_fs( void ) module_init(init_xfs_fs); module_exit(exit_xfs_fs); -MODULE_AUTHOR("SGI <sgi.com>"); +MODULE_AUTHOR("Silicon Graphics, Inc."); MODULE_DESCRIPTION( "SGI XFS " XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled"); MODULE_LICENSE("GPL"); diff --git a/fs/xfs/linux/xfs_super.h b/fs/xfs/linux/xfs_super.h index 72bedd79a0ef..98fa75e4e224 100644 --- a/fs/xfs/linux/xfs_super.h +++ b/fs/xfs/linux/xfs_super.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -92,8 +92,6 @@ struct xfs_mount; struct pb_target; struct block_device; -extern int xfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int); -extern int xfs_showargs(bhv_desc_t *, struct seq_file *); extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int); extern int xfs_blkdev_get(struct xfs_mount *, const char *, diff --git a/fs/xfs/linux/xfs_sysctl.c b/fs/xfs/linux/xfs_sysctl.c index e40ca17cc9b8..75fcbef8c573 100644 --- a/fs/xfs/linux/xfs_sysctl.c +++ b/fs/xfs/linux/xfs_sysctl.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,8 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_rw.h" #include <linux/sysctl.h> #include <linux/proc_fs.h> @@ -100,7 +101,7 @@ STATIC ctl_table xfs_dir_table[] = { }; STATIC ctl_table xfs_root_table[] = { - {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table}, + {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table}, {0} }; diff --git a/fs/xfs/linux/xfs_sysctl.h b/fs/xfs/linux/xfs_sysctl.h index 588b19f838e8..bd68cabca30e 100644 --- a/fs/xfs/linux/xfs_sysctl.h +++ b/fs/xfs/linux/xfs_sysctl.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/linux/xfs_vfs.c b/fs/xfs/linux/xfs_vfs.c index 17e6988bc7f8..ac42cb5e6b05 100644 --- a/fs/xfs/linux/xfs_vfs.c +++ b/fs/xfs/linux/xfs_vfs.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,22 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_macros.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_clnt.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_imap.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_quota.h" int vfs_mount( @@ -89,6 +104,21 @@ vfs_unmount( } int +vfs_mntupdate( + struct bhv_desc *bdp, + int *fl, + struct xfs_mount_args *args) +{ + struct bhv_desc *next = bdp; + + ASSERT(next); + while (! (bhvtovfsops(next))->vfs_mntupdate) + next = BHV_NEXT(next); + return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args)); +} + + +int vfs_root( struct bhv_desc *bdp, struct vnode **vpp) diff --git a/fs/xfs/linux/xfs_vfs.h b/fs/xfs/linux/xfs_vfs.h index b18e6424b67c..a930d9b625e5 100644 --- a/fs/xfs/linux/xfs_vfs.h +++ b/fs/xfs/linux/xfs_vfs.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -93,6 +93,8 @@ typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *, struct xfs_mount_args *, int); typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *); typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *); +typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *, + struct xfs_mount_args *); typedef int (*vfs_root_t)(bhv_desc_t *, struct vnode **); typedef int (*vfs_statvfs_t)(bhv_desc_t *, struct statfs *, struct vnode *); typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *); @@ -109,6 +111,7 @@ typedef struct vfsops { vfs_parseargs_t vfs_parseargs; /* parse mount options */ vfs_showargs_t vfs_showargs; /* unparse mount options */ vfs_unmount_t vfs_unmount; /* unmount file system */ + vfs_mntupdate_t vfs_mntupdate; /* update file system options */ vfs_root_t vfs_root; /* get root vnode */ vfs_statvfs_t vfs_statvfs; /* file system statistics */ vfs_sync_t vfs_sync; /* flush files */ @@ -126,7 +129,8 @@ typedef struct vfsops { #define VFS_MOUNT(v, ma,cr, rv) ((rv) = vfs_mount(VHEAD(v), ma,cr)) #define VFS_PARSEARGS(v, o,ma,f, rv) ((rv) = vfs_parseargs(VHEAD(v), o,ma,f)) #define VFS_SHOWARGS(v, m, rv) ((rv) = vfs_showargs(VHEAD(v), m)) -#define VFS_UNMOUNT(v, f,cr, rv) ((rv) = vfs_unmount(VHEAD(v), f,cr)) +#define VFS_UNMOUNT(v, f, cr, rv) ((rv) = vfs_unmount(VHEAD(v), f,cr)) +#define VFS_MNTUPDATE(v, fl, args, rv) ((rv) = vfs_mntupdate(VHEAD(v), fl, args)) #define VFS_ROOT(v, vpp, rv) ((rv) = vfs_root(VHEAD(v), vpp)) #define VFS_STATVFS(v, sp,vp, rv) ((rv) = vfs_statvfs(VHEAD(v), sp,vp)) #define VFS_SYNC(v, flag,cr, rv) ((rv) = vfs_sync(VHEAD(v), flag,cr)) @@ -143,6 +147,7 @@ typedef struct vfsops { #define PVFS_PARSEARGS(b, o,ma,f, rv) ((rv) = vfs_parseargs(b, o,ma,f)) #define PVFS_SHOWARGS(b, m, rv) ((rv) = vfs_showargs(b, m)) #define PVFS_UNMOUNT(b, f,cr, rv) ((rv) = vfs_unmount(b, f,cr)) +#define PVFS_MNTUPDATE(b, fl, args, rv) ((rv) = vfs_mntupdate(b, fl, args)) #define PVFS_ROOT(b, vpp, rv) ((rv) = vfs_root(b, vpp)) #define PVFS_STATVFS(b, sp,vp, rv) ((rv) = vfs_statvfs(b, sp,vp)) #define PVFS_SYNC(b, flag,cr, rv) ((rv) = vfs_sync(b, flag,cr)) @@ -156,6 +161,7 @@ extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *); extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int); extern int vfs_showargs(bhv_desc_t *, struct seq_file *); extern int vfs_unmount(bhv_desc_t *, int, struct cred *); +extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *); extern int vfs_root(bhv_desc_t *, struct vnode **); extern int vfs_statvfs(bhv_desc_t *, struct statfs *, struct vnode *); extern int vfs_sync(bhv_desc_t *, int, struct cred *); diff --git a/fs/xfs/linux/xfs_vnode.c b/fs/xfs/linux/xfs_vnode.c index c976fda746bb..6da063756c19 100644 --- a/fs/xfs/linux/xfs_vnode.c +++ b/fs/xfs/linux/xfs_vnode.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" uint64_t vn_generation; /* vnode generation number */ @@ -40,8 +40,8 @@ spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED; * Dedicated vnode inactive/reclaim sync semaphores. * Prime number of hash buckets since address is used as the key. */ -#define NVSYNC 37 -#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) +#define NVSYNC 37 +#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) sv_t vsync[NVSYNC]; /* diff --git a/fs/xfs/linux/xfs_vnode.h b/fs/xfs/linux/xfs_vnode.h index 5d247729c2bc..469836fd863f 100644 --- a/fs/xfs/linux/xfs_vnode.h +++ b/fs/xfs/linux/xfs_vnode.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -118,11 +118,11 @@ typedef enum { * Conversion between vnode types/modes and encoded type/mode as * seen by stat(2) and mknod(2). */ -extern enum vtype iftovt_tab[]; -extern ushort vttoif_tab[]; -#define IFTOVT(M) (iftovt_tab[((M) & S_IFMT) >> 12]) -#define VTTOIF(T) (vttoif_tab[(int)(T)]) -#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) +extern enum vtype iftovt_tab[]; +extern ushort vttoif_tab[]; +#define IFTOVT(M) (iftovt_tab[((M) & S_IFMT) >> 12]) +#define VTTOIF(T) (vttoif_tab[(int)(T)]) +#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) /* * Vnode flags. @@ -142,8 +142,8 @@ typedef enum vrwlock { VRWLOCK_NONE, VRWLOCK_READ, * VN_INACTIVE_NOCACHE implies that the file system behavior * has disassociated its state and bhv_desc_t from the vnode. */ -#define VN_INACTIVE_CACHE 0 -#define VN_INACTIVE_NOCACHE 1 +#define VN_INACTIVE_CACHE 0 +#define VN_INACTIVE_NOCACHE 1 /* * Values for the cmd code given to VOP_VNODE_CHANGE. @@ -203,10 +203,10 @@ typedef int (*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int, typedef int (*vop_reclaim_t)(bhv_desc_t *); typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int, struct cred *); -typedef int (*vop_attr_set_t)(bhv_desc_t *, char *, char *, int, int, +typedef int (*vop_attr_set_t)(bhv_desc_t *, char *, char *, int, int, struct cred *); -typedef int (*vop_attr_remove_t)(bhv_desc_t *, char *, int, struct cred *); -typedef int (*vop_attr_list_t)(bhv_desc_t *, char *, int, int, +typedef int (*vop_attr_remove_t)(bhv_desc_t *, char *, int, struct cred *); +typedef int (*vop_attr_list_t)(bhv_desc_t *, char *, int, int, struct attrlist_cursor_kern *, struct cred *); typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int); typedef void (*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t); @@ -218,7 +218,7 @@ typedef int (*vop_iflush_t)(bhv_desc_t *, int); typedef struct vnodeops { - bhv_position_t vn_position; /* position within behavior chain */ + bhv_position_t vn_position; /* position within behavior chain */ vop_open_t vop_open; vop_read_t vop_read; vop_write_t vop_write; @@ -274,31 +274,31 @@ typedef struct vnodeops { rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr) #define VOP_GETATTR(vp, vap, f, cr, rv) \ rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr) -#define VOP_SETATTR(vp, vap, f, cr, rv) \ +#define VOP_SETATTR(vp, vap, f, cr, rv) \ rv = _VOP_(vop_setattr, vp)((vp)->v_fbhv, vap, f, cr) -#define VOP_ACCESS(vp, mode, cr, rv) \ +#define VOP_ACCESS(vp, mode, cr, rv) \ rv = _VOP_(vop_access, vp)((vp)->v_fbhv, mode, cr) -#define VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv) \ +#define VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv) \ rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr) #define VOP_CREATE(dvp,d,vap,vpp,cr,rv) \ rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr) #define VOP_REMOVE(dvp,d,cr,rv) \ rv = _VOP_(vop_remove, dvp)((dvp)->v_fbhv,d,cr) -#define VOP_LINK(tdvp,fvp,d,cr,rv) \ +#define VOP_LINK(tdvp,fvp,d,cr,rv) \ rv = _VOP_(vop_link, tdvp)((tdvp)->v_fbhv,fvp,d,cr) -#define VOP_RENAME(fvp,fnm,tdvp,tnm,cr,rv) \ +#define VOP_RENAME(fvp,fnm,tdvp,tnm,cr,rv) \ rv = _VOP_(vop_rename, fvp)((fvp)->v_fbhv,fnm,tdvp,tnm,cr) -#define VOP_MKDIR(dp,d,vap,vpp,cr,rv) \ +#define VOP_MKDIR(dp,d,vap,vpp,cr,rv) \ rv = _VOP_(vop_mkdir, dp)((dp)->v_fbhv,d,vap,vpp,cr) #define VOP_RMDIR(dp,d,cr,rv) \ rv = _VOP_(vop_rmdir, dp)((dp)->v_fbhv,d,cr) -#define VOP_READDIR(vp,uiop,cr,eofp,rv) \ +#define VOP_READDIR(vp,uiop,cr,eofp,rv) \ rv = _VOP_(vop_readdir, vp)((vp)->v_fbhv,uiop,cr,eofp) -#define VOP_SYMLINK(dvp,d,vap,tnm,vpp,cr,rv) \ +#define VOP_SYMLINK(dvp,d,vap,tnm,vpp,cr,rv) \ rv = _VOP_(vop_symlink, dvp) ((dvp)->v_fbhv,d,vap,tnm,vpp,cr) -#define VOP_READLINK(vp,uiop,cr,rv) \ +#define VOP_READLINK(vp,uiop,cr,rv) \ rv = _VOP_(vop_readlink, vp)((vp)->v_fbhv,uiop,cr) -#define VOP_FSYNC(vp,f,cr,b,e,rv) \ +#define VOP_FSYNC(vp,f,cr,b,e,rv) \ rv = _VOP_(vop_fsync, vp)((vp)->v_fbhv,f,cr,b,e) #define VOP_INACTIVE(vp, cr, rv) \ rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr) @@ -318,11 +318,11 @@ typedef struct vnodeops { rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv) #define VOP_ATTR_GET(vp, name, val, vallenp, fl, cred, rv) \ rv = _VOP_(vop_attr_get, vp)((vp)->v_fbhv,name,val,vallenp,fl,cred) -#define VOP_ATTR_SET(vp, name, val, vallen, fl, cred, rv) \ +#define VOP_ATTR_SET(vp, name, val, vallen, fl, cred, rv) \ rv = _VOP_(vop_attr_set, vp)((vp)->v_fbhv,name,val,vallen,fl,cred) -#define VOP_ATTR_REMOVE(vp, name, flags, cred, rv) \ +#define VOP_ATTR_REMOVE(vp, name, flags, cred, rv) \ rv = _VOP_(vop_attr_remove, vp)((vp)->v_fbhv,name,flags,cred) -#define VOP_ATTR_LIST(vp, buf, buflen, fl, cursor, cred, rv) \ +#define VOP_ATTR_LIST(vp, buf, buflen, fl, cursor, cred, rv) \ rv = _VOP_(vop_attr_list, vp)((vp)->v_fbhv,buf,buflen,fl,cursor,cred) #define VOP_LINK_REMOVED(vp, dvp, linkzero) \ (void)_VOP_(vop_link_removed, vp)((vp)->v_fbhv, dvp, linkzero) @@ -569,12 +569,12 @@ static __inline__ void vn_flagclr(struct vnode *vp, uint flag) /* * Flags to VOP_SETATTR/VOP_GETATTR. */ -#define ATTR_UTIME 0x01 /* non-default utime(2) request */ -#define ATTR_EXEC 0x02 /* invocation from exec(2) */ -#define ATTR_COMM 0x04 /* yield common vp attributes */ -#define ATTR_DMI 0x08 /* invocation from a DMI function */ -#define ATTR_LAZY 0x80 /* set/get attributes lazily */ -#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ +#define ATTR_UTIME 0x01 /* non-default utime(2) request */ +#define ATTR_EXEC 0x02 /* invocation from exec(2) */ +#define ATTR_COMM 0x04 /* yield common vp attributes */ +#define ATTR_DMI 0x08 /* invocation from a DMI function */ +#define ATTR_LAZY 0x80 /* set/get attributes lazily */ +#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ #define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */ #define ATTR_NOSIZETOK 0x400 /* Don't get the DVN_SIZE_READ token */ @@ -588,33 +588,33 @@ static __inline__ void vn_flagclr(struct vnode *vp, uint flag) #if (defined(CONFIG_XFS_VNODE_TRACING)) -#define VNODE_TRACE_SIZE 16 /* number of trace entries */ +#define VNODE_TRACE_SIZE 16 /* number of trace entries */ /* * Tracing entries. */ -#define VNODE_KTRACE_ENTRY 1 -#define VNODE_KTRACE_EXIT 2 -#define VNODE_KTRACE_HOLD 3 -#define VNODE_KTRACE_REF 4 -#define VNODE_KTRACE_RELE 5 +#define VNODE_KTRACE_ENTRY 1 +#define VNODE_KTRACE_EXIT 2 +#define VNODE_KTRACE_HOLD 3 +#define VNODE_KTRACE_REF 4 +#define VNODE_KTRACE_RELE 5 extern void vn_trace_entry(struct vnode *, char *, inst_t *); extern void vn_trace_exit(struct vnode *, char *, inst_t *); extern void vn_trace_hold(struct vnode *, char *, int, inst_t *); extern void vn_trace_ref(struct vnode *, char *, int, inst_t *); extern void vn_trace_rele(struct vnode *, char *, int, inst_t *); -#define VN_TRACE(vp) \ +#define VN_TRACE(vp) \ vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address) #else /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */ -#define vn_trace_entry(a,b,c) -#define vn_trace_exit(a,b,c) -#define vn_trace_hold(a,b,c,d) -#define vn_trace_ref(a,b,c,d) -#define vn_trace_rele(a,b,c,d) -#define VN_TRACE(vp) +#define vn_trace_entry(a,b,c) +#define vn_trace_exit(a,b,c) +#define vn_trace_hold(a,b,c,d) +#define vn_trace_ref(a,b,c,d) +#define vn_trace_rele(a,b,c,d) +#define VN_TRACE(vp) #endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */ diff --git a/fs/xfs/pagebuf/page_buf.c b/fs/xfs/pagebuf/page_buf.c index 2230380e952f..6b44090ddefc 100644 --- a/fs/xfs/pagebuf/page_buf.c +++ b/fs/xfs/pagebuf/page_buf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -40,7 +40,7 @@ * cached pages for I/O. * * - * Written by Steve Lord, Jim Mostek, Russell Cattelan + * Written by Steve Lord, Jim Mostek, Russell Cattelan * and Rajagopal Ananthanarayanan ("ananth") at SGI. * */ @@ -80,7 +80,7 @@ static spinlock_t pb_trace_lock = SPIN_LOCK_UNLOCKED; struct pagebuf_trace_buf pb_trace; EXPORT_SYMBOL(pb_trace); EXPORT_SYMBOL(pb_trace_func); -#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1)) +#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1)) void pb_trace_func( @@ -129,7 +129,7 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue; * /proc/sys/vm/pagebuf */ -unsigned long pagebuf_min[P_PARAM] = { HZ/2, 1*HZ, 0, 0 }; +unsigned long pagebuf_min[P_PARAM] = { HZ/2, 1*HZ, 0, 0 }; unsigned long pagebuf_max[P_PARAM] = { HZ*30, HZ*300, 1, 1 }; pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }}; @@ -194,13 +194,13 @@ _bhash( STATIC void *pagebuf_mapout_locked(page_buf_t *); -STATIC spinlock_t as_lock = SPIN_LOCK_UNLOCKED; +STATIC spinlock_t as_lock = SPIN_LOCK_UNLOCKED; typedef struct a_list { void *vm_addr; struct a_list *next; } a_list_t; -STATIC a_list_t *as_free_head; -STATIC int as_list_len; +STATIC a_list_t *as_free_head; +STATIC int as_list_len; /* @@ -251,7 +251,7 @@ purge_addresses(void) * * Buffers associated with inodes for which buffer locking * is not enabled are not protected by semaphores, and are - * assumed to be exclusively owned by the caller. There is + * assumed to be exclusively owned by the caller. There is * spinlock in the buffer, for use by the caller when concurrent * access is possible. */ @@ -549,7 +549,7 @@ mapit: /* A single page buffer is always mappable */ if (page_count == 1) { pb->pb_addr = (caddr_t) - page_address(pb->pb_pages[0]) + pb->pb_offset; + page_address(pb->pb_pages[0]) + pb->pb_offset; pb->pb_flags |= PBF_MAPPED; } else if (flags & PBF_MAPPED) { if (as_list_len > 64) @@ -701,8 +701,8 @@ found: * * pagebuf_find returns a buffer matching the specified range of * data for the specified target, if any of the relevant blocks - * are in memory. The buffer may have unallocated holes, if - * some, but not all, of the blocks are in memory. Even where + * are in memory. The buffer may have unallocated holes, if + * some, but not all, of the blocks are in memory. Even where * pages are present in the buffer, not all of every page may be * valid. */ @@ -728,7 +728,7 @@ pagebuf_find( /* find buffer for block */ */ page_buf_t * pagebuf_get( /* allocate a buffer */ - pb_target_t *target,/* target for buffer */ + pb_target_t *target,/* target for buffer */ loff_t ioff, /* starting offset of range */ size_t isize, /* length of range */ page_buf_flags_t flags) /* PBF_TRYLOCK */ @@ -846,7 +846,7 @@ mem_to_page( void *addr) { if (((unsigned long)addr < VMALLOC_START) || - ((unsigned long)addr >= VMALLOC_END)) { + ((unsigned long)addr >= VMALLOC_END)) { return virt_to_page(addr); } else { return vmalloc_to_page(addr); @@ -1049,7 +1049,7 @@ pagebuf_rele( * pagebuf_pin * * pagebuf_pin locks all of the memory represented by a buffer in - * memory. Multiple calls to pagebuf_pin and pagebuf_unpin, for + * memory. Multiple calls to pagebuf_pin and pagebuf_unpin, for * the same or different buffers affecting a given page, will * properly count the number of outstanding "pin" requests. The * buffer may be released after the pagebuf_pin and a different @@ -1095,7 +1095,7 @@ pagebuf_ispin( * pagebuf_wait_unpin * * pagebuf_wait_unpin waits until all of the memory associated - * with the buffer is not longer locked in memory. It returns + * with the buffer is not longer locked in memory. It returns * immediately if none of the affected pages are locked. */ static inline void @@ -1575,6 +1575,13 @@ pagebuf_delwri_dequeue( spin_unlock(&pbd_delwrite_lock); } +STATIC void +pagebuf_runall_queues( + struct workqueue_struct *queue) +{ + flush_workqueue(queue); +} + /* Defines for pagebuf daemon */ DECLARE_WAIT_QUEUE_HEAD(pbd_waitq); STATIC int force_flush; @@ -1680,10 +1687,13 @@ pagebuf_delwri_flush( page_buf_t *pb; struct list_head *curr, *next, tmp; int pincount = 0; + int flush_cnt = 0; spin_lock(&pbd_delwrite_lock); INIT_LIST_HEAD(&tmp); + pagebuf_runall_queues(pagebuf_dataio_workqueue); + list_for_each_safe(curr, next, &pbd_delwrite_queue) { pb = list_entry(curr, page_buf_t, pb_list); @@ -1725,6 +1735,10 @@ pagebuf_delwri_flush( pb->pb_flags |= PBF_WRITE; __pagebuf_iorequest(pb); + if (++flush_cnt > 32) { + pagebuf_run_queues(NULL); + flush_cnt = 0; + } spin_lock(&pbd_delwrite_lock); } @@ -1776,7 +1790,7 @@ pagebuf_daemon_start(void) /* * pagebuf_daemon_stop - * + * * Note: do not mark as __exit, it is called from pagebuf_terminate. */ STATIC void @@ -1845,7 +1859,7 @@ STATIC ctl_table pagebuf_dir_table[] = { }; STATIC ctl_table pagebuf_root_table[] = { - {CTL_VM, "vm", NULL, 0, 0555, pagebuf_dir_table}, + {CTL_VM, "vm", NULL, 0, 0555, pagebuf_dir_table}, {0} }; @@ -1881,7 +1895,7 @@ pagebuf_readstats( return len; } -#endif /* CONFIG_PROC_FS */ +#endif /* CONFIG_PROC_FS */ STATIC void pagebuf_shaker(void) @@ -1935,8 +1949,8 @@ pagebuf_init(void) /* - * pagebuf_terminate. - * + * pagebuf_terminate. + * * Note: do not mark as __exit, this is also called from the __init code. */ void @@ -1948,7 +1962,7 @@ pagebuf_terminate(void) kmem_shake_deregister(pagebuf_shaker); unregister_sysctl_table(pagebuf_table_header); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS remove_proc_entry("fs/pagebuf/stat", NULL); remove_proc_entry("fs/pagebuf", NULL); #endif diff --git a/fs/xfs/pagebuf/page_buf.h b/fs/xfs/pagebuf/page_buf.h index 0ab5297e6f75..2a24ba8c6fb0 100644 --- a/fs/xfs/pagebuf/page_buf.h +++ b/fs/xfs/pagebuf/page_buf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -83,17 +83,31 @@ typedef enum { /* pbm_flags values */ /* but uninitialized file data */ } bmap_flags_t; +typedef enum { + /* base extent manipulation calls */ + BMAP_READ = (1 << 0), /* read extents */ + BMAP_WRITE = (1 << 1), /* create extents */ + BMAP_ALLOCATE = (1 << 2), /* delayed allocate to real extents */ + BMAP_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */ + /* modifiers */ + BMAP_IGNSTATE = (1 << 4), /* ignore unwritten state on read */ + BMAP_DIRECT = (1 << 5), /* direct instead of buffered write */ + BMAP_MMAP = (1 << 6), /* allocate for mmap write */ + BMAP_SYNC = (1 << 7), /* sync write */ + BMAP_TRYLOCK = (1 << 8), /* non-blocking request */ +} bmapi_flags_t; + typedef enum page_buf_flags_e { /* pb_flags values */ PBF_READ = (1 << 0), /* buffer intended for reading from device */ PBF_WRITE = (1 << 1), /* buffer intended for writing to device */ - PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */ - PBF_PARTIAL = (1 << 3), /* buffer partially read */ - PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */ - PBF_NONE = (1 << 5), /* buffer not read at all */ - PBF_DELWRI = (1 << 6), /* buffer has dirty pages */ - PBF_FREED = (1 << 7), /* buffer has been freed and is invalid */ - PBF_SYNC = (1 << 8), /* force updates to disk */ - PBF_MAPPABLE = (1 << 9),/* use directly-addressable pages */ + PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */ + PBF_PARTIAL = (1 << 3), /* buffer partially read */ + PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */ + PBF_NONE = (1 << 5), /* buffer not read at all */ + PBF_DELWRI = (1 << 6), /* buffer has dirty pages */ + PBF_FREED = (1 << 7), /* buffer has been freed and is invalid */ + PBF_SYNC = (1 << 8), /* force updates to disk */ + PBF_MAPPABLE = (1 << 9),/* use directly-addressable pages */ PBF_STALE = (1 << 10), /* buffer has been staled, do not find it */ PBF_FS_MANAGED = (1 << 11), /* filesystem controls freeing memory */ PBF_FS_DATAIOD = (1 << 12), /* schedule IO completion on fs datad */ @@ -101,20 +115,18 @@ typedef enum page_buf_flags_e { /* pb_flags values */ /* flags used only as arguments to access routines */ PBF_LOCK = (1 << 13), /* lock requested */ PBF_TRYLOCK = (1 << 14), /* lock requested, but do not wait */ - PBF_FILE_ALLOCATE = (1 << 15), /* allocate all file space */ - PBF_DONT_BLOCK = (1 << 16), /* do not block in current thread */ - PBF_DIRECT = (1 << 17), /* direct I/O desired */ - PBF_FILE_UNWRITTEN = (1 << 18), /* convert unwritten extent space */ + PBF_DONT_BLOCK = (1 << 15), /* do not block in current thread */ /* flags used only internally */ - _PBF_LOCKABLE = (1 << 19), /* page_buf_t may be locked */ - _PBF_ALL_PAGES_MAPPED = (1 << 21), /* all pages in range mapped */ - _PBF_ADDR_ALLOCATED = (1 << 22), /* pb_addr space was allocated */ - _PBF_MEM_ALLOCATED = (1 << 23), /* pb_mem+underlying pages alloc'd */ + _PBF_LOCKABLE = (1 << 16), /* page_buf_t may be locked */ + _PBF_PRIVATE_BH = (1 << 17), /* do not use public buffer heads */ + _PBF_ALL_PAGES_MAPPED = (1 << 18), /* all pages in range mapped */ + _PBF_ADDR_ALLOCATED = (1 << 19), /* pb_addr space was allocated */ + _PBF_MEM_ALLOCATED = (1 << 20), /* pb_mem+underlying pages alloc'd */ - PBF_FORCEIO = (1 << 24), - PBF_FLUSH = (1 << 25), /* flush disk write cache */ - PBF_READ_AHEAD = (1 << 26), + PBF_FORCEIO = (1 << 21), + PBF_FLUSH = (1 << 22), /* flush disk write cache */ + PBF_READ_AHEAD = (1 << 23), } page_buf_flags_t; @@ -170,10 +182,10 @@ typedef page_buf_bmap_t pb_bmap_t; * This buffer structure is used by the page cache buffer management routines * to refer to an assembly of pages forming a logical buffer. The actual * I/O is performed with buffer_head or bio structures, as required by drivers, - * for drivers which do not understand this structure. The buffer structure is + * for drivers which do not understand this structure. The buffer structure is * used on temporary basis only, and discarded when released. * - * The real data storage is recorded in the page cache. Metadata is + * The real data storage is recorded in the page cache. Metadata is * hashed to the inode for the block device on which the file system resides. * File data is hashed to the inode for the file. Pages which are only * partially filled with data have bits set in their block_map entry @@ -200,7 +212,7 @@ typedef struct page_buf_s { struct pb_target *pb_target; /* logical object */ atomic_t pb_hold; /* reference count */ page_buf_daddr_t pb_bn; /* block number for I/O */ - loff_t pb_file_offset; /* offset in file */ + loff_t pb_file_offset; /* offset in file */ size_t pb_buffer_length; /* size of buffer in bytes */ size_t pb_count_desired; /* desired transfer size */ void *pb_addr; /* virtual address of buffer */ @@ -241,10 +253,10 @@ extern page_buf_t *pagebuf_find( /* find buffer for block if */ extern page_buf_t *pagebuf_get( /* allocate a buffer */ struct pb_target *, /* inode for buffer */ - loff_t, /* starting offset of range */ - size_t, /* length of range */ + loff_t, /* starting offset of range */ + size_t, /* length of range */ page_buf_flags_t); /* PBF_LOCK, PBF_READ, */ - /* PBF_ASYNC */ + /* PBF_ASYNC */ extern page_buf_t *pagebuf_lookup( struct pb_target *, @@ -253,7 +265,7 @@ extern page_buf_t *pagebuf_lookup( page_buf_flags_t); /* PBF_READ, PBF_WRITE, */ /* PBF_FORCEIO, _PBF_LOCKABLE */ -extern page_buf_t *pagebuf_get_empty( /* allocate pagebuf struct with */ +extern page_buf_t *pagebuf_get_empty( /* allocate pagebuf struct with */ /* no memory or disk address */ struct pb_target *); /* mount point "fake" inode */ @@ -273,8 +285,8 @@ extern void pagebuf_hold( /* increment reference count */ extern void pagebuf_readahead( /* read ahead into cache */ struct pb_target *, /* target for buffer (or NULL) */ - loff_t, /* starting offset of range */ - size_t, /* length of range */ + loff_t, /* starting offset of range */ + size_t, /* length of range */ page_buf_flags_t); /* additional read flags */ /* Writing and Releasing Buffers */ @@ -292,10 +304,10 @@ extern int pagebuf_cond_lock( /* lock buffer, if not locked */ page_buf_t *); /* buffer to lock */ extern int pagebuf_lock_value( /* return count on lock */ - page_buf_t *); /* buffer to check */ + page_buf_t *); /* buffer to check */ -extern int pagebuf_lock( /* lock buffer */ - page_buf_t *); /* buffer to lock */ +extern int pagebuf_lock( /* lock buffer */ + page_buf_t *); /* buffer to lock */ extern void pagebuf_unlock( /* unlock buffer */ page_buf_t *); /* buffer to unlock */ @@ -310,9 +322,9 @@ extern void pagebuf_iodone( /* mark buffer I/O complete */ page_buf_t *, /* buffer to mark */ int, /* use data/log helper thread. */ int); /* run completion locally, or in - * a helper thread. */ + * a helper thread. */ -extern void pagebuf_ioerror( /* mark buffer in error (or not) */ +extern void pagebuf_ioerror( /* mark buffer in error (or not) */ page_buf_t *, /* buffer to mark */ unsigned int); /* error to store (0 if none) */ diff --git a/fs/xfs/pagebuf/page_buf_internal.h b/fs/xfs/pagebuf/page_buf_internal.h index 775803f53cb6..b751d3ed055c 100644 --- a/fs/xfs/pagebuf/page_buf_internal.h +++ b/fs/xfs/pagebuf/page_buf_internal.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -79,20 +79,20 @@ struct pagebuf_trace_buf { }; #define PB_TRACE_BUFSIZE 1024 -#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1)) +#define CIRC_INC(i) (((i) + 1) & (PB_TRACE_BUFSIZE - 1)) /* * Tunable pagebuf parameters */ -#define P_PARAM 4 +#define P_PARAM 4 typedef union pagebuf_param { struct { - ulong flush_interval; /* interval between runs of the - * delwri flush daemon. */ + ulong flush_interval; /* interval between runs of the + * delwri flush daemon. */ ulong age_buffer; /* time for buffer to age before - * we flush it. */ + * we flush it. */ ulong debug; /* debug tracing on or off */ ulong stats_clear; /* clear the pagebuf stats */ } p_un; @@ -129,7 +129,7 @@ extern struct pbstats pbstats; #define PB_STATS_INC(count) ( count ++ ) #ifndef STATIC -# define STATIC static +# define STATIC static #endif #endif /* __PAGE_BUF_PRIVATE_H__ */ diff --git a/fs/xfs/pagebuf/page_buf_locking.c b/fs/xfs/pagebuf/page_buf_locking.c index ddd53e788a7b..ba741902b029 100644 --- a/fs/xfs/pagebuf/page_buf_locking.c +++ b/fs/xfs/pagebuf/page_buf_locking.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -40,7 +40,7 @@ * cached pages for I/O. The page_buf_locking module adds support for * locking such page buffers. * - * Written by Steve Lord at SGI + * Written by Steve Lord at SGI * */ diff --git a/fs/xfs/pagebuf/page_buf_trace.h b/fs/xfs/pagebuf/page_buf_trace.h index 51caa533f269..5d854b0eba3c 100644 --- a/fs/xfs/pagebuf/page_buf_trace.h +++ b/fs/xfs/pagebuf/page_buf_trace.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,11 +35,11 @@ #ifdef PB_DEFINE_TRACES #define PB_TRACE_START typedef enum { -#define PB_TRACE_REC(x) pb_trace_point_##x +#define PB_TRACE_REC(x) pb_trace_point_##x #define PB_TRACE_END } pb_trace_var_t; #else #define PB_TRACE_START static char *event_names[] = { -#define PB_TRACE_REC(x) #x +#define PB_TRACE_REC(x) #x #define PB_TRACE_END }; #endif @@ -86,7 +86,7 @@ PB_TRACE_END extern void pb_trace_func(page_buf_t *, int, void *, void *); #ifdef PAGEBUF_TRACE # define PB_TRACE(pb, event, misc) \ - pb_trace_func(pb, event, (void *) misc, \ + pb_trace_func(pb, event, (void *) misc, \ (void *)__builtin_return_address(0)) #else # define PB_TRACE(pb, event, misc) do { } while (0) diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index bd7e1e614391..1a7d4aa8bc7d 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c @@ -30,7 +30,43 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_trans_space.h" +#include "xfs_trans_priv.h" + #include "xfs_qm.h" diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index a0562849bca6..a5425ee6e7bd 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c @@ -30,7 +30,42 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_trans_priv.h" + #include "xfs_qm.h" diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 5b16a1772d61..c6ea0283534d 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c @@ -30,7 +30,44 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_clnt.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_trans_space.h" +#include "xfs_utils.h" + #include "xfs_qm.h" /* diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c index 665de8bb45e0..96b1d580c46a 100644 --- a/fs/xfs/quota/xfs_qm_bhv.c +++ b/fs/xfs/quota/xfs_qm_bhv.c @@ -30,8 +30,41 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <linux/init.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_clnt.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" + #include "xfs_qm.h" #define MNTOPT_QUOTA "quota" /* disk quotas (user) */ diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/quota/xfs_qm_stats.c index af0ee82189bb..d3553ea4a74e 100644 --- a/fs/xfs/quota/xfs_qm_stats.c +++ b/fs/xfs/quota/xfs_qm_stats.c @@ -30,8 +30,40 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <linux/proc_fs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" + #include "xfs_qm.h" struct xqmstats xqmstats; diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index c5d4939d9b94..bef8bc4014b2 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c @@ -30,7 +30,41 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_utils.h" + #include "xfs_qm.h" #ifdef DEBUG @@ -69,11 +103,11 @@ xfs_qm_quotactl( xfs_caddr_t addr) { xfs_mount_t *mp; - int error; + int error; struct vfs *vfsp; vfsp = bhvtovfs(bdp); - mp = XFS_VFSTOM(vfsp); + mp = XFS_VFSTOM(vfsp); if (addr == NULL && cmd != Q_SYNC) return XFS_ERROR(EINVAL); @@ -84,7 +118,7 @@ xfs_qm_quotactl( * The following commands are valid even when quotaoff. */ switch (cmd) { - /* + /* * truncate quota files. quota must be off. */ case Q_XQUOTARM: @@ -92,7 +126,7 @@ xfs_qm_quotactl( return XFS_ERROR(EINVAL); if (vfsp->vfs_flag & VFS_RDONLY) return XFS_ERROR(EROFS); - return (xfs_qm_scall_trunc_qfiles(mp, + return (xfs_qm_scall_trunc_qfiles(mp, xfs_qm_import_qtype_flags(*(uint *)addr))); /* * Get quota status information. @@ -116,7 +150,7 @@ xfs_qm_quotactl( if (vfsp->vfs_flag & VFS_RDONLY) return XFS_ERROR(EROFS); break; - + default: break; } @@ -133,11 +167,11 @@ xfs_qm_quotactl( B_FALSE); break; - /* - * Defaults to XFS_GETUQUOTA. + /* + * Defaults to XFS_GETUQUOTA. */ case Q_XGETQUOTA: - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER, + error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER, (fs_disk_quota_t *)addr); break; /* @@ -157,9 +191,9 @@ xfs_qm_quotactl( (fs_disk_quota_t *)addr); break; - + case Q_XGETGQUOTA: - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, + error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, (fs_disk_quota_t *)addr); break; diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index bf91133c9ae4..0e79981c9a5c 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c @@ -30,7 +30,42 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc.h" +#include "xfs_dmapi.h" +#include "xfs_quota.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_acl.h" +#include "xfs_cap.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_buf_item.h" +#include "xfs_trans_priv.h" + #include "xfs_qm.h" STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c index cb0aa47974f3..2e5a3e97b41e 100644 --- a/fs/xfs/support/debug.c +++ b/fs/xfs/support/debug.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -38,7 +38,7 @@ int doass = 1; static char message[256]; /* keep it off the stack */ -static spinlock_t xfs_err_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t xfs_err_lock = SPIN_LOCK_UNLOCKED; /* Translate from CE_FOO to KERN_FOO, err_level(CE_FOO) == KERN_FOO */ #define XFS_MAX_ERR_LEVEL 7 diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h index 0547de8a472b..522287eea650 100644 --- a/fs/xfs/support/debug.h +++ b/fs/xfs/support/debug.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,17 +29,17 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_SUPPORT_DEBUG_H__ -#define __XFS_SUPPORT_DEBUG_H__ +#ifndef __XFS_SUPPORT_DEBUG_H__ +#define __XFS_SUPPORT_DEBUG_H__ #include <stdarg.h> -#define CE_DEBUG 7 /* debug */ -#define CE_CONT 6 /* continuation */ -#define CE_NOTE 5 /* notice */ -#define CE_WARN 4 /* warning */ -#define CE_ALERT 1 /* alert */ -#define CE_PANIC 0 /* panic */ +#define CE_DEBUG 7 /* debug */ +#define CE_CONT 6 /* continuation */ +#define CE_NOTE 5 /* notice */ +#define CE_WARN 4 /* warning */ +#define CE_ALERT 1 /* alert */ +#define CE_PANIC 0 /* panic */ extern void icmn_err(int, char *, va_list); extern void cmn_err(int, char *, ...); @@ -49,7 +49,7 @@ extern void cmn_err(int, char *, ...); # define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */ # else # define ASSERT(EX) ((!doass||(EX))?((void)0):assfail(#EX, __FILE__, __LINE__)) -# endif /* lint */ +# endif /* lint */ #else # define ASSERT(x) ((void)0) #endif @@ -62,6 +62,6 @@ extern int get_thread_id(void); #endif #define ASSERT_ALWAYS(EX) ((EX)?((void)0):assfail(#EX, __FILE__, __LINE__)) -#define debug_stop_all_cpus(param) /* param is "cpumask_t *" */ +#define debug_stop_all_cpus(param) /* param is "cpumask_t *" */ -#endif /* __XFS_SUPPORT_DEBUG_H__ */ +#endif /* __XFS_SUPPORT_DEBUG_H__ */ diff --git a/fs/xfs/support/kmem.c b/fs/xfs/support/kmem.c index 7a69a439c2bd..fb1ae4b3d43c 100644 --- a/fs/xfs/support/kmem.c +++ b/fs/xfs/support/kmem.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -162,7 +162,7 @@ void kmem_free(void *ptr, size_t size) { if (((unsigned long)ptr < VMALLOC_START) || - ((unsigned long)ptr >= VMALLOC_END)) { + ((unsigned long)ptr >= VMALLOC_END)) { kfree(ptr); } else { vfree(ptr); diff --git a/fs/xfs/support/kmem.h b/fs/xfs/support/kmem.h index 000aa10ee16f..4e82a6b4eda7 100644 --- a/fs/xfs/support/kmem.h +++ b/fs/xfs/support/kmem.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -47,12 +47,12 @@ extern kmem_zone_t *kmem_zone_init(int, char *); extern void *kmem_zone_zalloc(kmem_zone_t *, int); extern void *kmem_zone_alloc(kmem_zone_t *, int); -extern void kmem_zone_free(kmem_zone_t *, void *); +extern void kmem_zone_free(kmem_zone_t *, void *); extern void *kmem_alloc(size_t, int); extern void *kmem_realloc(void *, size_t, size_t, int); extern void *kmem_zalloc(size_t, int); -extern void kmem_free(void *, size_t); +extern void kmem_free(void *, size_t); typedef void (*kmem_shake_func_t)(void); diff --git a/fs/xfs/support/ktrace.c b/fs/xfs/support/ktrace.c index 35fdea9d0305..1c53c8eafb2e 100644 --- a/fs/xfs/support/ktrace.c +++ b/fs/xfs/support/ktrace.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -31,6 +31,7 @@ */ #include <linux/module.h> +#include <linux/types.h> #include <linux/slab.h> #include <xfs_types.h> @@ -43,7 +44,7 @@ static kmem_zone_t *ktrace_hdr_zone; static kmem_zone_t *ktrace_ent_zone; -static int ktrace_zentries; +static int ktrace_zentries; void ktrace_init(int zentries) @@ -76,8 +77,8 @@ ktrace_uninit(void) ktrace_t * ktrace_alloc(int nentries, int sleep) { - ktrace_t *ktp; - ktrace_entry_t *ktep; + ktrace_t *ktp; + ktrace_entry_t *ktep; ktp = (ktrace_t*)kmem_zone_alloc(ktrace_hdr_zone, sleep); @@ -116,9 +117,9 @@ ktrace_alloc(int nentries, int sleep) spinlock_init(&(ktp->kt_lock), "kt_lock"); - ktp->kt_entries = ktep; + ktp->kt_entries = ktep; ktp->kt_nentries = nentries; - ktp->kt_index = 0; + ktp->kt_index = 0; ktp->kt_rollover = 0; return ktp; @@ -134,7 +135,7 @@ ktrace_alloc(int nentries, int sleep) void ktrace_free(ktrace_t *ktp) { - int entries_size; + int entries_size; if (ktp == (ktrace_t *)NULL) return; @@ -162,27 +163,27 @@ ktrace_free(ktrace_t *ktp) */ void ktrace_enter( - ktrace_t *ktp, - void *val0, - void *val1, - void *val2, - void *val3, - void *val4, - void *val5, - void *val6, - void *val7, - void *val8, - void *val9, - void *val10, - void *val11, - void *val12, - void *val13, - void *val14, - void *val15) + ktrace_t *ktp, + void *val0, + void *val1, + void *val2, + void *val3, + void *val4, + void *val5, + void *val6, + void *val7, + void *val8, + void *val9, + void *val10, + void *val11, + void *val12, + void *val13, + void *val14, + void *val15) { static lock_t wrap_lock = SPIN_LOCK_UNLOCKED; - int index; - ktrace_entry_t *ktep; + int index; + ktrace_entry_t *ktep; ASSERT(ktp != NULL); @@ -225,7 +226,7 @@ ktrace_enter( */ int ktrace_nentries( - ktrace_t *ktp) + ktrace_t *ktp) { if (ktp == NULL) { return 0; @@ -246,15 +247,15 @@ ktrace_nentries( * * The caller must pass in a pointer to a ktrace_snap * structure in which we will keep some state used to - * iterate through the buffer. This state must not touched + * iterate through the buffer. This state must not touched * by any code outside of this module. */ ktrace_entry_t * -ktrace_first(ktrace_t *ktp, ktrace_snap_t *ktsp) +ktrace_first(ktrace_t *ktp, ktrace_snap_t *ktsp) { - ktrace_entry_t *ktep; - int index; - int nentries; + ktrace_entry_t *ktep; + int index; + int nentries; if (ktp->kt_rollover) index = ktp->kt_index; @@ -288,11 +289,11 @@ ktrace_first(ktrace_t *ktp, ktrace_snap_t *ktsp) */ ktrace_entry_t * ktrace_next( - ktrace_t *ktp, - ktrace_snap_t *ktsp) + ktrace_t *ktp, + ktrace_snap_t *ktsp) { - int index; - ktrace_entry_t *ktep; + int index; + ktrace_entry_t *ktep; index = ktsp->ks_index; if (index == ktsp->ks_start) { @@ -325,14 +326,14 @@ EXPORT_SYMBOL(ktrace_next); ktrace_entry_t * ktrace_skip( - ktrace_t *ktp, - int count, - ktrace_snap_t *ktsp) + ktrace_t *ktp, + int count, + ktrace_snap_t *ktsp) { - int index; - int new_index; - ktrace_entry_t *ktep; - int nentries = ktrace_nentries(ktp); + int index; + int new_index; + ktrace_entry_t *ktep; + int nentries = ktrace_nentries(ktp); index = ktsp->ks_index; new_index = index + count; diff --git a/fs/xfs/support/ktrace.h b/fs/xfs/support/ktrace.h index f1ece4a47971..93da7569e842 100644 --- a/fs/xfs/support/ktrace.h +++ b/fs/xfs/support/ktrace.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -90,15 +90,15 @@ extern void ktrace_enter( void *, void *); -extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *); -extern int ktrace_nentries(ktrace_t *); -extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_t *); -extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *); +extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *); +extern int ktrace_nentries(ktrace_t *); +extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_t *); +extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *); #else -#define ktrace_free(ktp) -#define ktrace_enter(ktp,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15) +#define ktrace_free(ktp) +#define ktrace_enter(ktp,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15) #endif diff --git a/fs/xfs/support/move.c b/fs/xfs/support/move.c index 3426ba4f7a99..ceeb8e86bc92 100644 --- a/fs/xfs/support/move.c +++ b/fs/xfs/support/move.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -41,7 +41,7 @@ /* * Move "n" bytes at byte address "cp"; "rw" indicates the direction * of the move, and the I/O parameters are provided in "uio", which is - * update to reflect the data which was moved. Returns 0 on success or + * update to reflect the data which was moved. Returns 0 on success or * a non-zero errno on failure. */ int diff --git a/fs/xfs/support/move.h b/fs/xfs/support/move.h index dd63285df2e6..81a8260480d2 100644 --- a/fs/xfs/support/move.h +++ b/fs/xfs/support/move.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -39,12 +39,12 @@ typedef struct iovec iovec_t; typedef struct uio { - iovec_t *uio_iov; /* pointer to array of iovecs */ - int uio_iovcnt; /* number of iovecs */ - int uio_fmode; /* file mode flags */ - xfs_off_t uio_offset; /* file offset */ - short uio_segflg; /* address space (kernel or user) */ - ssize_t uio_resid; /* residual count */ + iovec_t *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs */ + int uio_fmode; /* file mode flags */ + xfs_off_t uio_offset; /* file offset */ + short uio_segflg; /* address space (kernel or user) */ + ssize_t uio_resid; /* residual count */ } uio_t; /* @@ -56,11 +56,11 @@ typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t; * Segment flag values. */ typedef enum uio_seg { - UIO_USERSPACE, /* uio_iov describes user space */ - UIO_SYSSPACE, /* uio_iov describes system space */ + UIO_USERSPACE, /* uio_iov describes user space */ + UIO_SYSSPACE, /* uio_iov describes system space */ } uio_seg_t; extern int uiomove (void *, size_t, uio_rw_t, uio_t *); -#endif /* __XFS_SUPPORT_MOVE_H__ */ +#endif /* __XFS_SUPPORT_MOVE_H__ */ diff --git a/fs/xfs/support/mrlock.c b/fs/xfs/support/mrlock.c index 0a9b36fe8203..5b5dae97af9c 100644 --- a/fs/xfs/support/mrlock.c +++ b/fs/xfs/support/mrlock.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -251,7 +251,7 @@ ismrlocked(mrlock_t *mrp, int type) /* No need to lock since info can change */ else if (type == MR_UPDATE) return (mrp->mr_count < 0); /* Write lock */ else if (type == (MR_UPDATE | MR_ACCESS)) - return (mrp->mr_count); /* Any type of lock held */ + return (mrp->mr_count); /* Any type of lock held */ else /* Any waiters */ return (mrp->mr_reads_waiting | mrp->mr_writes_waiting); } diff --git a/fs/xfs/support/mrlock.h b/fs/xfs/support/mrlock.h index 5f8d7c592075..aad1d40e53da 100644 --- a/fs/xfs/support/mrlock.h +++ b/fs/xfs/support/mrlock.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -67,17 +67,17 @@ typedef struct mrlock_s { extern void mraccessf(mrlock_t *, int); extern void mrupdatef(mrlock_t *, int); -extern void mrlock(mrlock_t *, int, int); -extern void mrunlock(mrlock_t *); -extern void mraccunlock(mrlock_t *); -extern int mrtryupdate(mrlock_t *); -extern int mrtryaccess(mrlock_t *); +extern void mrlock(mrlock_t *, int, int); +extern void mrunlock(mrlock_t *); +extern void mraccunlock(mrlock_t *); +extern int mrtryupdate(mrlock_t *); +extern int mrtryaccess(mrlock_t *); extern int mrtrypromote(mrlock_t *); -extern void mrdemote(mrlock_t *); +extern void mrdemote(mrlock_t *); extern int ismrlocked(mrlock_t *, int); -extern void mrlock_init(mrlock_t *, int type, char *name, long sequence); -extern void mrfree(mrlock_t *); +extern void mrlock_init(mrlock_t *, int type, char *name, long sequence); +extern void mrfree(mrlock_t *); #define mrinit(mrp, name) mrlock_init(mrp, MRLOCK_BARRIER, name, -1) #define mraccess(mrp) mraccessf(mrp, 0) /* grab for READ/ACCESS */ diff --git a/fs/xfs/support/mutex.h b/fs/xfs/support/mutex.h index 98bf753e24c8..3cdbff77f8fe 100644 --- a/fs/xfs/support/mutex.h +++ b/fs/xfs/support/mutex.h @@ -12,7 +12,7 @@ * * 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 + * 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. diff --git a/fs/xfs/support/qsort.c b/fs/xfs/support/qsort.c index 45de41b8108b..df95c3751f93 100644 --- a/fs/xfs/support/qsort.c +++ b/fs/xfs/support/qsort.c @@ -9,7 +9,7 @@ The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public @@ -55,12 +55,12 @@ typedef struct upper bound for log (total_elements): bits per byte (CHAR_BIT) * sizeof(size_t). */ #define STACK_SIZE (8 * sizeof(unsigned long int)) -#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) -#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi))) -#define STACK_NOT_EMPTY (stack < top) +#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) +#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi))) +#define STACK_NOT_EMPTY (stack < top) -/* Order size using quicksort. This implementation incorporates +/* Order size using quicksort. This implementation incorporates four optimizations discussed in Sedgewick: 1. Non-recursive, using an explicit stack of pointer that store the diff --git a/fs/xfs/support/qsort.h b/fs/xfs/support/qsort.h index cf2c5c233650..94263106d716 100644 --- a/fs/xfs/support/qsort.h +++ b/fs/xfs/support/qsort.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/support/sema.h b/fs/xfs/support/sema.h index 8f053b307522..1e998f42c413 100644 --- a/fs/xfs/support/sema.h +++ b/fs/xfs/support/sema.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/support/spin.h b/fs/xfs/support/spin.h index 4a876797f820..b0690648576d 100644 --- a/fs/xfs/support/spin.h +++ b/fs/xfs/support/spin.h @@ -12,7 +12,7 @@ * * 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 + * 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. @@ -46,7 +46,7 @@ typedef spinlock_t lock_t; #define spinlock_init(lock, name) spin_lock_init(lock) -#define spinlock_destroy(lock) +#define spinlock_destroy(lock) static inline unsigned long mutex_spinlock(lock_t *lock) { diff --git a/fs/xfs/support/sv.h b/fs/xfs/support/sv.h index 0453edf61139..bb38b1100cdb 100644 --- a/fs/xfs/support/sv.h +++ b/fs/xfs/support/sv.h @@ -12,7 +12,7 @@ * * 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 + * 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. @@ -51,7 +51,7 @@ typedef struct sv_s { #define SV_LIFO 0x2 /* sv_t is LIFO type */ #define SV_PRIO 0x4 /* sv_t is PRIO type */ #define SV_KEYED 0x6 /* sv_t is KEYED type */ -#define SV_DEFAULT SV_FIFO +#define SV_DEFAULT SV_FIFO static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state, @@ -76,7 +76,7 @@ static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state, /*NOTHING*/ #define sv_wait(sv, pri, lock, s) \ _sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT) -#define sv_wait_sig(sv, pri, lock, s) \ +#define sv_wait_sig(sv, pri, lock, s) \ _sv_wait(sv, lock, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT) #define sv_timedwait(sv, pri, lock, s, svf, ts, rts) \ _sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, timespec_to_jiffies(ts)) diff --git a/fs/xfs/support/time.h b/fs/xfs/support/time.h index f4c23f80ca5c..109b5c0833f8 100644 --- a/fs/xfs/support/time.h +++ b/fs/xfs/support/time.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/support/uuid.c b/fs/xfs/support/uuid.c index fd98101312c1..a13aedbdddc9 100644 --- a/fs/xfs/support/uuid.c +++ b/fs/xfs/support/uuid.c @@ -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 @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -31,58 +31,22 @@ */ #include <linux/types.h> -#include <linux/random.h> -#include <linux/time.h> - -#ifdef __sparc__ -#include <asm/idprom.h> -#else -#include <linux/netdevice.h> -#endif - #include <xfs_types.h> #include <xfs_arch.h> #include "time.h" -#include "move.h" #include "uuid.h" +#include "kmem.h" +#include "debug.h" +#include "mutex.h" -#ifndef CONFIG_NET -#define dev_get_by_name(x) (NULL) -#define dev_put(x) do { } while (0) -#endif - -/* NODE_SIZE is the number of bytes used for the node identifier portion. */ -#define NODE_SIZE 6 - -/* - * Total size must be 128 bits. N.B. definition of uuid_t in uuid.h! - */ -typedef struct { - u_int32_t uu_timelow; /* time "low" */ - u_int16_t uu_timemid; /* time "mid" */ - u_int16_t uu_timehi; /* time "hi" and version */ - u_int16_t uu_clockseq; /* "reserved" and clock sequence */ - u_int16_t uu_node[NODE_SIZE / 2]; /* ethernet hardware address */ -} uu_t; - -/* - * The Time Base Correction is the amount to add on to a UNIX-based - * time value (i.e. seconds since 1 Jan. 1970) to convert it to the - * time base for UUIDs (15 Oct. 1582). - */ -#define UUID_TBC 0x01B21DD2138140LL +static mutex_t uuid_monitor; +static int uuid_table_size; +static uuid_t *uuid_table; -static short uuid_eaddr[NODE_SIZE / 2]; /* ethernet address */ -static __int64_t uuid_time; /* last time basis used */ -static u_int16_t uuid_clockseq; /* boot-time randomizer */ -DECLARE_MUTEX(uuid_lock); - -/* - * uuid_init - called from out of init_tbl[] - */ void uuid_init(void) { + mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor"); } /* @@ -94,7 +58,7 @@ uuid_init(void) void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]) { - char *uu=(char*)uuid; + char *uu = (char *)uuid; /* on IRIX, this function assumes big-endian fields within * the uuid, so we use INT_GET to get the same result on @@ -119,24 +83,24 @@ uuid_is_nil(uuid_t *uuid) char *cp = (char *)uuid; if (uuid == NULL) - return B_TRUE; + return 0; /* implied check of version number here... */ for (i = 0; i < sizeof *uuid; i++) - if (*cp++) return B_FALSE; /* not nil */ - return B_TRUE; /* is nil */ + if (*cp++) return 0; /* not nil */ + return 1; /* is nil */ } int uuid_equal(uuid_t *uuid1, uuid_t *uuid2) { - return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? B_FALSE : B_TRUE; + return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1; } /* * Given a 128-bit uuid, return a 64-bit value by adding the top and bottom - * 64-bit words. NOTE: This function can not be changed EVER. Although + * 64-bit words. NOTE: This function can not be changed EVER. Although * brain-dead, some applications depend on this 64-bit value remaining - * persistent. Specifically, DMI vendors store the value as a persistent + * persistent. Specifically, DMI vendors store the value as a persistent * filehandle. */ __uint64_t @@ -145,94 +109,50 @@ uuid_hash64(uuid_t *uuid) __uint64_t *sp = (__uint64_t *)uuid; return sp[0] + sp[1]; -} /* uuid_hash64 */ - -static void -get_eaddr(char *junk) -{ -#ifdef __sparc__ - memcpy(uuid_eaddr, idprom->id_ethaddr, 6); -#else - struct net_device *dev; - - dev = dev_get_by_name("eth0"); - if (!dev || !dev->addr_len) { - get_random_bytes(uuid_eaddr, sizeof(uuid_eaddr)); - } else { - memcpy(uuid_eaddr, dev->dev_addr, - dev->addr_len<sizeof(uuid_eaddr)? - dev->addr_len:sizeof(uuid_eaddr)); - dev_put(dev); - } -#endif } -/* - * uuid_create - kernel version, does the actual work - */ -void -uuid_create(uuid_t *uuid) +int +uuid_table_insert(uuid_t *uuid) { - int i; - uu_t *uu = (uu_t *)uuid; - static int uuid_have_eaddr = 0; /* ethernet addr inited? */ - static int uuid_is_init = 0; /* time/clockseq inited? */ - - down(&uuid_lock); - if (!uuid_is_init) { - timespec_t ts; - - nanotime(&ts); - /* - * The clock sequence must be initialized randomly. - */ - uuid_clockseq = ((unsigned long)jiffies & 0xfff) | 0x8000; - /* - * Initialize the uuid time, it's in 100 nanosecond - * units since a time base in 1582. - */ - uuid_time = ts.tv_sec * 10000000LL + - ts.tv_nsec / 100LL + - UUID_TBC; - uuid_is_init = 1; + int i, hole; + + mutex_lock(&uuid_monitor, PVFS); + for (i = 0, hole = -1; i < uuid_table_size; i++) { + if (uuid_is_nil(&uuid_table[i])) { + hole = i; + continue; + } + if (uuid_equal(uuid, &uuid_table[i])) { + mutex_unlock(&uuid_monitor); + return 0; + } } - if (!uuid_have_eaddr) { - uuid_have_eaddr = 1; - get_eaddr((char *)uuid_eaddr); + if (hole < 0) { + uuid_table = kmem_realloc(uuid_table, + (uuid_table_size + 1) * sizeof(*uuid_table), + uuid_table_size * sizeof(*uuid_table), + KM_SLEEP); + hole = uuid_table_size++; } - uuid_time++; - uu->uu_timelow = (u_int32_t)(uuid_time & 0x00000000ffffffffLL); - uu->uu_timemid = (u_int16_t)((uuid_time >> 32) & 0x0000ffff); - uu->uu_timehi = (u_int16_t)((uuid_time >> 48) & 0x00000fff) | 0x1000; - up(&uuid_lock); - uu->uu_clockseq = uuid_clockseq; - for (i = 0; i < (NODE_SIZE / 2); i++) - uu->uu_node [i] = uuid_eaddr [i]; + uuid_table[hole] = *uuid; + mutex_unlock(&uuid_monitor); + return 1; } -int -uuid_compare(uuid_t *uuid1, uuid_t *uuid2) +void +uuid_table_remove(uuid_t *uuid) { int i; - char *cp1 = (char *) uuid1; - char *cp2 = (char *) uuid2; - - if (uuid1 == NULL) { - if (uuid2 == NULL) { - return 0; /* equal because both are nil */ - } else { - return -1; /* uuid1 nil, so precedes uuid2 */ - } - } else if (uuid2 == NULL) { - return 1; - } - /* implied check of version number here... */ - for (i = 0; i < sizeof(uuid_t); i++) { - if (*cp1 < *cp2) - return -1; - if (*cp1++ > *cp2++) - return 1; + mutex_lock(&uuid_monitor, PVFS); + for (i = 0; i < uuid_table_size; i++) { + if (uuid_is_nil(&uuid_table[i])) + continue; + if (!uuid_equal(uuid, &uuid_table[i])) + continue; + uuid_create_nil(&uuid_table[i]); + break; } - return 0; /* they're equal */ + ASSERT(i < uuid_table_size); + mutex_unlock(&uuid_monitor); } diff --git a/fs/xfs/support/uuid.h b/fs/xfs/support/uuid.h index 63e5293926b7..5220ea58ba2b 100644 --- a/fs/xfs/support/uuid.h +++ b/fs/xfs/support/uuid.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,10 +36,13 @@ typedef struct { unsigned char __u_bits[16]; } uuid_t; +void uuid_init(void); void uuid_create_nil(uuid_t *uuid); int uuid_is_nil(uuid_t *uuid); int uuid_equal(uuid_t *uuid1, uuid_t *uuid2); void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]); __uint64_t uuid_hash64(uuid_t *uuid); +int uuid_table_insert(uuid_t *uuid); +void uuid_table_remove(uuid_t *uuid); #endif /* __XFS_SUPPORT_UUID_H__ */ diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h index 5b9cbb8b5026..f9cfa5afa8cf 100644 --- a/fs/xfs/xfs.h +++ b/fs/xfs/xfs.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -32,10 +32,10 @@ #ifndef __XFS_H__ #define __XFS_H__ -#include <linux/config.h> #include <linux/types.h> - +#include <linux/config.h> #include <xfs_types.h> + #include <xfs_arch.h> #include <support/kmem.h> @@ -53,56 +53,7 @@ #include <linux/xfs_linux.h> -#include <xfs_fs.h> +#include <xfs_fs.h> #include <xfs_buf.h> -#include <xfs_macros.h> -#include <xfs_inum.h> -#include <xfs_log.h> -#include <xfs_clnt.h> -#include <xfs_trans.h> -#include <xfs_sb.h> -#include <xfs_ag.h> -#include <xfs_dir.h> -#include <xfs_dir2.h> -#include <xfs_imap.h> -#include <xfs_alloc.h> -#include <xfs_dmapi.h> -#include <xfs_quota.h> -#include <xfs_mount.h> -#include <xfs_alloc_btree.h> -#include <xfs_bmap_btree.h> -#include <xfs_ialloc_btree.h> -#include <xfs_btree.h> -#include <xfs_ialloc.h> -#include <xfs_attr_sf.h> -#include <xfs_dir_sf.h> -#include <xfs_dir2_sf.h> -#include <xfs_dinode.h> -#include <xfs_inode.h> -#include <xfs_bmap.h> -#include <xfs_bit.h> -#include <xfs_rtalloc.h> -#include <xfs_error.h> -#include <xfs_itable.h> -#include <xfs_rw.h> -#include <xfs_da_btree.h> -#include <xfs_dir_leaf.h> -#include <xfs_dir2_data.h> -#include <xfs_dir2_leaf.h> -#include <xfs_dir2_block.h> -#include <xfs_dir2_node.h> -#include <xfs_dir2_trace.h> -#include <xfs_acl.h> -#include <xfs_cap.h> -#include <xfs_mac.h> -#include <xfs_attr.h> -#include <xfs_attr_leaf.h> -#include <xfs_inode_item.h> -#include <xfs_buf_item.h> -#include <xfs_extfree_item.h> -#include <xfs_log_priv.h> -#include <xfs_trans_priv.h> -#include <xfs_trans_space.h> -#include <xfs_utils.h> #endif /* __XFS_H__ */ diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index 2bdcdc6db0ab..11a6617999f2 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,11 +30,28 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_inum.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_acl.h" +#include "xfs_mac.h" +#include "xfs_attr.h" + #include <linux/posix_acl_xattr.h> STATIC int xfs_acl_setmode(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 int xfs_acl_access(uid_t, gid_t, xfs_acl_t *, mode_t, cred_t *); STATIC int xfs_acl_invalid(xfs_acl_t *); @@ -146,7 +163,7 @@ xfs_acl_entry_compare( const void *va, const void *vb) { - xfs_acl_entry_t *a = (xfs_acl_entry_t *)va, + xfs_acl_entry_t *a = (xfs_acl_entry_t *)va, *b = (xfs_acl_entry_t *)vb; if (a->ae_tag == b->ae_tag) @@ -233,7 +250,7 @@ xfs_acl_vget( goto out; } if (kind == _ACL_TYPE_ACCESS) { - vattr_t va; + vattr_t va; va.va_mask = XFS_AT_MODE; VOP_GETATTR(vp, &va, 0, sys_cred, error); @@ -317,7 +334,7 @@ xfs_acl_vset( } else { xfs_acl_vremove(vp, _ACL_TYPE_ACCESS); } - + out: VN_RELE(vp); @@ -437,7 +454,7 @@ xfs_acl_capability_check( return EACCES; if ((mode & ACL_EXECUTE) && (!capable_cred(cr, CAP_DAC_OVERRIDE) || - !xfs_acl_find_any_exec(fap))) { + !xfs_acl_find_any_exec(fap))) { return EACCES; } @@ -446,9 +463,9 @@ xfs_acl_capability_check( /* * Note: cr is only used here for the capability check if the ACL test fails. - * It is not used to find out the credentials uid or groups etc, as was - * done in IRIX. It is assumed that the uid and groups for the current - * thread are taken from "current" instead of the cr parameter. + * It is not used to find out the credentials uid or groups etc, as was + * done in IRIX. It is assumed that the uid and groups for the current + * thread are taken from "current" instead of the cr parameter. */ STATIC int xfs_acl_access( @@ -458,7 +475,7 @@ xfs_acl_access( mode_t md, cred_t *cr) { - xfs_acl_entry_t matched; + xfs_acl_entry_t matched; int i, allows; int maskallows = -1; /* true, but not 1, either */ int seen_userobj = 0; @@ -557,7 +574,7 @@ STATIC int xfs_acl_invalid( xfs_acl_t *aclp) { - xfs_acl_entry_t *entry, *e; + xfs_acl_entry_t *entry, *e; int user = 0, group = 0, other = 0, mask = 0; int mask_required = 0; int i, j; @@ -616,7 +633,7 @@ STATIC void xfs_acl_get_endian( xfs_acl_t *aclp) { - xfs_acl_entry_t *ace, *end; + xfs_acl_entry_t *ace, *end; INT_SET(aclp->acl_cnt, ARCH_CONVERT, aclp->acl_cnt); end = &aclp->acl_entry[0]+aclp->acl_cnt; @@ -659,7 +676,7 @@ xfs_acl_set_attr( int kind, int *error) { - xfs_acl_entry_t *ace, *newace, *end; + xfs_acl_entry_t *ace, *newace, *end; xfs_acl_t *newacl; int len; @@ -759,7 +776,7 @@ xfs_acl_inherit( xfs_acl_setmode(vp, cacl, &basicperms); /* - * Set the Default and Access ACL on the file. The mode is already + * Set the Default and Access ACL on the file. The mode is already * set on the file, so we don't need to worry about that. * * If the new file is a directory, its default ACL is a copy of @@ -787,8 +804,8 @@ xfs_acl_setmode( int *basicperms) { vattr_t va; - xfs_acl_entry_t *ap; - xfs_acl_entry_t *gap = NULL; + xfs_acl_entry_t *ap; + xfs_acl_entry_t *gap = NULL; int i, error, nomask = 1; *basicperms = 1; @@ -858,16 +875,16 @@ xfs_acl_setmode( * most accurately reflects what the special ACL entries should permit/deny. * * CAVEAT: If someone sets the SGI_ACL_FILE attribute directly, - * the existing mode bits will override whatever is in the - * ACL. Similarly, if there is a pre-existing ACL that was - * never in sync with its mode (owing to a bug in 6.5 and - * before), it will now magically (or mystically) be - * synchronized. This could cause slight astonishment, but - * it is better than inconsistent permissions. + * the existing mode bits will override whatever is in the + * ACL. Similarly, if there is a pre-existing ACL that was + * never in sync with its mode (owing to a bug in 6.5 and + * before), it will now magically (or mystically) be + * synchronized. This could cause slight astonishment, but + * it is better than inconsistent permissions. * * The supplied ACL is a template that may contain any combination - * of special entries. These are treated as place holders when we fill - * out the ACL. This routine does not add or remove special entries, it + * of special entries. These are treated as place holders when we fill + * out the ACL. This routine does not add or remove special entries, it * simply unites each special entry with its associated set of permissions. */ STATIC void @@ -876,8 +893,8 @@ xfs_acl_sync_mode( xfs_acl_t *acl) { int i, nomask = 1; - xfs_acl_entry_t *ap; - xfs_acl_entry_t *gap = NULL; + xfs_acl_entry_t *ap; + xfs_acl_entry_t *gap = NULL; /* * Set ACL entries. POSIX1003.1eD16 requires that the MASK @@ -920,8 +937,8 @@ xfs_acl_filter_mode( xfs_acl_t *acl) { int i, nomask = 1; - xfs_acl_entry_t *ap; - xfs_acl_entry_t *gap = NULL; + xfs_acl_entry_t *ap; + xfs_acl_entry_t *gap = NULL; /* * Set ACL entries. POSIX1003.1eD16 requires that the MASK diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h index dda3fb5f823f..0fbaecec8b7d 100644 --- a/fs/xfs/xfs_acl.h +++ b/fs/xfs/xfs_acl.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -51,12 +51,12 @@ typedef struct xfs_acl_entry { typedef struct xfs_acl { __int32_t acl_cnt; - xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES]; + xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES]; } xfs_acl_t; /* On-disk XFS extended attribute names */ #define SGI_ACL_FILE "SGI_ACL_FILE" -#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT" +#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT" #define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1) #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) @@ -84,7 +84,7 @@ extern struct kmem_zone *xfs_acl_zone; #define _ACL_TYPE_ACCESS 1 #define _ACL_TYPE_DEFAULT 2 -#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) +#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) #define _ACL_DECL(a) xfs_acl_t *(a) = NULL #define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP)) @@ -93,7 +93,7 @@ extern struct kmem_zone *xfs_acl_zone; #define _ACL_ZONE_DESTROY(z) (kmem_cache_destroy(z)) #define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d)) #define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0) -#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0) +#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0) #define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access #define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default #define _ACL_XFS_IACCESS(i,m,c) (XFS_IFORK_Q(i) ? xfs_acl_iaccess(i,m,c) : -1) @@ -109,7 +109,7 @@ extern struct kmem_zone *xfs_acl_zone; #define _ACL_ZONE_DESTROY(z) ((void)0) #define _ACL_INHERIT(c,v,d) (0) #define _ACL_GET_ACCESS(pv,pa) (0) -#define _ACL_GET_DEFAULT(pv,pd) (0) +#define _ACL_GET_DEFAULT(pv,pd) (0) #define _ACL_ACCESS_EXISTS (NULL) #define _ACL_DEFAULT_EXISTS (NULL) #define _ACL_XFS_IACCESS(i,m,c) (-1) diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h index 9959c923d06c..4820ad2eace2 100644 --- a/fs/xfs/xfs_ag.h +++ b/fs/xfs/xfs_ag.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_AG_H__ -#define __XFS_AG_H__ +#define __XFS_AG_H__ /* * Allocation group header @@ -42,19 +42,19 @@ struct xfs_buf; struct xfs_mount; struct xfs_trans; -#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ -#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ -#define XFS_AGF_VERSION 1 -#define XFS_AGI_VERSION 1 +#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ +#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ +#define XFS_AGF_VERSION 1 +#define XFS_AGI_VERSION 1 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_GOOD_VERSION) int xfs_agf_good_version(unsigned v); -#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v) +#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v) #else #define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_GOOD_VERSION) int xfs_agi_good_version(unsigned v); -#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v) +#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v) #else #define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION) #endif @@ -63,7 +63,7 @@ int xfs_agi_good_version(unsigned v); * Btree number 0 is bno, 1 is cnt. This value gives the size of the * arrays below. */ -#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1) +#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1) /* * The second word of agf_levels in the first a.g. overlaps the EFS @@ -77,7 +77,7 @@ typedef struct xfs_agf * Common allocation group header information */ __uint32_t agf_magicnum; /* magic number == XFS_AGF_MAGIC */ - __uint32_t agf_versionnum; /* header version == XFS_AGF_VERSION */ + __uint32_t agf_versionnum; /* header version == XFS_AGF_VERSION */ xfs_agnumber_t agf_seqno; /* sequence # starting from 0 */ xfs_agblock_t agf_length; /* size in blocks of a.g. */ /* @@ -94,25 +94,25 @@ typedef struct xfs_agf xfs_extlen_t agf_longest; /* longest free space */ } xfs_agf_t; -#define XFS_AGF_MAGICNUM 0x00000001 -#define XFS_AGF_VERSIONNUM 0x00000002 -#define XFS_AGF_SEQNO 0x00000004 -#define XFS_AGF_LENGTH 0x00000008 -#define XFS_AGF_ROOTS 0x00000010 -#define XFS_AGF_LEVELS 0x00000020 -#define XFS_AGF_FLFIRST 0x00000040 -#define XFS_AGF_FLLAST 0x00000080 -#define XFS_AGF_FLCOUNT 0x00000100 -#define XFS_AGF_FREEBLKS 0x00000200 -#define XFS_AGF_LONGEST 0x00000400 -#define XFS_AGF_NUM_BITS 11 -#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) +#define XFS_AGF_MAGICNUM 0x00000001 +#define XFS_AGF_VERSIONNUM 0x00000002 +#define XFS_AGF_SEQNO 0x00000004 +#define XFS_AGF_LENGTH 0x00000008 +#define XFS_AGF_ROOTS 0x00000010 +#define XFS_AGF_LEVELS 0x00000020 +#define XFS_AGF_FLFIRST 0x00000040 +#define XFS_AGF_FLLAST 0x00000080 +#define XFS_AGF_FLCOUNT 0x00000100 +#define XFS_AGF_FREEBLKS 0x00000200 +#define XFS_AGF_LONGEST 0x00000400 +#define XFS_AGF_NUM_BITS 11 +#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) /* disk block (xfs_daddr_t) in the AG */ #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_BLOCK) xfs_agblock_t xfs_agf_block(struct xfs_mount *mp); -#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp) +#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp) #else #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) #endif @@ -120,7 +120,7 @@ xfs_agblock_t xfs_agf_block(struct xfs_mount *mp); /* * Size of the unlinked inode hash table in the agi. */ -#define XFS_AGI_UNLINKED_BUCKETS 64 +#define XFS_AGI_UNLINKED_BUCKETS 64 typedef struct xfs_agi { @@ -128,7 +128,7 @@ typedef struct xfs_agi * Common allocation group header information */ __uint32_t agi_magicnum; /* magic number == XFS_AGI_MAGIC */ - __uint32_t agi_versionnum; /* header version == XFS_AGI_VERSION */ + __uint32_t agi_versionnum; /* header version == XFS_AGI_VERSION */ xfs_agnumber_t agi_seqno; /* sequence # starting from 0 */ xfs_agblock_t agi_length; /* size in blocks of a.g. */ /* @@ -149,25 +149,25 @@ typedef struct xfs_agi xfs_agino_t agi_unlinked[XFS_AGI_UNLINKED_BUCKETS]; } xfs_agi_t; -#define XFS_AGI_MAGICNUM 0x00000001 -#define XFS_AGI_VERSIONNUM 0x00000002 -#define XFS_AGI_SEQNO 0x00000004 -#define XFS_AGI_LENGTH 0x00000008 -#define XFS_AGI_COUNT 0x00000010 -#define XFS_AGI_ROOT 0x00000020 -#define XFS_AGI_LEVEL 0x00000040 -#define XFS_AGI_FREECOUNT 0x00000080 -#define XFS_AGI_NEWINO 0x00000100 -#define XFS_AGI_DIRINO 0x00000200 -#define XFS_AGI_UNLINKED 0x00000400 -#define XFS_AGI_NUM_BITS 11 -#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1) +#define XFS_AGI_MAGICNUM 0x00000001 +#define XFS_AGI_VERSIONNUM 0x00000002 +#define XFS_AGI_SEQNO 0x00000004 +#define XFS_AGI_LENGTH 0x00000008 +#define XFS_AGI_COUNT 0x00000010 +#define XFS_AGI_ROOT 0x00000020 +#define XFS_AGI_LEVEL 0x00000040 +#define XFS_AGI_FREECOUNT 0x00000080 +#define XFS_AGI_NEWINO 0x00000100 +#define XFS_AGI_DIRINO 0x00000200 +#define XFS_AGI_UNLINKED 0x00000400 +#define XFS_AGI_NUM_BITS 11 +#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1) /* disk block (xfs_daddr_t) in the AG */ #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_BLOCK) xfs_agblock_t xfs_agi_block(struct xfs_mount *mp); -#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp) +#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp) #else #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) #endif @@ -179,7 +179,7 @@ xfs_agblock_t xfs_agi_block(struct xfs_mount *mp); #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGFL_BLOCK) xfs_agblock_t xfs_agfl_block(struct xfs_mount *mp); -#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp) +#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp) #else #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)) #endif @@ -223,7 +223,7 @@ typedef struct xfs_perag __uint32_t pagf_flcount; /* count of blocks in freelist */ xfs_extlen_t pagf_freeblks; /* total free blocks */ xfs_extlen_t pagf_longest; /* longest free space */ - xfs_agino_t pagi_freecount; /* number of free inodes */ + xfs_agino_t pagi_freecount; /* number of free inodes */ #ifdef __KERNEL__ lock_t pagb_lock; /* lock for pagb_list */ #endif @@ -231,19 +231,19 @@ typedef struct xfs_perag xfs_perag_busy_t *pagb_list; /* unstable blocks */ } xfs_perag_t; -#define XFS_AG_MIN_BYTES (1LL << 24) /* 16 MB */ -#define XFS_AG_BEST_BYTES (1LL << 30) /* 1 GB */ -#define XFS_AG_MAX_BYTES (1LL << 32) /* 4 GB */ +#define XFS_AG_MIN_BYTES (1LL << 24) /* 16 MB */ +#define XFS_AG_BEST_BYTES (1LL << 30) /* 1 GB */ +#define XFS_AG_MAX_BYTES (1LL << 32) /* 4 GB */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MIN_BLOCKS) xfs_extlen_t xfs_ag_min_blocks(int bl); -#define XFS_AG_MIN_BLOCKS(bl) xfs_ag_min_blocks(bl) +#define XFS_AG_MIN_BLOCKS(bl) xfs_ag_min_blocks(bl) #else -#define XFS_AG_MIN_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MIN_BYTES >> bl)) +#define XFS_AG_MIN_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MIN_BYTES >> bl)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_BEST_BLOCKS) xfs_extlen_t xfs_ag_best_blocks(int bl, xfs_drfsbno_t blks); -#define XFS_AG_BEST_BLOCKS(bl,blks) xfs_ag_best_blocks(bl,blks) +#define XFS_AG_BEST_BLOCKS(bl,blks) xfs_ag_best_blocks(bl,blks) #else /*--#define XFS_AG_BEST_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl))*/ /* @@ -257,41 +257,41 @@ xfs_extlen_t xfs_ag_best_blocks(int bl, xfs_drfsbno_t blks); #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAX_BLOCKS) xfs_extlen_t xfs_ag_max_blocks(int bl); -#define XFS_AG_MAX_BLOCKS(bl) xfs_ag_max_blocks(bl) +#define XFS_AG_MAX_BLOCKS(bl) xfs_ag_max_blocks(bl) #else -#define XFS_AG_MAX_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MAX_BYTES >> bl)) +#define XFS_AG_MAX_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MAX_BYTES >> bl)) #endif -#define XFS_MAX_AGNUMBER ((xfs_agnumber_t)(NULLAGNUMBER - 1)) +#define XFS_MAX_AGNUMBER ((xfs_agnumber_t)(NULLAGNUMBER - 1)) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAXLEVELS) int xfs_ag_maxlevels(struct xfs_mount *mp); -#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp) +#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp) #else -#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) +#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST) int xfs_min_freelist(xfs_agf_t *a, struct xfs_mount *mp); -#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp) +#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp) #else -#define XFS_MIN_FREELIST(a,mp) \ +#define XFS_MIN_FREELIST(a,mp) \ XFS_MIN_FREELIST_RAW( \ INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \ INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_PAG) int xfs_min_freelist_pag(xfs_perag_t *pag, struct xfs_mount *mp); -#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp) +#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp) #else -#define XFS_MIN_FREELIST_PAG(pag,mp) \ +#define XFS_MIN_FREELIST_PAG(pag,mp) \ XFS_MIN_FREELIST_RAW((uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \ (uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_RAW) int xfs_min_freelist_raw(int bl, int cl, struct xfs_mount *mp); -#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp) +#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp) #else -#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \ +#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \ (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + \ MIN(cl + 1, XFS_AG_MAXLEVELS(mp))) #endif @@ -301,30 +301,30 @@ xfs_fsblock_t xfs_agb_to_fsb(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno); #define XFS_AGB_TO_FSB(mp,agno,agbno) xfs_agb_to_fsb(mp,agno,agbno) #else -#define XFS_AGB_TO_FSB(mp,agno,agbno) \ +#define XFS_AGB_TO_FSB(mp,agno,agbno) \ (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGNO) xfs_agnumber_t xfs_fsb_to_agno(struct xfs_mount *mp, xfs_fsblock_t fsbno); -#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno) +#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno) #else -#define XFS_FSB_TO_AGNO(mp,fsbno) \ +#define XFS_FSB_TO_AGNO(mp,fsbno) \ ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGBNO) xfs_agblock_t xfs_fsb_to_agbno(struct xfs_mount *mp, xfs_fsblock_t fsbno); -#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno) +#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno) #else -#define XFS_FSB_TO_AGBNO(mp,fsbno) \ +#define XFS_FSB_TO_AGBNO(mp,fsbno) \ ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_DADDR) xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno); -#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno) +#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno) #else -#define XFS_AGB_TO_DADDR(mp,agno,agbno) \ +#define XFS_AGB_TO_DADDR(mp,agno,agbno) \ ((xfs_daddr_t)(XFS_FSB_TO_BB(mp, \ (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))) #endif @@ -336,28 +336,28 @@ xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_DADDR) xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_daddr_t d); -#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d) +#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d) #else -#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d)) +#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGF) xfs_agf_t *xfs_buf_to_agf(struct xfs_buf *bp); -#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp) +#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp) #else -#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) +#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGI) xfs_agi_t *xfs_buf_to_agi(struct xfs_buf *bp); -#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp) +#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp) #else -#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) +#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGFL) xfs_agfl_t *xfs_buf_to_agfl(struct xfs_buf *bp); -#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp) +#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp) #else -#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) +#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) #endif /* @@ -366,9 +366,9 @@ xfs_agfl_t *xfs_buf_to_agfl(struct xfs_buf *bp); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_CHECK_DADDR) void xfs_ag_check_daddr(struct xfs_mount *mp, xfs_daddr_t d, xfs_extlen_t len); -#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len) +#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len) #else -#define XFS_AG_CHECK_DADDR(mp,d,len) \ +#define XFS_AG_CHECK_DADDR(mp,d,len) \ ((len) == 1 ? \ ASSERT((d) == XFS_SB_DADDR || \ XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index eea6471ca19e..adaa9df00554 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -33,7 +33,26 @@ /* * Free space allocation for XFS. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_bit.h" +#include "xfs_error.h" + #if defined(DEBUG) /* @@ -44,8 +63,8 @@ ktrace_t *xfs_alloc_trace_buf; #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b))) -#define XFSA_FIXUP_BNO_OK 1 -#define XFSA_FIXUP_CNT_OK 2 +#define XFSA_FIXUP_BNO_OK 1 +#define XFSA_FIXUP_CNT_OK 2 int xfs_alloc_search_busy(xfs_trans_t *tp, @@ -54,27 +73,27 @@ xfs_alloc_search_busy(xfs_trans_t *tp, xfs_extlen_t len); #if defined(XFS_ALLOC_TRACE) -#define TRACE_ALLOC(s,a) \ +#define TRACE_ALLOC(s,a) \ xfs_alloc_trace_alloc(fname, s, a, __LINE__) -#define TRACE_FREE(s,a,b,x,f) \ +#define TRACE_FREE(s,a,b,x,f) \ xfs_alloc_trace_free(fname, s, mp, a, b, x, f, __LINE__) -#define TRACE_MODAGF(s,a,f) \ +#define TRACE_MODAGF(s,a,f) \ xfs_alloc_trace_modagf(fname, s, mp, a, f, __LINE__) -#define TRACE_BUSY(fname,s,ag,agb,l,sl,tp) \ +#define TRACE_BUSY(fname,s,ag,agb,l,sl,tp) \ xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSY, __LINE__) -#define TRACE_UNBUSY(fname,s,ag,sl,tp) \ +#define TRACE_UNBUSY(fname,s,ag,sl,tp) \ xfs_alloc_trace_busy(fname, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__) -#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \ +#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \ xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__) #else -#define TRACE_ALLOC(s,a) -#define TRACE_FREE(s,a,b,x,f) -#define TRACE_MODAGF(s,a,f) -#define TRACE_BUSY(s,a,ag,agb,l,sl,tp) -#define TRACE_UNBUSY(fname,s,ag,sl,tp) -#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) +#define TRACE_ALLOC(s,a) +#define TRACE_FREE(s,a,b,x,f) +#define TRACE_MODAGF(s,a,f) +#define TRACE_BUSY(s,a,ag,agb,l,sl,tp) +#define TRACE_UNBUSY(fname,s,ag,sl,tp) +#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) #endif /* XFS_ALLOC_TRACE */ /* @@ -189,7 +208,7 @@ xfs_alloc_compute_diff( */ STATIC void xfs_alloc_fix_len( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { xfs_extlen_t k; xfs_extlen_t rlen; @@ -223,7 +242,7 @@ xfs_alloc_fix_len( */ STATIC int xfs_alloc_fix_minleft( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { xfs_agf_t *agf; /* a.g. freelist header */ int diff; /* free space difference */ @@ -252,8 +271,8 @@ xfs_alloc_fix_minleft( */ STATIC int /* error code */ xfs_alloc_fixup_trees( - xfs_btree_cur_t *cnt_cur, /* cursor for by-size btree */ - xfs_btree_cur_t *bno_cur, /* cursor for by-block btree */ + xfs_btree_cur_t *cnt_cur, /* cursor for by-size btree */ + xfs_btree_cur_t *bno_cur, /* cursor for by-block btree */ xfs_agblock_t fbno, /* starting block of free extent */ xfs_extlen_t flen, /* length of free extent */ xfs_agblock_t rbno, /* starting block of returned extent */ @@ -423,7 +442,7 @@ STATIC void xfs_alloc_trace_alloc( char *name, /* function tag string */ char *str, /* additional string */ - xfs_alloc_arg_t *args, /* allocation argument structure */ + xfs_alloc_arg_t *args, /* allocation argument structure */ int line) /* source line number */ { ktrace_enter(xfs_alloc_trace_buf, @@ -551,7 +570,7 @@ xfs_alloc_trace_busy( */ STATIC int /* error */ xfs_alloc_ag_vextent( - xfs_alloc_arg_t *args) /* argument structure for allocation */ + xfs_alloc_arg_t *args) /* argument structure for allocation */ { int error=0; #ifdef XFS_ALLOC_TRACE @@ -631,10 +650,10 @@ xfs_alloc_ag_vextent( */ STATIC int /* error */ xfs_alloc_ag_vextent_exact( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { - xfs_btree_cur_t *bno_cur;/* by block-number btree cursor */ - xfs_btree_cur_t *cnt_cur;/* by count btree cursor */ + xfs_btree_cur_t *bno_cur;/* by block-number btree cursor */ + xfs_btree_cur_t *cnt_cur;/* by count btree cursor */ xfs_agblock_t end; /* end of allocated extent */ int error; xfs_agblock_t fbno; /* start block of found extent */ @@ -644,8 +663,8 @@ xfs_alloc_ag_vextent_exact( static char fname[] = "xfs_alloc_ag_vextent_exact"; #endif int i; /* success/failure of operation */ - xfs_agblock_t maxend; /* end of maximal extent */ - xfs_agblock_t minend; /* end of minimal extent */ + xfs_agblock_t maxend; /* end of maximal extent */ + xfs_agblock_t minend; /* end of minimal extent */ xfs_extlen_t rlen; /* length of returned extent */ ASSERT(args->alignment == 1); @@ -738,11 +757,11 @@ error0: */ STATIC int /* error */ xfs_alloc_ag_vextent_near( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { - xfs_btree_cur_t *bno_cur_gt; /* cursor for bno btree, right side */ - xfs_btree_cur_t *bno_cur_lt; /* cursor for bno btree, left side */ - xfs_btree_cur_t *cnt_cur; /* cursor for count btree */ + xfs_btree_cur_t *bno_cur_gt; /* cursor for bno btree, right side */ + xfs_btree_cur_t *bno_cur_lt; /* cursor for bno btree, left side */ + xfs_btree_cur_t *cnt_cur; /* cursor for count btree */ #ifdef XFS_ALLOC_TRACE static char fname[] = "xfs_alloc_ag_vextent_near"; #endif @@ -1277,10 +1296,10 @@ xfs_alloc_ag_vextent_near( */ STATIC int /* error */ xfs_alloc_ag_vextent_size( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { - xfs_btree_cur_t *bno_cur; /* cursor for bno btree */ - xfs_btree_cur_t *cnt_cur; /* cursor for cnt btree */ + xfs_btree_cur_t *bno_cur; /* cursor for bno btree */ + xfs_btree_cur_t *cnt_cur; /* cursor for cnt btree */ int error; /* error result */ xfs_agblock_t fbno; /* start of found freespace */ xfs_extlen_t flen; /* length of found freespace */ @@ -1433,10 +1452,10 @@ error0: */ STATIC int /* error */ xfs_alloc_ag_vextent_small( - xfs_alloc_arg_t *args, /* allocation argument structure */ - xfs_btree_cur_t *ccur, /* by-size cursor */ - xfs_agblock_t *fbnop, /* result block number */ - xfs_extlen_t *flenp, /* result length */ + xfs_alloc_arg_t *args, /* allocation argument structure */ + xfs_btree_cur_t *ccur, /* by-size cursor */ + xfs_agblock_t *fbnop, /* result block number */ + xfs_extlen_t *flenp, /* result length */ int *stat) /* status: 0-freelist, 1-normal/none */ { int error; @@ -1526,8 +1545,8 @@ xfs_free_ag_extent( xfs_extlen_t len, /* length of extent */ int isfl) /* set if is freelist blocks - no sb acctg */ { - xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */ - xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */ + xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */ + xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */ int error; /* error return value */ #ifdef XFS_ALLOC_TRACE static char fname[] = "xfs_free_ag_extent"; @@ -1775,7 +1794,7 @@ xfs_free_ag_extent( * used in xfs_bmap_finish, we can't allow block to be available * for reallocation and non-transaction writing (user data) * until we know that the transaction that moved it to the free - * list is permanently on disk. We track the blocks by declaring + * list is permanently on disk. We track the blocks by declaring * these blocks as "busy"; the busy list is maintained on a per-ag * basis and each transaction records which entries should be removed * when the iclog commits to disk. If a busy block is allocated, @@ -1826,7 +1845,7 @@ xfs_alloc_compute_maxlevels( */ STATIC int /* error */ xfs_alloc_fix_freelist( - xfs_alloc_arg_t *args, /* allocation argument structure */ + xfs_alloc_arg_t *args, /* allocation argument structure */ int flags) /* XFS_ALLOC_FLAG_... */ { xfs_buf_t *agbp; /* agf buffer pointer */ @@ -1839,7 +1858,7 @@ xfs_alloc_fix_freelist( xfs_mount_t *mp; /* file system mount point structure */ xfs_extlen_t need; /* total blocks needed in freelist */ xfs_perag_t *pag; /* per-ag information structure */ - xfs_alloc_arg_t targs; /* local allocation arguments */ + xfs_alloc_arg_t targs; /* local allocation arguments */ xfs_trans_t *tp; /* transaction pointer */ mp = args->mp; @@ -1959,8 +1978,8 @@ xfs_alloc_fix_freelist( if ((error = xfs_alloc_ag_vextent(&targs))) return error; /* - * Stop if we run out. Won't happen if callers are obeying - * the restrictions correctly. Can happen for free calls + * Stop if we run out. Won't happen if callers are obeying + * the restrictions correctly. Can happen for free calls * on a completely full ag. */ if (targs.agbno == NULLAGBLOCK) @@ -2035,7 +2054,7 @@ xfs_alloc_get_freelist( * As blocks are freed, they are added to the per-ag busy list * and remain there until the freeing transaction is committed to * disk. Now that we have allocated blocks, this list must be - * searched to see if a block is being reused. If one is, then + * searched to see if a block is being reused. If one is, then * the freeing transaction must be pushed to disk NOW by forcing * to disk all iclogs up that transaction's LSN. */ @@ -2050,7 +2069,7 @@ void xfs_alloc_log_agf( xfs_trans_t *tp, /* transaction pointer */ xfs_buf_t *bp, /* buffer for a.g. freelist header */ - int fields) /* mask of fields to be logged (XFS_AGF_...) */ + int fields) /* mask of fields to be logged (XFS_AGF_...) */ { int first; /* first byte offset */ int last; /* last byte offset */ @@ -2227,9 +2246,9 @@ xfs_alloc_read_agf( */ int /* error */ xfs_alloc_vextent( - xfs_alloc_arg_t *args) /* allocation argument structure */ + xfs_alloc_arg_t *args) /* allocation argument structure */ { - xfs_agblock_t agsize; /* allocation group size */ + xfs_agblock_t agsize; /* allocation group size */ int error; int flags; /* XFS_ALLOC_FLAG_... locking flags */ #ifdef XFS_ALLOC_TRACE @@ -2238,7 +2257,7 @@ xfs_alloc_vextent( xfs_extlen_t minleft;/* minimum left value, temp copy */ xfs_mount_t *mp; /* mount structure pointer */ xfs_agnumber_t sagno; /* starting allocation group number */ - xfs_alloctype_t type; /* input allocation type */ + xfs_alloctype_t type; /* input allocation type */ int bump_rotor = 0; int no_min = 0; @@ -2433,7 +2452,7 @@ xfs_free_extent( #ifdef DEBUG xfs_agf_t *agf; /* a.g. freespace header */ #endif - xfs_alloc_arg_t args; /* allocation argument structure */ + xfs_alloc_arg_t args; /* allocation argument structure */ int error; ASSERT(len != 0); @@ -2464,7 +2483,7 @@ error0: /* * AG Busy list management * The busy list contains block ranges that have been freed but whose - * transacations have not yet hit disk. If any block listed in a busy + * transacations have not yet hit disk. If any block listed in a busy * list is reused, the transaction that freed it must be forced to disk * before continuing to use the block. * diff --git a/fs/xfs/xfs_alloc.h b/fs/xfs/xfs_alloc.h index 8ab7ca03a7cc..49ce9aed6ceb 100644 --- a/fs/xfs/xfs_alloc.h +++ b/fs/xfs/xfs_alloc.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ALLOC_H__ -#define __XFS_ALLOC_H__ +#define __XFS_ALLOC_H__ struct xfs_buf; struct xfs_mount; @@ -38,7 +38,7 @@ struct xfs_perag; struct xfs_trans; /* - * Freespace allocation types. Argument to xfs_alloc_[v]extent. + * Freespace allocation types. Argument to xfs_alloc_[v]extent. */ typedef enum xfs_alloctype { @@ -54,7 +54,7 @@ typedef enum xfs_alloctype /* * 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 */ /* * Argument structure for xfs_alloc routines. @@ -78,8 +78,8 @@ typedef struct xfs_alloc_arg { xfs_extlen_t alignment; /* align answer to multiple of this */ xfs_extlen_t minalignslop; /* slop for minlen+alignment calcs */ xfs_extlen_t len; /* output: actual size of extent */ - xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */ - xfs_alloctype_t otype; /* original allocation type */ + xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */ + xfs_alloctype_t otype; /* original allocation type */ char wasdel; /* set if allocation was prev delayed */ char wasfromfl; /* set if allocation is from freelist */ char isfl; /* set if is freelist blocks - !actg */ @@ -98,21 +98,21 @@ typedef struct xfs_alloc_arg { /* * Types for alloc tracing. */ -#define XFS_ALLOC_KTRACE_ALLOC 1 -#define XFS_ALLOC_KTRACE_FREE 2 -#define XFS_ALLOC_KTRACE_MODAGF 3 -#define XFS_ALLOC_KTRACE_BUSY 4 -#define XFS_ALLOC_KTRACE_UNBUSY 5 -#define XFS_ALLOC_KTRACE_BUSYSEARCH 6 +#define XFS_ALLOC_KTRACE_ALLOC 1 +#define XFS_ALLOC_KTRACE_FREE 2 +#define XFS_ALLOC_KTRACE_MODAGF 3 +#define XFS_ALLOC_KTRACE_BUSY 4 +#define XFS_ALLOC_KTRACE_UNBUSY 5 +#define XFS_ALLOC_KTRACE_BUSYSEARCH 6 /* * Allocation tracing buffer size. */ -#define XFS_ALLOC_TRACE_SIZE 4096 +#define XFS_ALLOC_TRACE_SIZE 4096 #ifdef XFS_ALL_TRACE -#define XFS_ALLOC_TRACE +#define XFS_ALLOC_TRACE #endif #if !defined(DEBUG) @@ -138,7 +138,7 @@ int /* error */ xfs_alloc_get_freelist( struct xfs_trans *tp, /* transaction pointer */ struct xfs_buf *agbp, /* buffer containing the agf structure */ - xfs_agblock_t *bnop); /* block address retrieved from freelist */ + xfs_agblock_t *bnop); /* block address retrieved from freelist */ /* * Log the given fields from the agf structure. @@ -157,7 +157,7 @@ xfs_alloc_pagf_init( struct xfs_mount *mp, /* file system mount structure */ struct xfs_trans *tp, /* transaction pointer */ xfs_agnumber_t agno, /* allocation group number */ - int flags); /* XFS_ALLOC_FLAGS_... */ + int flags); /* XFS_ALLOC_FLAGS_... */ /* * Put the block on the freelist for the allocation group. @@ -185,7 +185,7 @@ xfs_alloc_read_agf( */ int /* error */ xfs_alloc_vextent( - xfs_alloc_arg_t *args); /* allocation argument structure */ + xfs_alloc_arg_t *args); /* allocation argument structure */ /* * Free an extent. diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c index 6ea6af923d2b..aec42df9af55 100644 --- a/fs/xfs/xfs_alloc_btree.c +++ b/fs/xfs/xfs_alloc_btree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,24 @@ * Free space allocation for XFS. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_error.h" /* * Prototypes for internal functions. @@ -68,7 +85,7 @@ xfs_alloc_delrec( int *stat) /* fail/done/go-on */ { xfs_agf_t *agf; /* allocation group freelist header */ - xfs_alloc_block_t *block; /* btree block record/key lives in */ + xfs_alloc_block_t *block; /* btree block record/key lives in */ xfs_agblock_t bno; /* btree block number */ xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ @@ -85,7 +102,7 @@ xfs_alloc_delrec( int ptr; /* index in btree block for this rec */ xfs_agblock_t rbno; /* right block's block number */ xfs_buf_t *rbp; /* right block's buffer pointer */ - xfs_alloc_block_t *right; /* right btree block */ + xfs_alloc_block_t *right; /* right btree block */ xfs_alloc_key_t *rkp; /* right block key pointer */ xfs_alloc_ptr_t *rpp; /* right block address pointer */ int rrecs=0; /* number of records in right block */ @@ -141,7 +158,7 @@ xfs_alloc_delrec( } } /* - * It's a leaf. Excise the record being deleted, by sliding the + * It's a leaf. Excise the record being deleted, by sliding the * entries past it down one. Log the changed areas of the block. */ else { @@ -455,7 +472,7 @@ xfs_alloc_delrec( } /* * Otherwise, we can't fix the imbalance. - * Just return. This is probably a logic error, but it's not fatal. + * Just return. This is probably a logic error, but it's not fatal. */ else { if (level > 0 && (error = xfs_alloc_decrement(cur, level, &i))) @@ -489,7 +506,7 @@ xfs_alloc_delrec( INT_GET(left->bb_numrecs, ARCH_CONVERT) + INT_GET(right->bb_numrecs, ARCH_CONVERT)); } else { /* - * It's a leaf. Move records. + * It's a leaf. Move records. */ lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); @@ -589,11 +606,11 @@ xfs_alloc_insrec( int level, /* level to insert record at */ xfs_agblock_t *bnop, /* i/o: block number inserted */ xfs_alloc_rec_t *recp, /* i/o: record data inserted */ - xfs_btree_cur_t **curp, /* output: new cursor replacing cur */ + xfs_btree_cur_t **curp, /* output: new cursor replacing cur */ int *stat) /* output: success/failure */ { xfs_agf_t *agf; /* allocation group freelist header */ - xfs_alloc_block_t *block; /* btree block record/key lives in */ + xfs_alloc_block_t *block; /* btree block record/key lives in */ xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ int i; /* loop index */ @@ -820,7 +837,7 @@ STATIC void xfs_alloc_log_block( xfs_trans_t *tp, /* transaction pointer */ xfs_buf_t *bp, /* buffer containing btree block */ - int fields) /* mask of fields: XFS_BB_... */ + int fields) /* mask of fields: XFS_BB_... */ { int first; /* first byte offset logged */ int last; /* last byte offset logged */ @@ -844,10 +861,10 @@ STATIC void xfs_alloc_log_keys( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int kfirst, /* index of first key to log */ + int kfirst, /* index of first key to log */ int klast) /* index of last key to log */ { - xfs_alloc_block_t *block; /* btree block to log from */ + xfs_alloc_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ xfs_alloc_key_t *kp; /* key pointer in btree block */ int last; /* last byte offset logged */ @@ -866,10 +883,10 @@ STATIC void xfs_alloc_log_ptrs( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int pfirst, /* index of first pointer to log */ + int pfirst, /* index of first pointer to log */ int plast) /* index of last pointer to log */ { - xfs_alloc_block_t *block; /* btree block to log from */ + xfs_alloc_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ int last; /* last byte offset logged */ xfs_alloc_ptr_t *pp; /* block-pointer pointer in btree blk */ @@ -888,10 +905,10 @@ STATIC void xfs_alloc_log_recs( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int rfirst, /* index of first record to log */ + int rfirst, /* index of first record to log */ int rlast) /* index of last record to log */ { - xfs_alloc_block_t *block; /* btree block to log from */ + xfs_alloc_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ int last; /* last byte offset logged */ xfs_alloc_rec_t *rp; /* record pointer for btree block */ @@ -902,7 +919,7 @@ xfs_alloc_log_recs( #ifdef DEBUG { xfs_agf_t *agf; - xfs_alloc_rec_t *p; + xfs_alloc_rec_t *p; agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); for (p = &rp[rfirst - 1]; p <= &rp[rlast - 1]; p++) @@ -997,8 +1014,8 @@ xfs_alloc_lookup( */ else { int high; /* high entry number */ - xfs_alloc_key_t *kkbase=NULL;/* base of keys in block */ - xfs_alloc_rec_t *krbase=NULL;/* base of records in block */ + xfs_alloc_key_t *kkbase=NULL;/* base of keys in block */ + xfs_alloc_rec_t *krbase=NULL;/* base of records in block */ int low; /* low entry number */ /* @@ -1038,13 +1055,13 @@ xfs_alloc_lookup( * Get startblock & blockcount. */ if (level > 0) { - xfs_alloc_key_t *kkp; + xfs_alloc_key_t *kkp; kkp = kkbase + keyno - 1; startblock = INT_GET(kkp->ar_startblock, ARCH_CONVERT); blockcount = INT_GET(kkp->ar_blockcount, ARCH_CONVERT); } else { - xfs_alloc_rec_t *krp; + xfs_alloc_rec_t *krp; krp = krbase + keyno - 1; startblock = INT_GET(krp->ar_startblock, ARCH_CONVERT); @@ -1151,7 +1168,7 @@ xfs_alloc_lshift( xfs_alloc_block_t *left; /* left neighbor btree block */ int nrec; /* new number of left block entries */ xfs_buf_t *rbp; /* buffer for right (current) block */ - xfs_alloc_block_t *right; /* right (current) btree block */ + xfs_alloc_block_t *right; /* right (current) btree block */ xfs_alloc_key_t *rkp=NULL; /* key pointer for right block */ xfs_alloc_ptr_t *rpp=NULL; /* address pointer for right block */ xfs_alloc_rec_t *rrp=NULL; /* record pointer for right block */ @@ -1202,8 +1219,8 @@ xfs_alloc_lshift( * If non-leaf, copy a key and a ptr to the left block. */ if (level > 0) { - xfs_alloc_key_t *lkp; /* key pointer for left block */ - xfs_alloc_ptr_t *lpp; /* address pointer for left block */ + xfs_alloc_key_t *lkp; /* key pointer for left block */ + xfs_alloc_ptr_t *lpp; /* address pointer for left block */ lkp = XFS_ALLOC_KEY_ADDR(left, nrec, cur); rkp = XFS_ALLOC_KEY_ADDR(right, 1, cur); @@ -1223,7 +1240,7 @@ xfs_alloc_lshift( * If leaf, copy a record to the left block. */ else { - xfs_alloc_rec_t *lrp; /* record pointer for left block */ + xfs_alloc_rec_t *lrp; /* record pointer for left block */ lrp = XFS_ALLOC_REC_ADDR(left, nrec, cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); @@ -1292,7 +1309,7 @@ xfs_alloc_newroot( int nptr; /* new value for key index, 1 or 2 */ xfs_agblock_t rbno; /* right block number */ xfs_buf_t *rbp; /* right btree buffer */ - xfs_alloc_block_t *right; /* right btree block */ + xfs_alloc_block_t *right; /* right btree block */ mp = cur->bc_mp; @@ -1395,7 +1412,7 @@ xfs_alloc_newroot( kp[0] = *XFS_ALLOC_KEY_ADDR(left, 1, cur); /* INT_: structure copy */ kp[1] = *XFS_ALLOC_KEY_ADDR(right, 1, cur);/* INT_: structure copy */ } else { - xfs_alloc_rec_t *rp; /* btree record pointer */ + xfs_alloc_rec_t *rp; /* btree record pointer */ rp = XFS_ALLOC_REC_ADDR(left, 1, cur); kp[0].ar_startblock = rp->ar_startblock; /* INT_: direct copy */ @@ -1443,7 +1460,7 @@ xfs_alloc_rshift( xfs_buf_t *lbp; /* buffer for left (current) block */ xfs_alloc_block_t *left; /* left (current) btree block */ xfs_buf_t *rbp; /* buffer for right neighbor block */ - xfs_alloc_block_t *right; /* right neighbor btree block */ + xfs_alloc_block_t *right; /* right neighbor btree block */ xfs_alloc_key_t *rkp; /* key pointer for right block */ xfs_btree_cur_t *tcur; /* temporary cursor */ @@ -1493,9 +1510,9 @@ xfs_alloc_rshift( * copy the last left block entry to the hole. */ if (level > 0) { - xfs_alloc_key_t *lkp; /* key pointer for left block */ - xfs_alloc_ptr_t *lpp; /* address pointer for left block */ - xfs_alloc_ptr_t *rpp; /* address pointer for right block */ + xfs_alloc_key_t *lkp; /* key pointer for left block */ + xfs_alloc_ptr_t *lpp; /* address pointer for left block */ + xfs_alloc_ptr_t *rpp; /* address pointer for right block */ lkp = XFS_ALLOC_KEY_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); lpp = XFS_ALLOC_PTR_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); @@ -1519,8 +1536,8 @@ xfs_alloc_rshift( xfs_alloc_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1); xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1); } else { - xfs_alloc_rec_t *lrp; /* record pointer for left block */ - xfs_alloc_rec_t *rrp; /* record pointer for right block */ + xfs_alloc_rec_t *lrp; /* record pointer for left block */ + xfs_alloc_rec_t *rrp; /* record pointer for right block */ lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); @@ -1568,7 +1585,7 @@ xfs_alloc_split( int level, /* level to split */ xfs_agblock_t *bnop, /* output: block number allocated */ xfs_alloc_key_t *keyp, /* output: first key of new block */ - xfs_btree_cur_t **curp, /* output: new cursor */ + xfs_btree_cur_t **curp, /* output: new cursor */ int *stat) /* success/failure */ { int error; /* error return value */ @@ -1578,7 +1595,7 @@ xfs_alloc_split( xfs_alloc_block_t *left; /* left (current) btree block */ xfs_agblock_t rbno; /* right (new) block number */ xfs_buf_t *rbp; /* buffer for right block */ - xfs_alloc_block_t *right; /* right (new) btree block */ + xfs_alloc_block_t *right; /* right (new) btree block */ /* * Allocate the new block from the freelist. @@ -1625,10 +1642,10 @@ xfs_alloc_split( * For non-leaf blocks, copy keys and addresses over to the new block. */ if (level > 0) { - xfs_alloc_key_t *lkp; /* left btree key pointer */ - xfs_alloc_ptr_t *lpp; /* left btree address pointer */ - xfs_alloc_key_t *rkp; /* right btree key pointer */ - xfs_alloc_ptr_t *rpp; /* right btree address pointer */ + xfs_alloc_key_t *lkp; /* left btree key pointer */ + xfs_alloc_ptr_t *lpp; /* left btree address pointer */ + xfs_alloc_key_t *rkp; /* right btree key pointer */ + xfs_alloc_ptr_t *rpp; /* right btree address pointer */ lkp = XFS_ALLOC_KEY_ADDR(left, i, cur); lpp = XFS_ALLOC_PTR_ADDR(left, i, cur); @@ -1650,8 +1667,8 @@ xfs_alloc_split( * For leaf blocks, copy records over to the new block. */ else { - xfs_alloc_rec_t *lrp; /* left btree record pointer */ - xfs_alloc_rec_t *rrp; /* right btree record pointer */ + xfs_alloc_rec_t *lrp; /* left btree record pointer */ + xfs_alloc_rec_t *rrp; /* right btree record pointer */ lrp = XFS_ALLOC_REC_ADDR(left, i, cur); rrp = XFS_ALLOC_REC_ADDR(right, 1, cur); @@ -1730,7 +1747,7 @@ xfs_alloc_updkey( * at the first entry in the block. */ for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) { - xfs_alloc_block_t *block; /* btree block */ + xfs_alloc_block_t *block; /* btree block */ xfs_buf_t *bp; /* buffer for block */ #ifdef DEBUG int error; /* error return value */ @@ -1765,7 +1782,7 @@ xfs_alloc_decrement( int level, /* level in btree, 0 is leaf */ int *stat) /* success/failure */ { - xfs_alloc_block_t *block; /* btree block */ + xfs_alloc_block_t *block; /* btree block */ int error; /* error return value */ int lev; /* btree level */ @@ -1846,7 +1863,7 @@ xfs_alloc_decrement( */ int /* error */ xfs_alloc_delete( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ int *stat) /* success/failure */ { int error; /* error return value */ @@ -1885,7 +1902,7 @@ xfs_alloc_get_rec( xfs_extlen_t *len, /* output: length of extent */ int *stat) /* output: success/failure */ { - xfs_alloc_block_t *block; /* btree block */ + xfs_alloc_block_t *block; /* btree block */ #ifdef DEBUG int error; /* error return value */ #endif @@ -1928,7 +1945,7 @@ xfs_alloc_increment( int level, /* level in btree, 0 is leaf */ int *stat) /* success/failure */ { - xfs_alloc_block_t *block; /* btree block */ + xfs_alloc_block_t *block; /* btree block */ xfs_buf_t *bp; /* tree block buffer */ int error; /* error return value */ int lev; /* btree level */ @@ -2015,16 +2032,16 @@ xfs_alloc_increment( */ int /* error */ xfs_alloc_insert( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ int *stat) /* success/failure */ { int error; /* error return value */ int i; /* result value, 0 for failure */ int level; /* current level number in btree */ xfs_agblock_t nbno; /* new block number (split result) */ - xfs_btree_cur_t *ncur; /* new cursor (split result) */ - xfs_alloc_rec_t nrec; /* record being inserted this level */ - xfs_btree_cur_t *pcur; /* previous level's cursor */ + xfs_btree_cur_t *ncur; /* new cursor (split result) */ + xfs_alloc_rec_t nrec; /* record being inserted this level */ + xfs_btree_cur_t *pcur; /* previous level's cursor */ level = 0; nbno = NULLAGBLOCK; @@ -2074,7 +2091,7 @@ xfs_alloc_insert( */ int /* error */ xfs_alloc_lookup_eq( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ int *stat) /* success/failure */ @@ -2090,7 +2107,7 @@ xfs_alloc_lookup_eq( */ int /* error */ xfs_alloc_lookup_ge( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ int *stat) /* success/failure */ @@ -2106,7 +2123,7 @@ xfs_alloc_lookup_ge( */ int /* error */ xfs_alloc_lookup_le( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ int *stat) /* success/failure */ @@ -2126,7 +2143,7 @@ xfs_alloc_update( xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len) /* length of extent */ { - xfs_alloc_block_t *block; /* btree block to update */ + xfs_alloc_block_t *block; /* btree block to update */ int error; /* error return value */ int ptr; /* current record number (updating) */ @@ -2176,7 +2193,7 @@ xfs_alloc_update( * Updating first record in leaf. Pass new key value up to our parent. */ if (ptr == 1) { - xfs_alloc_key_t key; /* key containing [bno, len] */ + xfs_alloc_key_t key; /* key containing [bno, len] */ INT_SET(key.ar_startblock, ARCH_CONVERT, bno); INT_SET(key.ar_blockcount, ARCH_CONVERT, len); diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h index e788103ba5e2..ed5161a572ef 100644 --- a/fs/xfs/xfs_alloc_btree.h +++ b/fs/xfs/xfs_alloc_btree.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ALLOC_BTREE_H__ -#define __XFS_ALLOC_BTREE_H__ +#define __XFS_ALLOC_BTREE_H__ /* * Freespace on-disk structures @@ -46,8 +46,8 @@ struct xfs_mount; * by blockcount and blockno. All blocks look the same to make the code * simpler; if we have time later, we'll make the optimizations. */ -#define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */ -#define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */ +#define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */ +#define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */ /* * Data record/key structure @@ -60,13 +60,13 @@ typedef struct xfs_alloc_rec typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */ /* btree block header type */ -typedef struct xfs_btree_sblock xfs_alloc_block_t; +typedef struct xfs_btree_sblock xfs_alloc_block_t; #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_ALLOC_BLOCK) xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp); -#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp) +#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp) #else -#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp))) #endif /* @@ -75,23 +75,23 @@ xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_SIZE) int xfs_alloc_block_size(int lev, struct xfs_btree_cur *cur); -#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur) +#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur) #else -#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) +#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS) int xfs_alloc_block_maxrecs(int lev, struct xfs_btree_cur *cur); -#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur) +#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur) #else -#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \ +#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \ ((cur)->bc_mp->m_alloc_mxr[lev != 0]) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS) int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur); -#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur) +#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur) #else -#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \ +#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \ ((cur)->bc_mp->m_alloc_mnr[lev != 0]) #endif @@ -115,15 +115,15 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK) xfs_agblock_t xfs_bno_block(struct xfs_mount *mp); -#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp) +#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp) #else -#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1)) +#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK) xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp); -#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp) +#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp) #else -#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1)) +#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1)) #endif /* @@ -132,9 +132,9 @@ xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_REC_ADDR) xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur) +#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur) #else -#define XFS_ALLOC_REC_ADDR(bb,i,cur) \ +#define XFS_ALLOC_REC_ADDR(bb,i,cur) \ XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, bb, i, \ XFS_ALLOC_BLOCK_MAXRECS(0, cur)) #endif @@ -142,9 +142,9 @@ xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i, #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_KEY_ADDR) xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur) +#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur) #else -#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \ +#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \ XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ XFS_ALLOC_BLOCK_MAXRECS(1, cur)) #endif @@ -152,9 +152,9 @@ xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i, #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_PTR_ADDR) xfs_alloc_ptr_t *xfs_alloc_ptr_addr(xfs_alloc_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur) +#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur) #else -#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \ +#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \ XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ XFS_ALLOC_BLOCK_MAXRECS(1, cur)) #endif @@ -171,7 +171,7 @@ int /* error */ xfs_alloc_decrement( struct xfs_btree_cur *cur, /* btree cursor */ int level, /* level in btree, 0 is leaf */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Delete the record pointed to by cur. @@ -181,7 +181,7 @@ xfs_alloc_decrement( int /* error */ xfs_alloc_delete( struct xfs_btree_cur *cur, /* btree cursor */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Get the data from the pointed-to record. @@ -191,7 +191,7 @@ xfs_alloc_get_rec( struct xfs_btree_cur *cur, /* btree cursor */ xfs_agblock_t *bno, /* output: starting block of extent */ xfs_extlen_t *len, /* output: length of extent */ - int *stat); /* output: success/failure */ + int *stat); /* output: success/failure */ /* * Increment cursor by one record at the level. @@ -201,7 +201,7 @@ int /* error */ xfs_alloc_increment( struct xfs_btree_cur *cur, /* btree cursor */ int level, /* level in btree, 0 is leaf */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Insert the current record at the point referenced by cur. @@ -210,7 +210,7 @@ xfs_alloc_increment( int /* error */ xfs_alloc_insert( struct xfs_btree_cur *cur, /* btree cursor */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the record equal to [bno, len] in the btree given by cur. @@ -220,7 +220,7 @@ xfs_alloc_lookup_eq( struct xfs_btree_cur *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the first record greater than or equal to [bno, len] @@ -231,7 +231,7 @@ xfs_alloc_lookup_ge( struct xfs_btree_cur *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the first record less than or equal to [bno, len] @@ -242,7 +242,7 @@ xfs_alloc_lookup_le( struct xfs_btree_cur *cur, /* btree cursor */ xfs_agblock_t bno, /* starting block of extent */ xfs_extlen_t len, /* length of extent */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Update the record referred to by cur, to the value given by [bno, len]. diff --git a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h index 4629bc745e07..c0f911a2042d 100644 --- a/fs/xfs/xfs_arch.h +++ b/fs/xfs/xfs_arch.h @@ -11,7 +11,7 @@ * * 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 + * 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. diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 9035b4796c3f..3514de27c85c 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,39 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_leaf.h" +#include "xfs_error.h" +#include "xfs_bit.h" +#include "xfs_quota.h" +#include "xfs_rw.h" +#include "xfs_trans_space.h" /* * xfs_attr.c @@ -71,7 +103,7 @@ STATIC int xfs_attr_rmtval_set(xfs_da_args_t *args); STATIC int xfs_attr_rmtval_remove(xfs_da_args_t *args); #define ATTR_RMTVALUE_MAPSIZE 1 /* # of map entries at once */ -#define ATTR_RMTVALUE_TRANSBLKS 8 /* max # of blks in a transaction */ +#define ATTR_RMTVALUE_TRANSBLKS 8 /* max # of blks in a transaction */ #if defined(DEBUG) ktrace_t *xfs_attr_trace_buf; @@ -88,9 +120,9 @@ int /* error */ xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp, int flags, struct cred *cred) { - xfs_da_args_t args; - int error; - int namelen; + xfs_da_args_t args; + int error; + int namelen; xfs_inode_t *ip = XFS_BHVTOI(bdp); if (!name) @@ -170,8 +202,8 @@ xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags, int local, size; uint nblks; xfs_mount_t *mp; - int rsvd = (flags & ATTR_ROOT) != 0; - int namelen; + int rsvd = (flags & ATTR_ROOT) != 0; + int namelen; ASSERT(MAXNAMELEN-1 <= 0xff); /* length is stored in uint8 */ namelen = strlen(name); @@ -423,13 +455,13 @@ out: int /* error */ xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred) { - xfs_da_args_t args; - xfs_inode_t *dp; - xfs_fsblock_t firstblock; - xfs_bmap_free_t flist; - int error; - xfs_mount_t *mp; - int namelen; + xfs_da_args_t args; + xfs_inode_t *dp; + xfs_fsblock_t firstblock; + xfs_bmap_free_t flist; + int error; + xfs_mount_t *mp; + int namelen; ASSERT(MAXNAMELEN-1<=0xff); /* length is stored in uint8 */ namelen = strlen(name); @@ -575,7 +607,7 @@ out: /* * Generate a list of extended attribute names and optionally - * also value lengths. Positive return value follows the XFS + * also value lengths. Positive return value follows the XFS * convention of being an error, zero or negative return code * is the length of the buffer returned (negated), indicating * success. @@ -617,7 +649,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, context.resynch = 1; context.flags = flags; if (!(flags & ATTR_KERNAMELS)) { - context.bufsize = (bufsize & ~(sizeof(int)-1)); /* align */ + context.bufsize = (bufsize & ~(sizeof(int)-1)); /* align */ context.firstu = context.bufsize; context.alist = (attrlist_t *)buffer; context.alist->al_count = 0; diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h index de61abd0dcb0..7d17eb239a9c 100644 --- a/fs/xfs/xfs_attr.h +++ b/fs/xfs/xfs_attr.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ATTR_H__ -#define __XFS_ATTR_H__ +#define __XFS_ATTR_H__ /* * xfs_attr.h @@ -46,7 +46,7 @@ */ #ifdef XFS_ALL_TRACE -#define XFS_ATTR_TRACE +#define XFS_ATTR_TRACE #endif #if !defined(DEBUG) @@ -68,15 +68,15 @@ /* * The maximum size (into the kernel or returned from the kernel) of an - * attribute value or the buffer used for an attr_list() call. Larger + * attribute value or the buffer used for an attr_list() call. Larger * sizes will result in an ERANGE return code. */ -#define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ +#define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ /* * Define how lists of attribute names are returned to the user from * the attr_list() call. A large, 32bit aligned, buffer is passed in - * along with its size. We put an array of offsets at the top that each + * along with its size. We put an array of offsets at the top that each * reference an attrlist_ent_t and pack the attrlist_ent_t's at the bottom. */ typedef struct attrlist { @@ -98,7 +98,7 @@ typedef struct attrlist_ent { /* data from attr_list() */ * Given a pointer to the (char*) buffer containing the attr_list() result, * and an index, return a pointer to the indicated attribute in the buffer. */ -#define ATTR_ENTRY(buffer, index) \ +#define ATTR_ENTRY(buffer, index) \ ((attrlist_ent_t *) \ &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ]) diff --git a/fs/xfs/xfs_attr_fetch.c b/fs/xfs/xfs_attr_fetch.c index 4b1a23cb21a6..108bddc93710 100644 --- a/fs/xfs/xfs_attr_fetch.c +++ b/fs/xfs/xfs_attr_fetch.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,36 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_itable.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_leaf.h" int xfs_attr_fetch(xfs_inode_t *ip, char *name, char *value, int valuelen) diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 984ad228d640..9b1012668751 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,7 +35,36 @@ * GROT: figure out how to recover gracefully when bmap returns ENOSPC. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_leaf.h" +#include "xfs_error.h" +#include "xfs_bit.h" /* * xfs_attr_leaf.c @@ -865,7 +894,7 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args) /* * After compaction, the block is guaranteed to have only one - * free region, in freemap[0]. If it is not big enough, give up. + * free region, in freemap[0]. If it is not big enough, give up. */ if (INT_GET(hdr->freemap[0].size, ARCH_CONVERT) < (entsize + sizeof(xfs_attr_leaf_entry_t))) @@ -1068,7 +1097,7 @@ xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp) * * This code adjusts the args->index/blkno and args->index2/blkno2 fields * to match what it is doing in splitting the attribute leaf block. Those - * values are used in "atomic rename" operations on attributes. Note that + * values are used in "atomic rename" operations on attributes. Note that * the "new" and "old" values can end up in different blocks. */ STATIC void @@ -1285,7 +1314,7 @@ xfs_attr_leaf_figure_balance(xfs_da_state_t *state, entry = &leaf1->entries[0]; for (count = index = 0; count < max; entry++, index++, count++) { -#define XFS_ATTR_ABS(A) (((A) < 0) ? -(A) : (A)) +#define XFS_ATTR_ABS(A) (((A) < 0) ? -(A) : (A)) /* * The new entry is in the first block, account for it. */ @@ -1708,7 +1737,7 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, memset(tmpbuffer, 0, state->blocksize); tmp_leaf = (xfs_attr_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; - tmp_hdr->info = save_hdr->info; /* struct copy */ + tmp_hdr->info = save_hdr->info; /* struct copy */ INT_ZERO(tmp_hdr->count, ARCH_CONVERT); INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) { @@ -2004,7 +2033,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, #ifdef GROT /* * Code to drop INCOMPLETE entries. Difficult to use as we - * may also need to change the insertion index. Code turned + * may also need to change the insertion index. Code turned * off for 6.2, should be revisited later. */ if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ @@ -2291,9 +2320,9 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context) return(retval); } -#define ATTR_ENTBASESIZE /* minimum bytes used by an attr */ \ +#define ATTR_ENTBASESIZE /* minimum bytes used by an attr */ \ (((struct attrlist_ent *) 0)->a_name - (char *) 0) -#define ATTR_ENTSIZE(namelen) /* actual bytes used by an attr */ \ +#define ATTR_ENTSIZE(namelen) /* actual bytes used by an attr */ \ ((ATTR_ENTBASESIZE + (namelen) + 1 + sizeof(u_int32_t)-1) \ & ~(sizeof(u_int32_t)-1)) @@ -2957,7 +2986,7 @@ xfs_attr_rolltrans(xfs_trans_t **transp, xfs_inode_t *dp) * Reserve space in the log for th next transaction. * This also pushes items in the "AIL", the list of logged items, * out to disk if they are taking up space at the tail of the log - * that we want to use. This requires that either nothing be locked + * that we want to use. This requires that either nothing be locked * across this call, or that anything that is locked be logged in * the prior and the next transactions. */ diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 8d301be59c45..97b213a4bae4 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ATTR_LEAF_H__ -#define __XFS_ATTR_LEAF_H__ +#define __XFS_ATTR_LEAF_H__ /* * Attribute storage layout, internal structure, access macros, etc. @@ -38,7 +38,7 @@ * Attribute lists are structured around Btrees where all the data * elements are in the leaf nodes. Attribute names are hashed into an int, * then that int is used as the index into the Btree. Since the hashval - * of an attribute name may not be unique, we may have duplicate keys. The + * of an attribute name may not be unique, we may have duplicate keys. The * internal links in the Btree are logical block offsets into the file. */ @@ -58,7 +58,7 @@ struct xfs_trans; /* * This is the structure of the leaf nodes in the Btree. * - * Struct leaf_entry's are packed from the top. Name/values grow from the + * Struct leaf_entry's are packed from the top. Name/values grow from the * bottom but are not packed. The freemap contains run-length-encoded entries * for the free bytes after the leaf_entry's, but only the N largest such, * smaller runs are dropped. When the freemap doesn't show enough space @@ -76,10 +76,10 @@ struct xfs_trans; * the leaf_entry. The namespaces are independent only because we also look * at the root/user bit when we are looking for a matching attribute name. * - * We also store a "incomplete" bit in the leaf_entry. It shows that an + * We also store a "incomplete" bit in the leaf_entry. It shows that an * attribute is in the middle of being created and should not be shown to * the user if we crash during the time that the bit is set. We clear the - * bit when we have finished setting up the attribute. We do this because + * bit when we have finished setting up the attribute. We do this because * we cannot create some large attributes inside a single transaction, and we * need some indication that we weren't finished if we crash in the middle. */ @@ -127,9 +127,9 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t; * NOTE: the INCOMPLETE bit must not collide with the flags bits specified * on the system call, they are "or"ed together for various operations. */ -#define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */ -#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */ -#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */ +#define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */ +#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */ +#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */ #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT) #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT) #define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT) @@ -138,7 +138,7 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t; * Alignment for namelist and valuelist entries (since they are mixed * there can be only one alignment value) */ -#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t)) +#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t)) /* * Cast typed pointers for "local" and "remote" name/value structs. @@ -211,11 +211,11 @@ int xfs_attr_leaf_entsize_local_max(int bsize); typedef struct xfs_attr_list_context { struct xfs_inode *dp; /* inode */ struct attrlist_cursor_kern *cursor;/* position in list */ - struct attrlist *alist; /* output buffer */ + struct attrlist *alist; /* output buffer */ int count; /* num used entries */ - int dupcnt; /* count dup hashvals seen */ + int dupcnt; /* count dup hashvals seen */ int bufsize;/* total buffer size */ - int firstu; /* first used byte in buffer */ + int firstu; /* first used byte in buffer */ int flags; /* from VOP call */ int resynch;/* T/F: resynch with cursor */ } xfs_attr_list_context_t; diff --git a/fs/xfs/xfs_attr_sf.h b/fs/xfs/xfs_attr_sf.h index 6071fe0e571b..cbfc04ad866b 100644 --- a/fs/xfs/xfs_attr_sf.h +++ b/fs/xfs/xfs_attr_sf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ATTR_SF_H__ -#define __XFS_ATTR_SF_H__ +#define __XFS_ATTR_SF_H__ /* * Attribute storage when stored inside the inode. @@ -105,7 +105,7 @@ int xfs_attr_sf_totsize(struct xfs_inode *dp); #endif #ifdef XFS_ALL_TRACE -#define XFS_ATTR_TRACE +#define XFS_ATTR_TRACE #endif #if !defined(DEBUG) @@ -120,15 +120,15 @@ struct xfs_da_intnode; struct xfs_da_node_entry; struct xfs_attr_leafblock; -#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */ +#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */ /* * Trace record types. */ -#define XFS_ATTR_KTRACE_L_C 1 /* context */ -#define XFS_ATTR_KTRACE_L_CN 2 /* context, node */ -#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */ -#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */ +#define XFS_ATTR_KTRACE_L_C 1 /* context */ +#define XFS_ATTR_KTRACE_L_CN 2 /* context, node */ +#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */ +#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */ #if defined(XFS_ATTR_TRACE) @@ -148,10 +148,10 @@ void xfs_attr_trace_enter(int type, char *where, __psunsigned_t a12, __psunsigned_t a13, __psunsigned_t a14, __psunsigned_t a15); #else -#define xfs_attr_trace_l_c(w,c) -#define xfs_attr_trace_l_cn(w,c,n) -#define xfs_attr_trace_l_cb(w,c,b) -#define xfs_attr_trace_l_cl(w,c,l) +#define xfs_attr_trace_l_c(w,c) +#define xfs_attr_trace_l_cn(w,c,n) +#define xfs_attr_trace_l_cb(w,c,b) +#define xfs_attr_trace_l_cl(w,c,l) #endif /* XFS_ATTR_TRACE */ #endif /* __XFS_ATTR_SF_H__ */ diff --git a/fs/xfs/xfs_bit.c b/fs/xfs/xfs_bit.c index 758998976200..000550a96fc0 100644 --- a/fs/xfs/xfs_bit.c +++ b/fs/xfs/xfs_bit.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,12 @@ * XFS bit manipulation routines, used in non-realtime code. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_bit.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_buf_item.h" + #ifndef HAVE_ARCH_HIGHBIT /* @@ -231,7 +236,7 @@ xfs_count_bits(uint *map, uint size, uint start_bit) * start_bit. Size is the size of the bitmap in words. */ int -xfs_contig_bits(uint *map, uint size, uint start_bit) +xfs_contig_bits(uint *map, uint size, uint start_bit) { #if BITS_PER_LONG == 32 return find_next_zero_bit((unsigned long *)map, @@ -263,7 +268,7 @@ xfs_contig_bits(uint *map, uint size, uint start_bit) /* * This takes the bit number to start looking from and - * returns the next set bit from there. It returns -1 + * returns the next set bit from there. It returns -1 * if there are no more bits set or the start bit is * beyond the end of the bitmap. * diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h index ed5483fa30de..1e7f57ddf7a8 100644 --- a/fs/xfs/xfs_bit.h +++ b/fs/xfs/xfs_bit.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_BIT_H__ -#define __XFS_BIT_H__ +#define __XFS_BIT_H__ /* * XFS bit manipulation routines. @@ -41,27 +41,27 @@ */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32HI) __uint32_t xfs_mask32hi(int n); -#define XFS_MASK32HI(n) xfs_mask32hi(n) +#define XFS_MASK32HI(n) xfs_mask32hi(n) #else -#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n))) +#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64HI) __uint64_t xfs_mask64hi(int n); -#define XFS_MASK64HI(n) xfs_mask64hi(n) +#define XFS_MASK64HI(n) xfs_mask64hi(n) #else -#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n))) +#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32LO) __uint32_t xfs_mask32lo(int n); -#define XFS_MASK32LO(n) xfs_mask32lo(n) +#define XFS_MASK32LO(n) xfs_mask32lo(n) #else -#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1) +#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64LO) __uint64_t xfs_mask64lo(int n); -#define XFS_MASK64LO(n) xfs_mask64lo(n) +#define XFS_MASK64LO(n) xfs_mask64lo(n) #else -#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1) +#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1) #endif /* Get high bit set out of 32-bit argument, -1 if none set */ diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 2f742c82c2d6..100260bd16cf 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,44 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_dmapi.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_itable.h" +#include "xfs_extfree_item.h" +#include "xfs_alloc.h" +#include "xfs_bmap.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_bit.h" +#include "xfs_rw.h" +#include "xfs_quota.h" +#include "xfs_trans_space.h" +#include "xfs_buf_item.h" #ifdef DEBUG ktrace_t *xfs_bmap_trace_buf; @@ -78,10 +115,10 @@ STATIC int /* error */ xfs_bmap_add_extent( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ - xfs_fsblock_t *first, /* pointer to firstblock variable */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_fsblock_t *first, /* pointer to firstblock variable */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ int *logflagsp, /* inode logging flags */ int whichfork, /* data or attr fork */ int rsvd); /* OK to allocate reserved blocks */ @@ -94,11 +131,11 @@ STATIC int /* error */ xfs_bmap_add_extent_delay_real( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */ - xfs_fsblock_t *first, /* pointer to firstblock variable */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_fsblock_t *first, /* pointer to firstblock variable */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ int *logflagsp, /* inode logging flags */ int rsvd); /* OK to allocate reserved blocks */ @@ -136,7 +173,7 @@ STATIC int /* error */ xfs_bmap_add_extent_unwritten_real( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ int *logflagsp); /* inode logging flags */ @@ -171,7 +208,7 @@ xfs_bmap_check_extents( xfs_inode_t *ip, /* incore inode pointer */ int whichfork); /* data or attr fork */ #else -#define xfs_bmap_check_extents(ip,w) +#define xfs_bmap_check_extents(ip,w) #endif /* @@ -183,7 +220,7 @@ xfs_bmap_del_extent( xfs_inode_t *ip, /* incore inode pointer */ xfs_trans_t *tp, /* current trans pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ xfs_btree_cur_t *cur, /* if null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ int *logflagsp,/* inode logging flags */ @@ -196,9 +233,9 @@ xfs_bmap_del_extent( */ STATIC void xfs_bmap_del_free( - xfs_bmap_free_t *flist, /* free item list header */ + xfs_bmap_free_t *flist, /* free item list header */ xfs_bmap_free_item_t *prev, /* previous item on list, if any */ - xfs_bmap_free_item_t *free); /* list item to be freed */ + xfs_bmap_free_item_t *free); /* list item to be freed */ /* * Remove count entries from the extents array for inode "ip", starting @@ -236,13 +273,13 @@ xfs_bmap_insert_exlist( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* starting index of new items */ xfs_extnum_t count, /* number of inserted items */ - xfs_bmbt_irec_t *new, /* items to insert */ + xfs_bmbt_irec_t *new, /* items to insert */ int whichfork); /* data or attr fork */ /* * Convert a local file to an extents file. * This code is sort of bogus, since the file data needs to get - * logged so it won't be lost. The bmap-level manipulations are ok, though. + * logged so it won't be lost. The bmap-level manipulations are ok, though. */ STATIC int /* error */ xfs_bmap_local_to_extents( @@ -267,8 +304,8 @@ xfs_bmap_search_extents( int whichfork, /* data or attr fork */ int *eofp, /* out: end of file found */ xfs_extnum_t *lastxp, /* out: last extent index */ - xfs_bmbt_irec_t *gotp, /* out: extent entry found */ - xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */ + xfs_bmbt_irec_t *gotp, /* out: extent entry found */ + xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */ #ifdef XFS_BMAP_TRACE /* @@ -309,8 +346,8 @@ xfs_bmap_trace_insert( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* index of entry(entries) inserted */ xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */ - xfs_bmbt_irec_t *r1, /* inserted record 1 */ - xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ + xfs_bmbt_irec_t *r1, /* inserted record 1 */ + xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ int whichfork); /* data or attr fork */ /* @@ -336,10 +373,10 @@ xfs_bmap_trace_pre_update( int whichfork); /* data or attr fork */ #else -#define xfs_bmap_trace_delete(f,d,ip,i,c,w) -#define xfs_bmap_trace_insert(f,d,ip,i,c,r1,r2,w) -#define xfs_bmap_trace_post_update(f,d,ip,i,w) -#define xfs_bmap_trace_pre_update(f,d,ip,i,w) +#define xfs_bmap_trace_delete(f,d,ip,i,c,w) +#define xfs_bmap_trace_insert(f,d,ip,i,c,r1,r2,w) +#define xfs_bmap_trace_post_update(f,d,ip,i,w) +#define xfs_bmap_trace_pre_update(f,d,ip,i,w) #endif /* XFS_BMAP_TRACE */ /* @@ -365,7 +402,7 @@ xfs_bmap_validate_ret( int nmap, int ret_nmap); #else -#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) +#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) #endif /* DEBUG */ #if defined(DEBUG) && defined(XFS_RW_TRACE) @@ -377,15 +414,15 @@ xfs_bunmap_trace( int flags, inst_t *ra); #else -#define xfs_bunmap_trace(ip, bno, len, flags, ra) +#define xfs_bunmap_trace(ip, bno, len, flags, ra) #endif /* DEBUG && XFS_RW_TRACE */ STATIC int xfs_bmap_count_tree( - xfs_mount_t *mp, - xfs_trans_t *tp, - xfs_fsblock_t blockno, - int levelin, + xfs_mount_t *mp, + xfs_trans_t *tp, + xfs_fsblock_t blockno, + int levelin, int *count); STATIC int @@ -509,10 +546,10 @@ STATIC int /* error */ xfs_bmap_add_extent( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ - xfs_fsblock_t *first, /* pointer to firstblock variable */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_fsblock_t *first, /* pointer to firstblock variable */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ int *logflagsp, /* inode logging flags */ int whichfork, /* data or attr fork */ int rsvd) /* OK to use reserved data blocks */ @@ -574,7 +611,7 @@ xfs_bmap_add_extent( &logflags, whichfork))) goto done; } else { - xfs_bmbt_irec_t prev; /* old extent at offset idx */ + xfs_bmbt_irec_t prev; /* old extent at offset idx */ /* * Get the record referred to by idx. @@ -678,11 +715,11 @@ STATIC int /* error */ xfs_bmap_add_extent_delay_real( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */ - xfs_fsblock_t *first, /* pointer to firstblock variable */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_fsblock_t *first, /* pointer to firstblock variable */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ int *logflagsp, /* inode logging flags */ int rsvd) /* OK to use reserved data block allocation */ { @@ -698,7 +735,7 @@ xfs_bmap_add_extent_delay_real( xfs_fileoff_t new_endoff; /* end offset of new entry */ xfs_bmbt_irec_t r[3]; /* neighbor extent entries */ /* left is 0, right is 1, prev is 2 */ - int rval=0; /* return value (logging flags) */ + int rval=0; /* return value (logging flags) */ int state = 0;/* state bits, accessed thru macros */ xfs_filblks_t temp; /* value for dnew calculations */ xfs_filblks_t temp2; /* value for dnew calculations */ @@ -710,18 +747,18 @@ xfs_bmap_add_extent_delay_real( LEFT_VALID, RIGHT_VALID }; -#define LEFT r[0] -#define RIGHT r[1] -#define PREV r[2] -#define MASK(b) (1 << (b)) -#define MASK2(a,b) (MASK(a) | MASK(b)) -#define MASK3(a,b,c) (MASK2(a,b) | MASK(c)) -#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d)) -#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) -#define STATE_TEST(b) (state & MASK(b)) -#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ +#define LEFT r[0] +#define RIGHT r[1] +#define PREV r[2] +#define MASK(b) (1 << (b)) +#define MASK2(a,b) (MASK(a) | MASK(b)) +#define MASK3(a,b,c) (MASK2(a,b) | MASK(c)) +#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d)) +#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) +#define STATE_TEST(b) (state & MASK(b)) +#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ ((state &= ~MASK(b)), 0)) -#define SWITCH_STATE \ +#define SWITCH_STATE \ (state & MASK4(LEFT_FILLING, RIGHT_FILLING, LEFT_CONTIG, RIGHT_CONTIG)) /* @@ -1218,7 +1255,7 @@ STATIC int /* error */ xfs_bmap_add_extent_unwritten_real( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* extent number to update/insert */ - xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ + xfs_btree_cur_t **curp, /* if *curp is null, not a btree */ xfs_bmbt_irec_t *new, /* new data to put in extent list */ int *logflagsp) /* inode logging flags */ { @@ -1231,11 +1268,11 @@ xfs_bmap_add_extent_unwritten_real( #endif int i; /* temp state */ xfs_fileoff_t new_endoff; /* end offset of new entry */ - xfs_exntst_t newext; /* new extent state */ - xfs_exntst_t oldext; /* old extent state */ + xfs_exntst_t newext; /* new extent state */ + xfs_exntst_t oldext; /* old extent state */ xfs_bmbt_irec_t r[3]; /* neighbor extent entries */ /* left is 0, right is 1, prev is 2 */ - int rval=0; /* return value (logging flags) */ + int rval=0; /* return value (logging flags) */ int state = 0;/* state bits, accessed thru macros */ enum { /* bit number definitions for state */ LEFT_CONTIG, RIGHT_CONTIG, @@ -1244,18 +1281,18 @@ xfs_bmap_add_extent_unwritten_real( LEFT_VALID, RIGHT_VALID }; -#define LEFT r[0] -#define RIGHT r[1] -#define PREV r[2] -#define MASK(b) (1 << (b)) -#define MASK2(a,b) (MASK(a) | MASK(b)) -#define MASK3(a,b,c) (MASK2(a,b) | MASK(c)) -#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d)) -#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) -#define STATE_TEST(b) (state & MASK(b)) -#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ +#define LEFT r[0] +#define RIGHT r[1] +#define PREV r[2] +#define MASK(b) (1 << (b)) +#define MASK2(a,b) (MASK(a) | MASK(b)) +#define MASK3(a,b,c) (MASK2(a,b) | MASK(c)) +#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d)) +#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) +#define STATE_TEST(b) (state & MASK(b)) +#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ ((state &= ~MASK(b)), 0)) -#define SWITCH_STATE \ +#define SWITCH_STATE \ (state & MASK4(LEFT_FILLING, RIGHT_FILLING, LEFT_CONTIG, RIGHT_CONTIG)) /* @@ -1748,7 +1785,7 @@ xfs_bmap_add_extent_hole_delay( xfs_filblks_t newlen=0; /* new indirect size */ xfs_filblks_t oldlen=0; /* old indirect size */ xfs_bmbt_irec_t right; /* right neighbor extent entry */ - int state; /* state bits, accessed thru macros */ + int state; /* state bits, accessed thru macros */ xfs_filblks_t temp; /* temp for indirect calculations */ enum { /* bit number definitions for state */ LEFT_CONTIG, RIGHT_CONTIG, @@ -1756,13 +1793,13 @@ xfs_bmap_add_extent_hole_delay( LEFT_VALID, RIGHT_VALID }; -#define MASK(b) (1 << (b)) -#define MASK2(a,b) (MASK(a) | MASK(b)) -#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) -#define STATE_TEST(b) (state & MASK(b)) -#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ +#define MASK(b) (1 << (b)) +#define MASK2(a,b) (MASK(a) | MASK(b)) +#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) +#define STATE_TEST(b) (state & MASK(b)) +#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ ((state &= ~MASK(b)), 0)) -#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG)) +#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG)) base = ip->i_df.if_u1.if_extents; ep = &base[idx]; @@ -1925,13 +1962,13 @@ xfs_bmap_add_extent_hole_real( LEFT_VALID, RIGHT_VALID }; -#define MASK(b) (1 << (b)) -#define MASK2(a,b) (MASK(a) | MASK(b)) -#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) -#define STATE_TEST(b) (state & MASK(b)) -#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ +#define MASK(b) (1 << (b)) +#define MASK2(a,b) (MASK(a) | MASK(b)) +#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b))) +#define STATE_TEST(b) (state & MASK(b)) +#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \ ((state &= ~MASK(b)), 0)) -#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG)) +#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG)) ifp = XFS_IFORK_PTR(ip, whichfork); ASSERT(idx <= ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)); @@ -2122,7 +2159,7 @@ xfs_bmap_alloc( xfs_bmalloca_t *ap) /* bmap alloc argument struct */ { xfs_fsblock_t adjust; /* adjustment to block numbers */ - xfs_alloctype_t atype=0; /* type for allocation routines */ + xfs_alloctype_t atype=0; /* type for allocation routines */ int error; /* error return value */ xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */ xfs_mount_t *mp; /* mount point structure */ @@ -2133,7 +2170,7 @@ xfs_bmap_alloc( xfs_extlen_t ralen=0; /* realtime allocation length */ #endif -#define ISLEGAL(x,y) \ +#define ISLEGAL(x,y) \ (rt ? \ (x) < mp->m_sb.sb_rblocks : \ XFS_FSB_TO_AGNO(mp, x) == XFS_FSB_TO_AGNO(mp, y) && \ @@ -2170,7 +2207,7 @@ xfs_bmap_alloc( orig_end = orig_off + orig_alen; /* * If the file offset is unaligned vs. the extent size - * we need to align it. This will be possible unless + * we need to align it. This will be possible unless * the file was previously written with a kernel that didn't * perform this alignment. */ @@ -2480,7 +2517,7 @@ xfs_bmap_alloc( */ else { xfs_agnumber_t ag; - xfs_alloc_arg_t args; + xfs_alloc_arg_t args; xfs_extlen_t blen; xfs_extlen_t delta; int isaligned; @@ -2768,16 +2805,16 @@ xfs_bmap_del_extent( xfs_inode_t *ip, /* incore inode pointer */ xfs_trans_t *tp, /* current transaction pointer */ xfs_extnum_t idx, /* extent number to update/delete */ - xfs_bmap_free_t *flist, /* list of extents to be freed */ + xfs_bmap_free_t *flist, /* list of extents to be freed */ xfs_btree_cur_t *cur, /* if null, not a btree */ xfs_bmbt_irec_t *del, /* data to remove from extent list */ int *logflagsp, /* inode logging flags */ int whichfork, /* data or attr fork */ int rsvd) /* OK to allocate reserved blocks */ { - xfs_filblks_t da_new; /* new delay-alloc indirect blocks */ - xfs_filblks_t da_old; /* old delay-alloc indirect blocks */ - xfs_fsblock_t del_endblock=0; /* first block past del */ + xfs_filblks_t da_new; /* new delay-alloc indirect blocks */ + xfs_filblks_t da_old; /* old delay-alloc indirect blocks */ + xfs_fsblock_t del_endblock=0; /* first block past del */ xfs_fileoff_t del_endoff; /* first offset past del */ int delay; /* current block is delayed allocated */ int do_fx; /* free extent at end of routine */ @@ -2796,7 +2833,7 @@ xfs_bmap_del_extent( xfs_bmbt_irec_t new; /* new record to be inserted */ /* REFERENCED */ xfs_extnum_t nextents; /* number of extents in list */ - uint qfield; /* quota field to update */ + uint qfield; /* quota field to update */ xfs_filblks_t temp; /* for indirect length calculations */ xfs_filblks_t temp2; /* for indirect length calculations */ @@ -2823,7 +2860,7 @@ xfs_bmap_del_extent( if (!delay) { flags = XFS_ILOG_CORE; /* - * Realtime allocation. Free it and record di_nblocks update. + * Realtime allocation. Free it and record di_nblocks update. */ if (whichfork == XFS_DATA_FORK && (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) { @@ -3092,7 +3129,7 @@ done: */ STATIC void xfs_bmap_del_free( - xfs_bmap_free_t *flist, /* free item list header */ + xfs_bmap_free_t *flist, /* free item list header */ xfs_bmap_free_item_t *prev, /* previous item on list, if any */ xfs_bmap_free_item_t *free) /* list item to be freed */ { @@ -3273,7 +3310,7 @@ xfs_bmap_insert_exlist( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* starting index of new items */ xfs_extnum_t count, /* number of inserted items */ - xfs_bmbt_irec_t *new, /* items to insert */ + xfs_bmbt_irec_t *new, /* items to insert */ int whichfork) /* data or attr fork */ { xfs_bmbt_rec_t *base; /* extent list base */ @@ -3325,7 +3362,7 @@ xfs_bmap_local_to_extents( flags = 0; error = 0; if (ifp->if_bytes) { - xfs_alloc_arg_t args; /* allocation arguments */ + xfs_alloc_arg_t args; /* allocation arguments */ xfs_buf_t *bp; /* buffer for extent list block */ xfs_bmbt_rec_t *ep; /* extent list pointer */ @@ -3388,11 +3425,11 @@ xfs_bmap_do_search_extents( xfs_fileoff_t bno, /* block number searched for */ int *eofp, /* out: end of file found */ xfs_extnum_t *lastxp, /* out: last extent index */ - xfs_bmbt_irec_t *gotp, /* out: extent entry found */ - xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ + xfs_bmbt_irec_t *gotp, /* out: extent entry found */ + xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ { xfs_bmbt_rec_t *ep; /* extent list entry pointer */ - xfs_bmbt_irec_t got; /* extent list entry, decoded */ + xfs_bmbt_irec_t got; /* extent list entry, decoded */ int high; /* high index of binary search */ int low; /* low index of binary search */ @@ -3480,20 +3517,20 @@ xfs_bmap_do_search_extents( * Else, *lastxp will be set to the index of the found * entry; *gotp will contain the entry. */ -STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ +STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ xfs_bmap_search_extents( - xfs_inode_t *ip, /* incore inode pointer */ - xfs_fileoff_t bno, /* block number searched for */ - int whichfork, /* data or attr fork */ - int *eofp, /* out: end of file found */ - xfs_extnum_t *lastxp, /* out: last extent index */ - xfs_bmbt_irec_t *gotp, /* out: extent entry found */ - xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ + xfs_inode_t *ip, /* incore inode pointer */ + xfs_fileoff_t bno, /* block number searched for */ + int whichfork, /* data or attr fork */ + int *eofp, /* out: end of file found */ + xfs_extnum_t *lastxp, /* out: last extent index */ + xfs_bmbt_irec_t *gotp, /* out: extent entry found */ + xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ { xfs_ifork_t *ifp; /* inode fork pointer */ - xfs_bmbt_rec_t *base; /* base of extent list */ - xfs_extnum_t lastx; /* last extent index used */ - xfs_extnum_t nextents; /* extent list size */ + xfs_bmbt_rec_t *base; /* base of extent list */ + xfs_extnum_t lastx; /* last extent index used */ + xfs_extnum_t nextents; /* extent list size */ XFS_STATS_INC(xfsstats.xs_look_exlist); ifp = XFS_IFORK_PTR(ip, whichfork); @@ -3599,8 +3636,8 @@ xfs_bmap_trace_insert( xfs_inode_t *ip, /* incore inode pointer */ xfs_extnum_t idx, /* index of entry(entries) inserted */ xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */ - xfs_bmbt_irec_t *r1, /* inserted record 1 */ - xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ + xfs_bmbt_irec_t *r1, /* inserted record 1 */ + xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ int whichfork) /* data or attr fork */ { xfs_bmbt_rec_t tr1; /* compressed record 1 */ @@ -3895,7 +3932,7 @@ xfs_bmap_add_free( /* * Compute and fill in the value of the maximum depth of a bmap btree - * in this filesystem. Done once, during mount. + * in this filesystem. Done once, during mount. */ void xfs_bmap_compute_maxlevels( @@ -3936,7 +3973,7 @@ xfs_bmap_compute_maxlevels( /* * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi * caller. Frees all the extents that need freeing, which must be done - * last due to locking considerations. We never free any extents in + * last due to locking considerations. We never free any extents in * the first transaction. This is to allow the caller to make the first * transaction a synchronous one so that the pointers to the data being * broken in this transaction will be permanent before the data is actually @@ -4026,7 +4063,7 @@ xfs_bmap_finish( */ void xfs_bmap_cancel( - xfs_bmap_free_t *flist) /* list of bmap_free_items */ + xfs_bmap_free_t *flist) /* list of bmap_free_items */ { xfs_bmap_free_item_t *free; /* free list item */ xfs_bmap_free_item_t *next; @@ -4051,7 +4088,7 @@ xfs_bmap_check_swappable( xfs_bmbt_rec_t *base; /* base of extent array */ xfs_bmbt_rec_t *ep; /* pointer to an extent entry */ xfs_fileoff_t end_fsb; /* last block of file within size */ - xfs_bmbt_irec_t ext; /* extent list entry, decoded */ + xfs_bmbt_irec_t ext; /* extent list entry, decoded */ xfs_ifork_t *ifp; /* inode fork pointer */ xfs_fileoff_t lastaddr; /* last block number seen */ xfs_extnum_t nextents; /* number of extent entries */ @@ -4173,10 +4210,10 @@ xfs_bmap_last_before( int eof; /* hit end of file */ xfs_bmbt_rec_t *ep; /* pointer to last extent */ int error; /* error return value */ - xfs_bmbt_irec_t got; /* current extent value */ + xfs_bmbt_irec_t got; /* current extent value */ xfs_ifork_t *ifp; /* inode fork pointer */ xfs_extnum_t lastx; /* last extent used */ - xfs_bmbt_irec_t prev; /* previous extent value */ + xfs_bmbt_irec_t prev; /* previous extent value */ if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && @@ -4260,7 +4297,7 @@ xfs_bmap_one_block( xfs_bmbt_rec_t *ep; /* ptr to fork's extent */ xfs_ifork_t *ifp; /* inode fork pointer */ int rval; /* return value */ - xfs_bmbt_irec_t s; /* internal version of extent */ + xfs_bmbt_irec_t s; /* internal version of extent */ #ifndef DEBUG if (whichfork == XFS_DATA_FORK) @@ -4292,7 +4329,7 @@ xfs_bmap_read_extents( xfs_inode_t *ip, /* incore inode */ int whichfork) /* data or attr fork */ { - xfs_bmbt_block_t *block; /* current btree block */ + xfs_bmbt_block_t *block; /* current btree block */ xfs_fsblock_t bno; /* block # of "block" */ xfs_buf_t *bp; /* buffer for "block" */ int error; /* error return value */ @@ -4442,7 +4479,7 @@ xfs_bmap_trace_exlist( xfs_bmbt_rec_t *ep; /* current entry in extent list */ xfs_extnum_t idx; /* extent list entry number */ xfs_ifork_t *ifp; /* inode fork pointer */ - xfs_bmbt_irec_t s; /* extent list record */ + xfs_bmbt_irec_t s; /* extent list record */ ifp = XFS_IFORK_PTR(ip, whichfork); ASSERT(cnt == ifp->if_bytes / (uint)sizeof(*base)); @@ -4523,23 +4560,23 @@ xfs_bmapi( xfs_fsblock_t *firstblock, /* first allocated block controls a.g. for allocs */ xfs_extlen_t total, /* total blocks needed */ - xfs_bmbt_irec_t *mval, /* output: map values */ + xfs_bmbt_irec_t *mval, /* output: map values */ 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_fsblock_t abno; /* allocated block number */ xfs_extlen_t alen; /* allocated extent length */ xfs_fileoff_t aoff; /* allocated file offset */ xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */ char contig; /* allocation must be one extent */ - xfs_btree_cur_t *cur; /* bmap btree cursor */ + xfs_btree_cur_t *cur; /* bmap btree cursor */ char delay; /* this request is for delayed alloc */ xfs_fileoff_t end; /* end of mapped file region */ int eof; /* we've hit the end of extent list */ xfs_bmbt_rec_t *ep; /* extent list entry pointer */ int error; /* error return */ char exact; /* don't do all of wasdelayed extent */ - xfs_bmbt_irec_t got; /* current extent list record */ + xfs_bmbt_irec_t got; /* current extent list record */ xfs_ifork_t *ifp; /* inode fork pointer */ xfs_extlen_t indlen; /* indirect blocks length */ char inhole; /* current location is hole in file */ @@ -4552,7 +4589,7 @@ xfs_bmapi( int nallocs; /* number of extents alloc\'d */ xfs_extnum_t nextents; /* number of extents in file */ xfs_fileoff_t obno; /* old block number (offset) */ - xfs_bmbt_irec_t prev; /* previous extent list record */ + xfs_bmbt_irec_t prev; /* previous extent list record */ char stateless; /* ignore state flag set */ int tmp_logflags; /* temp flags holder */ char trim; /* output trimmed to match range */ @@ -4565,7 +4602,7 @@ xfs_bmapi( xfs_fileoff_t orig_bno; /* original block number value */ int orig_flags; /* original flags arg value */ xfs_filblks_t orig_len; /* original value of len arg */ - xfs_bmbt_irec_t *orig_mval; /* original value of mval */ + xfs_bmbt_irec_t *orig_mval; /* original value of mval */ int orig_nmap; /* original value of *nmap */ orig_bno = bno; @@ -5064,10 +5101,10 @@ xfs_bmapi_single( { int eof; /* we've hit the end of extent list */ int error; /* error return */ - xfs_bmbt_irec_t got; /* current extent list record */ + xfs_bmbt_irec_t got; /* current extent list record */ xfs_ifork_t *ifp; /* inode fork pointer */ xfs_extnum_t lastx; /* last useful extent number */ - xfs_bmbt_irec_t prev; /* previous extent list record */ + xfs_bmbt_irec_t prev; /* previous extent list record */ ifp = XFS_IFORK_PTR(ip, whichfork); if (unlikely( @@ -5103,7 +5140,7 @@ xfs_bmapi_single( /* * Unmap (remove) blocks from a file. * If nexts is nonzero then the number of extents to remove is limited to - * that value. If not all extents in the block range can be removed then + * that value. If not all extents in the block range can be removed then * *done is set. */ int /* error */ @@ -5529,7 +5566,7 @@ xfs_getbmap( ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) return XFS_ERROR(EINVAL); } else if (unlikely( - ip->i_d.di_aformat != 0 && + ip->i_d.di_aformat != 0 && ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS)) { XFS_ERROR_REPORT("xfs_getbmap", XFS_ERRLEVEL_LOW, ip->i_mount); @@ -5627,7 +5664,7 @@ xfs_getbmap( */ goto unlock_and_return; } else { - out.bmv_block = + out.bmv_block = (map[i].br_startblock == HOLESTARTBLOCK) ? -1 : XFS_FSB_TO_DB(ip, map[i].br_startblock); @@ -5681,15 +5718,15 @@ unlock_and_return: int /* error */ xfs_bmap_isaeof( xfs_inode_t *ip, /* incore inode pointer */ - xfs_fileoff_t off, /* file offset in fsblocks */ - int whichfork, /* data or attribute fork */ + xfs_fileoff_t off, /* file offset in fsblocks */ + int whichfork, /* data or attribute fork */ char *aeof) /* return value */ { int error; /* error return value */ xfs_ifork_t *ifp; /* inode fork pointer */ xfs_bmbt_rec_t *lastrec; /* extent list entry pointer */ xfs_extnum_t nextents; /* size of extent list */ - xfs_bmbt_irec_t s; /* expanded extent list entry */ + xfs_bmbt_irec_t s; /* expanded extent list entry */ ASSERT(whichfork == XFS_DATA_FORK); ifp = XFS_IFORK_PTR(ip, whichfork); @@ -5782,7 +5819,7 @@ xfs_bmap_check_extents( STATIC xfs_buf_t * xfs_bmap_get_bp( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_fsblock_t bno) { int i; @@ -5802,7 +5839,7 @@ xfs_bmap_get_bp( bp = NULL; if (!bp) { /* Chase down all the log items to see if the bp is there */ - xfs_log_item_chunk_t *licp; + xfs_log_item_chunk_t *licp; xfs_trans_t *tp; tp = cur->bc_tp; @@ -5843,7 +5880,7 @@ xfs_bmap_get_bp( void xfs_check_block( - xfs_bmbt_block_t *block, + xfs_bmbt_block_t *block, xfs_mount_t *mp, int root, short sz) @@ -5910,7 +5947,7 @@ xfs_bmap_check_leaf_extents( xfs_inode_t *ip, /* incore inode pointer */ int whichfork) /* data or attr fork */ { - xfs_bmbt_block_t *block; /* current btree block */ + xfs_bmbt_block_t *block; /* current btree block */ xfs_fsblock_t bno; /* block # of "block" */ xfs_buf_t *bp; /* buffer for "block" */ int error; /* error return value */ @@ -6072,7 +6109,7 @@ xfs_bmap_count_blocks( int whichfork, /* data or attr fork */ int *count) /* out: count of blocks */ { - xfs_bmbt_block_t *block; /* current btree block */ + xfs_bmbt_block_t *block; /* current btree block */ xfs_fsblock_t bno; /* block # of "block" */ xfs_ifork_t *ifp; /* fork structure */ int level; /* btree level, for checking */ @@ -6118,21 +6155,21 @@ xfs_bmap_count_blocks( * Recursively walks each level of a btree * to count total fsblocks is use. */ -int /* error */ +int /* error */ xfs_bmap_count_tree( - xfs_mount_t *mp, /* file system mount point */ - xfs_trans_t *tp, /* transaction pointer */ - xfs_fsblock_t blockno, /* file system block number */ - int levelin, /* level in btree */ + xfs_mount_t *mp, /* file system mount point */ + xfs_trans_t *tp, /* transaction pointer */ + xfs_fsblock_t blockno, /* file system block number */ + int levelin, /* level in btree */ int *count) /* Count of blocks */ { int error; xfs_buf_t *bp, *nbp; int level = levelin; - xfs_bmbt_ptr_t *pp; - xfs_fsblock_t bno = blockno; + xfs_bmbt_ptr_t *pp; + xfs_fsblock_t bno = blockno; xfs_fsblock_t nextbno; - xfs_bmbt_block_t *block, *nextblock; + xfs_bmbt_block_t *block, *nextblock; int numrecs; xfs_bmbt_rec_t *frp; @@ -6208,4 +6245,3 @@ xfs_bmap_count_leaves( *count += xfs_bmbt_disk_get_blockcount(frp); return 0; } - diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h index a41ea99c034b..5cc5bfe82411 100644 --- a/fs/xfs/xfs_bmap.h +++ b/fs/xfs/xfs_bmap.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_BMAP_H__ -#define __XFS_BMAP_H__ +#define __XFS_BMAP_H__ struct getbmap; struct xfs_bmbt_irec; @@ -52,19 +52,19 @@ typedef struct xfs_bmap_free_item /* * Header for free extent list. */ -typedef struct xfs_bmap_free +typedef struct xfs_bmap_free { xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extents */ int xbf_count; /* count of items on list */ int xbf_low; /* kludge: alloc in low mode */ } xfs_bmap_free_t; -#define XFS_BMAP_MAX_NMAP 4 +#define XFS_BMAP_MAX_NMAP 4 /* * Flags for xfs_bmapi */ -#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */ +#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */ #define XFS_BMAPI_DELAY 0x002 /* delayed write operation */ #define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */ #define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */ @@ -72,37 +72,37 @@ typedef struct xfs_bmap_free #define XFS_BMAPI_ATTRFORK 0x020 /* use attribute fork not data */ #define XFS_BMAPI_ASYNC 0x040 /* bunmapi xactions can be async */ #define XFS_BMAPI_RSVBLOCKS 0x080 /* OK to alloc. reserved data blocks */ -#define XFS_BMAPI_PREALLOC 0x100 /* preallocation op: unwritten space */ -#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */ +#define XFS_BMAPI_PREALLOC 0x100 /* preallocation op: unwritten space */ +#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */ /* combine contig. space */ -#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */ +#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAPI_AFLAG) int xfs_bmapi_aflag(int w); -#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w) +#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w) #else -#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0) +#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0) #endif /* * Special values for xfs_bmbt_irec_t br_startblock field. */ -#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) -#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) +#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) +#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) /* * Trace operations for bmap extent tracing */ -#define XFS_BMAP_KTRACE_DELETE 1 -#define XFS_BMAP_KTRACE_INSERT 2 -#define XFS_BMAP_KTRACE_PRE_UP 3 -#define XFS_BMAP_KTRACE_POST_UP 4 +#define XFS_BMAP_KTRACE_DELETE 1 +#define XFS_BMAP_KTRACE_INSERT 2 +#define XFS_BMAP_KTRACE_PRE_UP 3 +#define XFS_BMAP_KTRACE_POST_UP 4 -#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */ -#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */ +#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */ +#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */ #if defined(XFS_ALL_TRACE) -#define XFS_BMAP_TRACE +#define XFS_BMAP_TRACE #endif #if !defined(DEBUG) @@ -112,9 +112,9 @@ int xfs_bmapi_aflag(int w); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT) void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp); -#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp) +#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp) #else -#define XFS_BMAP_INIT(flp,fbp) \ +#define XFS_BMAP_INIT(flp,fbp) \ ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK) #endif @@ -128,17 +128,17 @@ typedef struct xfs_bmalloca { xfs_fileoff_t off; /* offset in file filling in */ struct xfs_trans *tp; /* transaction pointer */ struct xfs_inode *ip; /* incore inode pointer */ - struct xfs_bmbt_irec *prevp; /* extent before the new one */ + struct xfs_bmbt_irec *prevp; /* extent before the new one */ struct xfs_bmbt_irec *gotp; /* extent after, or delayed */ xfs_extlen_t alen; /* i/o length asked/allocated */ xfs_extlen_t total; /* total blocks needed for xaction */ - xfs_extlen_t minlen; /* mininum allocation size (blocks) */ + xfs_extlen_t minlen; /* mininum allocation size (blocks) */ xfs_extlen_t minleft; /* amount must be left after alloc */ char eof; /* set if allocating past last extent */ - char wasdel; /* replacing a delayed allocation */ + char wasdel; /* replacing a delayed allocation */ char userdata;/* set if is user data */ char low; /* low on space, using seq'l ags */ - char aeof; /* allocated space at eof */ + char aeof; /* allocated space at eof */ } xfs_bmalloca_t; #ifdef __KERNEL__ @@ -179,7 +179,7 @@ xfs_bmap_check_swappable( /* * Compute and fill in the value of the maximum depth of a bmap btree - * in this filesystem. Done once, during mount. + * in this filesystem. Done once, during mount. */ void xfs_bmap_compute_maxlevels( @@ -271,7 +271,7 @@ xfs_bmap_trace_exlist( xfs_extnum_t cnt, /* count of entries in list */ int whichfork); /* data or attr fork */ #else -#define xfs_bmap_trace_exlist(f,ip,c,w) +#define xfs_bmap_trace_exlist(f,ip,c,w) #endif /* @@ -319,7 +319,7 @@ xfs_bmapi_single( /* * Unmap (remove) blocks from a file. * If nexts is nonzero then the number of extents to remove is limited to - * that value. If not all extents in the block range can be removed then + * that value. If not all extents in the block range can be removed then * *done is set. */ int /* error */ @@ -364,10 +364,10 @@ xfs_bmap_isaeof( */ int xfs_bmap_eof( - struct xfs_inode *ip, - xfs_fileoff_t endoff, - int whichfork, - int *eof); + struct xfs_inode *ip, + xfs_fileoff_t endoff, + int whichfork, + int *eof); /* * Count fsblocks of the given fork. diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index 43a0680371f4..48c539c6fe28 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,36 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_itable.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_alloc.h" +#include "xfs_bit.h" +#include "xfs_bmap.h" +#include "xfs_error.h" +#include "xfs_quota.h" #ifdef DEBUG ktrace_t *xfs_bmbt_trace_buf; @@ -59,7 +88,7 @@ STATIC int xfs_bmbt_updkey(xfs_btree_cur_t *, xfs_bmbt_key_t *, int); STATIC void xfs_bmbt_trace_enter( char *func, - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, char *s, int type, int line, @@ -100,7 +129,7 @@ xfs_bmbt_trace_enter( STATIC void xfs_bmbt_trace_argbi( char *func, - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_buf_t *b, int i, int line) @@ -117,7 +146,7 @@ xfs_bmbt_trace_argbi( STATIC void xfs_bmbt_trace_argbii( char *func, - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_buf_t *b, int i0, int i1, @@ -155,7 +184,7 @@ xfs_bmbt_trace_argfffi( STATIC void xfs_bmbt_trace_argi( char *func, - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, int i, int line) { @@ -243,7 +272,7 @@ xfs_bmbt_trace_argik( STATIC void xfs_bmbt_trace_cursor( char *func, - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, char *s, int line) { @@ -260,21 +289,21 @@ xfs_bmbt_trace_cursor( (cur->bc_ptrs[2] << 16) | cur->bc_ptrs[3]); } -#define XFS_BMBT_TRACE_ARGBI(c,b,i) \ +#define XFS_BMBT_TRACE_ARGBI(c,b,i) \ xfs_bmbt_trace_argbi(fname, c, b, i, __LINE__) -#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) \ +#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) \ xfs_bmbt_trace_argbii(fname, c, b, i, j, __LINE__) -#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) \ +#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) \ xfs_bmbt_trace_argfffi(fname, c, o, b, i, j, __LINE__) -#define XFS_BMBT_TRACE_ARGI(c,i) \ +#define XFS_BMBT_TRACE_ARGI(c,i) \ xfs_bmbt_trace_argi(fname, c, i, __LINE__) -#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) \ +#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) \ xfs_bmbt_trace_argifk(fname, c, i, f, k, __LINE__) -#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) \ +#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) \ xfs_bmbt_trace_argifr(fname, c, i, f, r, __LINE__) -#define XFS_BMBT_TRACE_ARGIK(c,i,k) \ +#define XFS_BMBT_TRACE_ARGIK(c,i,k) \ xfs_bmbt_trace_argik(fname, c, i, k, __LINE__) -#define XFS_BMBT_TRACE_CURSOR(c,s) \ +#define XFS_BMBT_TRACE_CURSOR(c,s) \ xfs_bmbt_trace_cursor(fname, c, s, __LINE__) static char ARGS[] = "args"; static char ENTRY[] = "entry"; @@ -282,14 +311,14 @@ static char ERROR[] = "error"; #undef EXIT static char EXIT[] = "exit"; #else -#define XFS_BMBT_TRACE_ARGBI(c,b,i) -#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) -#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) -#define XFS_BMBT_TRACE_ARGI(c,i) -#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) -#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) -#define XFS_BMBT_TRACE_ARGIK(c,i,k) -#define XFS_BMBT_TRACE_CURSOR(c,s) +#define XFS_BMBT_TRACE_ARGBI(c,b,i) +#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) +#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) +#define XFS_BMBT_TRACE_ARGI(c,i) +#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) +#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) +#define XFS_BMBT_TRACE_ARGIK(c,i,k) +#define XFS_BMBT_TRACE_CURSOR(c,s) #endif /* XFS_BMBT_TRACE */ @@ -1002,7 +1031,7 @@ xfs_bmbt_killroot( */ STATIC void xfs_bmbt_log_keys( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_buf_t *bp, int kfirst, int klast) @@ -1041,7 +1070,7 @@ xfs_bmbt_log_keys( */ STATIC void xfs_bmbt_log_ptrs( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_buf_t *bp, int pfirst, int plast) @@ -1818,7 +1847,7 @@ xfs_bmbt_decrement( */ int /* error */ xfs_bmbt_delete( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, int *stat) /* success/failure */ { int error; /* error return value */ @@ -2048,7 +2077,7 @@ xfs_bmbt_disk_get_startoff( xfs_exntst_t xfs_bmbt_disk_get_state( - xfs_bmbt_rec_t *r) + xfs_bmbt_rec_t *r) { int ext_flag; @@ -2148,7 +2177,7 @@ xfs_bmbt_increment( */ int /* error */ xfs_bmbt_insert( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, int *stat) /* success/failure */ { int error; /* error return value */ @@ -2158,9 +2187,9 @@ xfs_bmbt_insert( int i; int level; xfs_fsblock_t nbno; - xfs_btree_cur_t *ncur; + xfs_btree_cur_t *ncur; xfs_bmbt_rec_t nrec; - xfs_btree_cur_t *pcur; + xfs_btree_cur_t *pcur; XFS_BMBT_TRACE_CURSOR(cur, ENTRY); level = 0; @@ -2274,7 +2303,7 @@ xfs_bmbt_log_recs( int /* error */ xfs_bmbt_lookup_eq( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_fileoff_t off, xfs_fsblock_t bno, xfs_filblks_t len, @@ -2288,7 +2317,7 @@ xfs_bmbt_lookup_eq( int /* error */ xfs_bmbt_lookup_ge( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_fileoff_t off, xfs_fsblock_t bno, xfs_filblks_t len, @@ -2302,7 +2331,7 @@ xfs_bmbt_lookup_ge( int /* error */ xfs_bmbt_lookup_le( - xfs_btree_cur_t *cur, + xfs_btree_cur_t *cur, xfs_fileoff_t off, xfs_fsblock_t bno, xfs_filblks_t len, @@ -2434,7 +2463,7 @@ xfs_bmbt_newroot( void xfs_bmbt_set_all( xfs_bmbt_rec_t *r, - xfs_bmbt_irec_t *s) + xfs_bmbt_irec_t *s) { int extent_flag; diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index 595ecc68e795..099e26aae2a1 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,31 @@ * This file contains common code for the space manager's btree implementations. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bit.h" +#include "xfs_error.h" /* * Cursor allocation zone. @@ -71,7 +95,7 @@ xfs_btree_maxrecs( STATIC int /* number of records fitting in block */ xfs_btree_maxrecs( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_block_t *block) /* generic btree block pointer */ + xfs_btree_block_t *block) /* generic btree block pointer */ { switch (cur->bc_btnum) { case XFS_BTNUM_BNO: @@ -98,7 +122,7 @@ xfs_btree_maxrecs( void xfs_btree_check_block( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_block_t *block, /* generic btree block pointer */ + xfs_btree_block_t *block, /* generic btree block pointer */ int level, /* level of the btree block */ xfs_buf_t *bp) /* buffer containing block, if any */ { @@ -121,8 +145,8 @@ xfs_btree_check_key( { switch (btnum) { case XFS_BTNUM_BNO: { - xfs_alloc_key_t *k1; - xfs_alloc_key_t *k2; + xfs_alloc_key_t *k1; + xfs_alloc_key_t *k2; k1 = ak1; k2 = ak2; @@ -130,8 +154,8 @@ xfs_btree_check_key( break; } case XFS_BTNUM_CNT: { - xfs_alloc_key_t *k1; - xfs_alloc_key_t *k2; + xfs_alloc_key_t *k1; + xfs_alloc_key_t *k2; k1 = ak1; k2 = ak2; @@ -150,8 +174,8 @@ xfs_btree_check_key( break; } case XFS_BTNUM_INO: { - xfs_inobt_key_t *k1; - xfs_inobt_key_t *k2; + xfs_inobt_key_t *k1; + xfs_inobt_key_t *k2; k1 = ak1; k2 = ak2; @@ -171,7 +195,7 @@ xfs_btree_check_key( int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_lblock( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_lblock_t *block, /* btree long form block pointer */ + xfs_btree_lblock_t *block, /* btree long form block pointer */ int level, /* level of the btree block */ xfs_buf_t *bp) /* buffer for block, if any */ { @@ -206,7 +230,7 @@ xfs_btree_check_lblock( */ int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_lptr( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_dfsbno_t ptr, /* btree block disk address */ int level) /* btree block level */ { @@ -232,8 +256,8 @@ xfs_btree_check_rec( { switch (btnum) { case XFS_BTNUM_BNO: { - xfs_alloc_rec_t *r1; - xfs_alloc_rec_t *r2; + xfs_alloc_rec_t *r1; + xfs_alloc_rec_t *r2; r1 = ar1; r2 = ar2; @@ -242,8 +266,8 @@ xfs_btree_check_rec( break; } case XFS_BTNUM_CNT: { - xfs_alloc_rec_t *r1; - xfs_alloc_rec_t *r2; + xfs_alloc_rec_t *r1; + xfs_alloc_rec_t *r2; r1 = ar1; r2 = ar2; @@ -264,8 +288,8 @@ xfs_btree_check_rec( break; } case XFS_BTNUM_INO: { - xfs_inobt_rec_t *r1; - xfs_inobt_rec_t *r2; + xfs_inobt_rec_t *r1; + xfs_inobt_rec_t *r2; r1 = ar1; r2 = ar2; @@ -286,13 +310,13 @@ xfs_btree_check_rec( int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_sblock( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_sblock_t *block, /* btree short form block pointer */ + xfs_btree_sblock_t *block, /* btree short form block pointer */ int level, /* level of the btree block */ xfs_buf_t *bp) /* buffer containing block */ { xfs_buf_t *agbp; /* buffer for ag. freespace struct */ xfs_agf_t *agf; /* ag. freespace structure */ - xfs_agblock_t agflen; /* native ag. freespace length */ + xfs_agblock_t agflen; /* native ag. freespace length */ int sblock_ok; /* block passes checks */ agbp = cur->bc_private.a.agbp; @@ -326,7 +350,7 @@ xfs_btree_check_sblock( */ int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_sptr( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agblock_t ptr, /* btree block disk address */ int level) /* btree block level */ { @@ -347,7 +371,7 @@ xfs_btree_check_sptr( */ void xfs_btree_del_cursor( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ int error) /* del because of error */ { int i; /* btree level */ @@ -386,14 +410,14 @@ xfs_btree_del_cursor( */ int /* error */ xfs_btree_dup_cursor( - xfs_btree_cur_t *cur, /* input cursor */ - xfs_btree_cur_t **ncur) /* output cursor */ + xfs_btree_cur_t *cur, /* input cursor */ + xfs_btree_cur_t **ncur) /* output cursor */ { xfs_buf_t *bp; /* btree block's buffer pointer */ int error; /* error return value */ int i; /* level number of btree block */ xfs_mount_t *mp; /* mount structure for filesystem */ - xfs_btree_cur_t *new; /* new cursor value */ + xfs_btree_cur_t *new; /* new cursor value */ xfs_trans_t *tp; /* transaction pointer, can be NULL */ tp = cur->bc_tp; @@ -449,7 +473,7 @@ xfs_btree_firstrec( xfs_btree_cur_t *cur, /* btree cursor */ int level) /* level to change */ { - xfs_btree_block_t *block; /* generic btree block pointer */ + xfs_btree_block_t *block; /* generic btree block pointer */ xfs_buf_t *bp; /* buffer containing block */ /* @@ -479,7 +503,7 @@ xfs_btree_get_block( int level, /* level in btree */ xfs_buf_t **bpp) /* buffer containing the block */ { - xfs_btree_block_t *block; /* return value */ + xfs_btree_block_t *block; /* return value */ xfs_buf_t *bp; /* return buffer */ xfs_ifork_t *ifp; /* inode fork pointer */ int whichfork; /* data or attr fork */ @@ -561,7 +585,7 @@ xfs_btree_init_cursor( { xfs_agf_t *agf; /* (A) allocation group freespace */ xfs_agi_t *agi; /* (I) allocation group inodespace */ - xfs_btree_cur_t *cur; /* return value */ + xfs_btree_cur_t *cur; /* return value */ xfs_ifork_t *ifp; /* (I) inode fork pointer */ int nlevels=0; /* number of levels in the btree */ @@ -643,7 +667,7 @@ xfs_btree_islastblock( xfs_btree_cur_t *cur, /* btree cursor */ int level) /* level to check */ { - xfs_btree_block_t *block; /* generic btree block pointer */ + xfs_btree_block_t *block; /* generic btree block pointer */ xfs_buf_t *bp; /* buffer containing block */ block = xfs_btree_get_block(cur, level, &bp); @@ -656,14 +680,14 @@ xfs_btree_islastblock( /* * Change the cursor to point to the last record in the current block - * at the given level. Other levels are unaffected. + * at the given level. Other levels are unaffected. */ int /* success=1, failure=0 */ xfs_btree_lastrec( xfs_btree_cur_t *cur, /* btree cursor */ int level) /* level to change */ { - xfs_btree_block_t *block; /* generic btree block pointer */ + xfs_btree_block_t *block; /* generic btree block pointer */ xfs_buf_t *bp; /* buffer containing block */ /* diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h index 87067d647b6a..93872bba41f5 100644 --- a/fs/xfs/xfs_btree.h +++ b/fs/xfs/xfs_btree.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_BTREE_H__ -#define __XFS_BTREE_H__ +#define __XFS_BTREE_H__ struct xfs_buf; struct xfs_bmap_free; @@ -41,14 +41,14 @@ struct xfs_trans; /* * This nonsense is to make -wlint happy. */ -#define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi) -#define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi) -#define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi) +#define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi) +#define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi) +#define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi) -#define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi) -#define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi) -#define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi) -#define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) +#define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi) +#define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi) +#define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi) +#define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) /* * Short form header: space allocation btrees. @@ -86,7 +86,7 @@ typedef struct xfs_btree_hdr typedef struct xfs_btree_block { - xfs_btree_hdr_t bb_h; /* header */ + xfs_btree_hdr_t bb_h; /* header */ union { struct { xfs_agblock_t bb_leftsib; @@ -102,28 +102,28 @@ typedef struct xfs_btree_block /* * For logging record fields. */ -#define XFS_BB_MAGIC 0x01 -#define XFS_BB_LEVEL 0x02 -#define XFS_BB_NUMRECS 0x04 -#define XFS_BB_LEFTSIB 0x08 -#define XFS_BB_RIGHTSIB 0x10 -#define XFS_BB_NUM_BITS 5 -#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) +#define XFS_BB_MAGIC 0x01 +#define XFS_BB_LEVEL 0x02 +#define XFS_BB_NUMRECS 0x04 +#define XFS_BB_LEFTSIB 0x08 +#define XFS_BB_RIGHTSIB 0x10 +#define XFS_BB_NUM_BITS 5 +#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) /* * Boolean to select which form of xfs_btree_block_t.bb_u to use. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BTREE_LONG_PTRS) int xfs_btree_long_ptrs(xfs_btnum_t btnum); -#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) +#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) #else -#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) +#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) #endif /* * Magic numbers for btree blocks. */ -extern const __uint32_t xfs_magics[]; +extern const __uint32_t xfs_magics[]; /* * Maximum and minimum records in a btree block. @@ -131,12 +131,12 @@ extern const __uint32_t xfs_magics[]; * The divisor below is equivalent to lf ? (e1) : (e2) but that produces * compiler warnings. */ -#define XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) \ +#define XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) \ ((int)(((bsz) - (uint)sizeof(t ## _block_t)) / \ (((lf) * (uint)sizeof(t ## _rec_t)) + \ ((1 - (lf)) * \ ((uint)sizeof(t ## _key_t) + (uint)sizeof(t ## _ptr_t)))))) -#define XFS_BTREE_BLOCK_MINRECS(bsz,t,lf) \ +#define XFS_BTREE_BLOCK_MINRECS(bsz,t,lf) \ (XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) / 2) /* @@ -144,17 +144,17 @@ extern const __uint32_t xfs_magics[]; * Given block size, type prefix, block pointer, and index of requested entry * (first entry numbered 1). */ -#define XFS_BTREE_REC_ADDR(bsz,t,bb,i,mxr) \ +#define XFS_BTREE_REC_ADDR(bsz,t,bb,i,mxr) \ ((t ## _rec_t *)((char *)(bb) + sizeof(t ## _block_t) + \ ((i) - 1) * sizeof(t ## _rec_t))) -#define XFS_BTREE_KEY_ADDR(bsz,t,bb,i,mxr) \ +#define XFS_BTREE_KEY_ADDR(bsz,t,bb,i,mxr) \ ((t ## _key_t *)((char *)(bb) + sizeof(t ## _block_t) + \ ((i) - 1) * sizeof(t ## _key_t))) -#define XFS_BTREE_PTR_ADDR(bsz,t,bb,i,mxr) \ +#define XFS_BTREE_PTR_ADDR(bsz,t,bb,i,mxr) \ ((t ## _ptr_t *)((char *)(bb) + sizeof(t ## _block_t) + \ (mxr) * sizeof(t ## _key_t) + ((i) - 1) * sizeof(t ## _ptr_t))) -#define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */ +#define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */ /* * Btree cursor structure. @@ -162,8 +162,8 @@ extern const __uint32_t xfs_magics[]; */ typedef struct xfs_btree_cur { - struct xfs_trans *bc_tp; /* transaction we're in, if any */ - struct xfs_mount *bc_mp; /* file system mount struct */ + struct xfs_trans *bc_tp; /* transaction we're in, if any */ + struct xfs_mount *bc_mp; /* file system mount struct */ union { xfs_alloc_rec_t a; xfs_bmbt_irec_t b; @@ -172,8 +172,8 @@ typedef struct xfs_btree_cur struct xfs_buf *bc_bufs[XFS_BTREE_MAXLEVELS]; /* buf ptr per level */ int bc_ptrs[XFS_BTREE_MAXLEVELS]; /* key/record # */ __uint8_t bc_ra[XFS_BTREE_MAXLEVELS]; /* readahead bits */ -#define XFS_BTCUR_LEFTRA 1 /* left sibling has been read-ahead */ -#define XFS_BTCUR_RIGHTRA 2 /* right sibling has been read-ahead */ +#define XFS_BTCUR_LEFTRA 1 /* left sibling has been read-ahead */ +#define XFS_BTCUR_RIGHTRA 2 /* right sibling has been read-ahead */ __uint8_t bc_nlevels; /* number of levels in the tree */ __uint8_t bc_blocklog; /* log2(blocksize) of btree blocks */ xfs_btnum_t bc_btnum; /* identifies which btree type */ @@ -190,7 +190,7 @@ typedef struct xfs_btree_cur short forksize; /* fork's inode space */ char whichfork; /* data or attr fork */ char flags; /* flags */ -#define XFS_BTCUR_BPRV_WASDEL 1 /* was delayed */ +#define XFS_BTCUR_BPRV_WASDEL 1 /* was delayed */ } b; struct { /* needed for INO */ struct xfs_buf *agbp; /* agi buffer pointer */ @@ -199,29 +199,29 @@ typedef struct xfs_btree_cur } bc_private; /* per-btree type data */ } xfs_btree_cur_t; -#define XFS_BTREE_NOERROR 0 -#define XFS_BTREE_ERROR 1 +#define XFS_BTREE_NOERROR 0 +#define XFS_BTREE_ERROR 1 /* * Convert from buffer to btree block header. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BLOCK) xfs_btree_block_t *xfs_buf_to_block(struct xfs_buf *bp); -#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp) +#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp) #else -#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_LBLOCK) xfs_btree_lblock_t *xfs_buf_to_lblock(struct xfs_buf *bp); -#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp) +#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp) #else -#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBLOCK) xfs_btree_sblock_t *xfs_buf_to_sblock(struct xfs_buf *bp); -#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp) +#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp) #else -#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp))) #endif #ifdef __KERNEL__ @@ -233,7 +233,7 @@ xfs_btree_sblock_t *xfs_buf_to_sblock(struct xfs_buf *bp); void xfs_btree_check_block( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_block_t *block, /* generic btree block pointer */ + xfs_btree_block_t *block, /* generic btree block pointer */ int level, /* level of the btree block */ struct xfs_buf *bp); /* buffer containing block, if any */ @@ -255,9 +255,9 @@ xfs_btree_check_rec( void *ar1, /* pointer to left (lower) record */ void *ar2); /* pointer to right (higher) record */ #else -#define xfs_btree_check_block(a,b,c,d) -#define xfs_btree_check_key(a,b,c) -#define xfs_btree_check_rec(a,b,c) +#define xfs_btree_check_block(a,b,c,d) +#define xfs_btree_check_key(a,b,c) +#define xfs_btree_check_rec(a,b,c) #endif /* DEBUG */ /* @@ -266,7 +266,7 @@ xfs_btree_check_rec( int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_lblock( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_lblock_t *block, /* btree long form block pointer */ + xfs_btree_lblock_t *block, /* btree long form block pointer */ int level, /* level of the btree block */ struct xfs_buf *bp); /* buffer containing block, if any */ @@ -277,7 +277,7 @@ int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_lptr( xfs_btree_cur_t *cur, /* btree cursor */ xfs_dfsbno_t ptr, /* btree block disk address */ - int level); /* btree block level */ + int level); /* btree block level */ /* * Checking routine: check that short form block header is ok. @@ -285,7 +285,7 @@ xfs_btree_check_lptr( int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_sblock( xfs_btree_cur_t *cur, /* btree cursor */ - xfs_btree_sblock_t *block, /* btree short form block pointer */ + xfs_btree_sblock_t *block, /* btree short form block pointer */ int level, /* level of the btree block */ struct xfs_buf *bp); /* buffer containing block */ @@ -296,7 +296,7 @@ int /* error (0 or EFSCORRUPTED) */ xfs_btree_check_sptr( xfs_btree_cur_t *cur, /* btree cursor */ xfs_agblock_t ptr, /* btree block disk address */ - int level); /* btree block level */ + int level); /* btree block level */ /* * Delete the btree cursor. @@ -304,7 +304,7 @@ xfs_btree_check_sptr( void xfs_btree_del_cursor( xfs_btree_cur_t *cur, /* btree cursor */ - int error); /* del because of error */ + int error); /* del because of error */ /* * Duplicate the btree cursor. @@ -317,12 +317,12 @@ xfs_btree_dup_cursor( /* * Change the cursor to point to the first record in the current block - * at the given level. Other levels are unaffected. + * at the given level. Other levels are unaffected. */ int /* success=1, failure=0 */ xfs_btree_firstrec( xfs_btree_cur_t *cur, /* btree cursor */ - int level); /* level to change */ + int level); /* level to change */ /* * Retrieve the block pointer from the cursor at the given level. @@ -332,7 +332,7 @@ xfs_btree_block_t * /* generic btree block pointer */ xfs_btree_get_block( xfs_btree_cur_t *cur, /* btree cursor */ int level, /* level in btree */ - struct xfs_buf **bpp); /* buffer containing the block */ + struct xfs_buf **bpp); /* buffer containing the block */ /* * Get a buffer for the block, return it with no data read. @@ -377,16 +377,16 @@ xfs_btree_init_cursor( int /* 1=is last block, 0=not last block */ xfs_btree_islastblock( xfs_btree_cur_t *cur, /* btree cursor */ - int level); /* level to check */ + int level); /* level to check */ /* * Change the cursor to point to the last record in the current block - * at the given level. Other levels are unaffected. + * at the given level. Other levels are unaffected. */ int /* success=1, failure=0 */ xfs_btree_lastrec( xfs_btree_cur_t *cur, /* btree cursor */ - int level); /* level to change */ + int level); /* level to change */ /* * Compute first and last byte offsets for the fields given. @@ -394,11 +394,11 @@ xfs_btree_lastrec( */ void xfs_btree_offsets( - __int64_t fields, /* bitmask of fields */ + __int64_t fields, /* bitmask of fields */ const short *offsets,/* table of field offsets */ int nbits, /* number of bits to inspect */ - int *first, /* output: first byte offset */ - int *last); /* output: last byte offset */ + int *first, /* output: first byte offset */ + int *last); /* output: last byte offset */ /* * Get a buffer for the block, return it read in. @@ -435,7 +435,7 @@ void /* error */ xfs_btree_reada_bufl( struct xfs_mount *mp, /* file system mount point */ xfs_fsblock_t fsbno, /* file system block number */ - xfs_extlen_t count); /* count of filesystem blocks */ + xfs_extlen_t count); /* count of filesystem blocks */ /* * Read-ahead the block, don't wait for it, don't return a buffer. @@ -446,7 +446,7 @@ xfs_btree_reada_bufs( struct xfs_mount *mp, /* file system mount point */ xfs_agnumber_t agno, /* allocation group number */ xfs_agblock_t agbno, /* allocation group block number */ - xfs_extlen_t count); /* count of filesystem blocks */ + xfs_extlen_t count); /* count of filesystem blocks */ /* * Read-ahead btree blocks, at the given level. @@ -489,76 +489,76 @@ xfs_btree_setbuf( */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MIN) xfs_extlen_t xfs_extlen_min(xfs_extlen_t a, xfs_extlen_t b); -#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b) +#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b) #else -#define XFS_EXTLEN_MIN(a,b) \ +#define XFS_EXTLEN_MIN(a,b) \ ((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \ (xfs_extlen_t)(a) : (xfs_extlen_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MAX) xfs_extlen_t xfs_extlen_max(xfs_extlen_t a, xfs_extlen_t b); -#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b) +#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b) #else -#define XFS_EXTLEN_MAX(a,b) \ +#define XFS_EXTLEN_MAX(a,b) \ ((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \ (xfs_extlen_t)(a) : (xfs_extlen_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MIN) xfs_agblock_t xfs_agblock_min(xfs_agblock_t a, xfs_agblock_t b); -#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b) +#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b) #else -#define XFS_AGBLOCK_MIN(a,b) \ +#define XFS_AGBLOCK_MIN(a,b) \ ((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \ (xfs_agblock_t)(a) : (xfs_agblock_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MAX) xfs_agblock_t xfs_agblock_max(xfs_agblock_t a, xfs_agblock_t b); -#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b) +#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b) #else -#define XFS_AGBLOCK_MAX(a,b) \ +#define XFS_AGBLOCK_MAX(a,b) \ ((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \ (xfs_agblock_t)(a) : (xfs_agblock_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MIN) xfs_fileoff_t xfs_fileoff_min(xfs_fileoff_t a, xfs_fileoff_t b); -#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b) +#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b) #else -#define XFS_FILEOFF_MIN(a,b) \ +#define XFS_FILEOFF_MIN(a,b) \ ((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \ (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MAX) xfs_fileoff_t xfs_fileoff_max(xfs_fileoff_t a, xfs_fileoff_t b); -#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b) +#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b) #else -#define XFS_FILEOFF_MAX(a,b) \ +#define XFS_FILEOFF_MAX(a,b) \ ((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \ (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MIN) xfs_filblks_t xfs_filblks_min(xfs_filblks_t a, xfs_filblks_t b); -#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b) +#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b) #else -#define XFS_FILBLKS_MIN(a,b) \ +#define XFS_FILBLKS_MIN(a,b) \ ((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \ (xfs_filblks_t)(a) : (xfs_filblks_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MAX) xfs_filblks_t xfs_filblks_max(xfs_filblks_t a, xfs_filblks_t b); -#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b) +#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b) #else -#define XFS_FILBLKS_MAX(a,b) \ +#define XFS_FILBLKS_MAX(a,b) \ ((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \ (xfs_filblks_t)(a) : (xfs_filblks_t)(b)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_SANITY_CHECK) int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb); -#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb) +#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb) #else -#define XFS_FSB_SANITY_CHECK(mp,fsb) \ +#define XFS_FSB_SANITY_CHECK(mp,fsb) \ (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \ XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks) #endif @@ -566,7 +566,7 @@ int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb); /* * Macros to set EFSCORRUPTED & return/branch. */ -#define XFS_WANT_CORRUPTED_GOTO(x,l) \ +#define XFS_WANT_CORRUPTED_GOTO(x,l) \ { \ int fs_is_ok = (x); \ ASSERT(fs_is_ok); \ @@ -578,7 +578,7 @@ int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb); } \ } -#define XFS_WANT_CORRUPTED_RETURN(x) \ +#define XFS_WANT_CORRUPTED_RETURN(x) \ { \ int fs_is_ok = (x); \ ASSERT(fs_is_ok); \ diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 9d9a12847d99..6fb227a9fa3f 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -37,17 +37,32 @@ * transaction routines. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_buf_item.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_rw.h" +#include "xfs_bit.h" +#include "xfs_error.h" -#define ROUNDUPNBWORD(x) (((x) + (NBWORD - 1)) & ~(NBWORD - 1)) + +#define ROUNDUPNBWORD(x) (((x) + (NBWORD - 1)) & ~(NBWORD - 1)) kmem_zone_t *xfs_buf_item_zone; #ifdef XFS_TRANS_DEBUG /* * This function uses an alternate strategy for tracking the bytes - * that the user requests to be logged. This can then be used + * that the user requests to be logged. This can then be used * in conjunction with the bli_orig array in the buf log item to * catch bugs in our callers' code. * @@ -86,7 +101,7 @@ xfs_buf_item_log_debug( /* * This function is called when we flush something into a buffer without - * logging it. This happens for things like inodes which are logged + * logging it. This happens for things like inodes which are logged * separately from the buffer. */ void @@ -189,7 +204,7 @@ xfs_buf_item_size( while (last_bit != -1) { /* * This takes the bit number to start looking from and - * returns the next set bit from there. It returns -1 + * returns the next set bit from there. It returns -1 * if there are no more bits set or the start bit is * beyond the end of the bitmap. */ @@ -222,7 +237,7 @@ xfs_buf_item_size( /* * This is called to fill in the vector of log iovecs for the - * given log buf item. It fills the first entry with a buf log + * given log buf item. It fills the first entry with a buf log * format structure, and the rest point to contiguous chunks * within the buffer. */ @@ -233,7 +248,7 @@ xfs_buf_item_format( { uint base_size; uint nvecs; - xfs_log_iovec_t *vecp; + xfs_log_iovec_t *vecp; xfs_buf_t *bp; int first_bit; int last_bit; @@ -286,7 +301,7 @@ xfs_buf_item_format( for (;;) { /* * This takes the bit number to start looking from and - * returns the next set bit from there. It returns -1 + * returns the next set bit from there. It returns -1 * if there are no more bits set or the start bit is * beyond the end of the bitmap. */ @@ -348,7 +363,7 @@ xfs_buf_item_format( /* * This is called to pin the buffer associated with the buf log - * item in memory so it cannot be written out. Simply call bpin() + * item in memory so it cannot be written out. Simply call bpin() * on the buffer to do this. */ void @@ -605,7 +620,7 @@ xfs_buf_item_unlock( * buf log item in the on disk log resides now that the last log * write of it completed at the given lsn. * We always re-log all the dirty data in a buffer, so usually the - * latest copy in the on disk log is the only one that matters. For + * latest copy in the on disk log is the only one that matters. For * those cases we simply return the given lsn. * * The one exception to this is for buffers full of newly allocated @@ -653,7 +668,7 @@ xfs_buf_item_abort( /* * This is called to asynchronously write the buffer associated with this * buf log item out to disk. The buffer will already have been locked by - * a successful call to xfs_buf_item_trylock(). If the buffer still has + * a successful call to xfs_buf_item_trylock(). If the buffer still has * B_DELWRI set, then get it going out to disk with a call to bawrite(). * If not, then just release the buffer. */ @@ -723,7 +738,7 @@ xfs_buf_item_init( /* * Check to see if there is already a buf log item for - * this buffer. If there is, it is guaranteed to be + * this buffer. If there is, it is guaranteed to be * the first. If we do already have one, there is * nothing to do here so return. */ @@ -740,7 +755,7 @@ xfs_buf_item_init( /* * chunks is the number of XFS_BLI_CHUNK size pieces * the buffer can be divided into. Make sure not to - * truncate any pieces. map_size is the size of the + * truncate any pieces. map_size is the size of the * bitmap needed to describe the chunks of the buffer. */ chunks = (int)((XFS_BUF_COUNT(bp) + (XFS_BLI_CHUNK - 1)) >> XFS_BLI_SHIFT); @@ -838,7 +853,7 @@ xfs_buf_item_log( /* * First set any bits in the first word of our range. * If it starts at bit 0 of the word, it will be - * set below rather than here. That is what the variable + * set below rather than here. That is what the variable * bit tells us. The variable bits_set tracks the number * of bits that have been set so far. End_bit is the number * of the last bit to be set in this word plus one. @@ -928,7 +943,7 @@ xfs_buf_item_relse( * to be called when the buffer's I/O completes. If it is not set * already, set the buffer's b_iodone() routine to be * xfs_buf_iodone_callbacks() and link the log item into the list of - * items rooted at b_fsprivate. Items are always added as the second + * items rooted at b_fsprivate. Items are always added as the second * entry in the list if there is a first, because the buf item code * assumes that the buf log item is first. */ @@ -981,7 +996,7 @@ xfs_buf_do_callbacks( /* * This is the iodone() function for buffers which have had callbacks - * attached to them by xfs_buf_attach_iodone(). It should remove each + * attached to them by xfs_buf_attach_iodone(). It should remove each * log item from the buffer's list and call the callback of each in turn. * When done, the buffer's fsprivate field is set to NULL and the buffer * is unlocked with a call to iodone(). @@ -1201,5 +1216,3 @@ xfs_buf_item_trace( (void *)((unsigned long)bip->bli_item.li_flags)); } #endif /* XFS_BLI_TRACE */ - - diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h index 3cd9480f7212..aa90b801d7f4 100644 --- a/fs/xfs/xfs_buf_item.h +++ b/fs/xfs/xfs_buf_item.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,14 +29,14 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_BUF_ITEM_H__ -#define __XFS_BUF_ITEM_H__ +#ifndef __XFS_BUF_ITEM_H__ +#define __XFS_BUF_ITEM_H__ /* * This is the structure used to lay out a buf log item in the - * log. The data map describes which 128 byte chunks of the buffer + * log. The data map describes which 128 byte chunks of the buffer * have been logged. This structure works only on buffers that - * reside up to the first TB in the filesystem. These buffers are + * reside up to the first TB in the filesystem. These buffers are * generated only by pre-6.2 systems and are known as XFS_LI_6_1_BUF. */ typedef struct xfs_buf_log_format_v1 { @@ -69,33 +69,33 @@ typedef struct xfs_buf_log_format_t { * This flag indicates that the buffer contains on disk inodes * and requires special recovery handling. */ -#define XFS_BLI_INODE_BUF 0x1 +#define XFS_BLI_INODE_BUF 0x1 /* * This flag indicates that the buffer should not be replayed * during recovery because its blocks are being freed. */ -#define XFS_BLI_CANCEL 0x2 +#define XFS_BLI_CANCEL 0x2 /* * This flag indicates that the buffer contains on disk * user or group dquots and may require special recovery handling. */ -#define XFS_BLI_UDQUOT_BUF 0x4 +#define XFS_BLI_UDQUOT_BUF 0x4 /* #define XFS_BLI_PDQUOT_BUF 0x8 */ -#define XFS_BLI_GDQUOT_BUF 0x10 +#define XFS_BLI_GDQUOT_BUF 0x10 -#define XFS_BLI_CHUNK 128 -#define XFS_BLI_SHIFT 7 -#define BIT_TO_WORD_SHIFT 5 -#define NBWORD (NBBY * sizeof(unsigned int)) +#define XFS_BLI_CHUNK 128 +#define XFS_BLI_SHIFT 7 +#define BIT_TO_WORD_SHIFT 5 +#define NBWORD (NBBY * sizeof(unsigned int)) /* * buf log item flags */ -#define XFS_BLI_HOLD 0x01 -#define XFS_BLI_DIRTY 0x02 -#define XFS_BLI_STALE 0x04 -#define XFS_BLI_LOGGED 0x08 -#define XFS_BLI_INODE_ALLOC_BUF 0x10 +#define XFS_BLI_HOLD 0x01 +#define XFS_BLI_DIRTY 0x02 +#define XFS_BLI_STALE 0x04 +#define XFS_BLI_LOGGED 0x08 +#define XFS_BLI_INODE_ALLOC_BUF 0x10 #ifdef __KERNEL__ @@ -136,11 +136,11 @@ typedef struct xfs_buf_cancel { struct xfs_buf_cancel *bc_next; } xfs_buf_cancel_t; -#define XFS_BLI_TRACE_SIZE 32 +#define XFS_BLI_TRACE_SIZE 32 #if defined(XFS_ALL_TRACE) -#define XFS_BLI_TRACE +#define XFS_BLI_TRACE #endif #if !defined(DEBUG) @@ -150,7 +150,7 @@ typedef struct xfs_buf_cancel { #if defined(XFS_BLI_TRACE) void xfs_buf_item_trace(char *, xfs_buf_log_item_t *); #else -#define xfs_buf_item_trace(id, bip) +#define xfs_buf_item_trace(id, bip) #endif void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); @@ -170,7 +170,7 @@ xfs_buf_item_flush_log_debug( uint first, uint last); #else -#define xfs_buf_item_flush_log_debug(bp, first, last) +#define xfs_buf_item_flush_log_debug(bp, first, last) #endif #endif /* __KERNEL__ */ diff --git a/fs/xfs/xfs_cap.c b/fs/xfs/xfs_cap.c index 1948150047ad..b3bb6a7b1057 100644 --- a/fs/xfs/xfs_cap.c +++ b/fs/xfs/xfs_cap.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" STATIC int xfs_cap_allow_set(vnode_t *); @@ -96,7 +96,7 @@ posix_cap_xfs_to_xattr( ASSERT(sizeof(xattr_cap->c_effective) == sizeof(src->cap_effective)); xattr_cap->c_version = cpu_to_le32(POSIX_CAP_XATTR_VERSION); - xattr_cap->c_abiversion = cpu_to_le32(_LINUX_CAPABILITY_VERSION); + xattr_cap->c_abiversion = cpu_to_le32(_LINUX_CAPABILITY_VERSION); xattr_cap->c_effective = src->cap_effective; xattr_cap->c_permitted = src->cap_permitted; xattr_cap->c_inheritable= src->cap_inheritable; @@ -114,7 +114,7 @@ xfs_cap_vget( int len = sizeof(xfs_cap_set_t); int flags = ATTR_ROOT; xfs_cap_set_t xfs_cap = { 0 }; - posix_cap_xattr *xattr_cap = cap; + posix_cap_xattr *xattr_cap = cap; VN_HOLD(vp); if ((error = _MAC_VACCESS(vp, NULL, VREAD))) diff --git a/fs/xfs/xfs_cap.h b/fs/xfs/xfs_cap.h index aa9bf8817d8a..2deac7303758 100644 --- a/fs/xfs/xfs_cap.h +++ b/fs/xfs/xfs_cap.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -38,9 +38,9 @@ typedef __uint64_t xfs_cap_value_t; typedef struct xfs_cap_set { - xfs_cap_value_t cap_effective; /* use in capability checks */ - xfs_cap_value_t cap_permitted; /* combined with file attrs */ - xfs_cap_value_t cap_inheritable;/* pass through exec */ + xfs_cap_value_t cap_effective; /* use in capability checks */ + xfs_cap_value_t cap_permitted; /* combined with file attrs */ + xfs_cap_value_t cap_inheritable;/* pass through exec */ } xfs_cap_set_t; /* On-disk XFS extended attribute names */ @@ -81,4 +81,4 @@ extern int xfs_cap_vremove(struct vnode *vp); #endif /* __KERNEL__ */ -#endif /* __XFS_CAP_H__ */ +#endif /* __XFS_CAP_H__ */ diff --git a/fs/xfs/xfs_clnt.h b/fs/xfs/xfs_clnt.h index 689cbac1b793..314a539f9e49 100644 --- a/fs/xfs/xfs_clnt.h +++ b/fs/xfs/xfs_clnt.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -45,7 +45,7 @@ * system call), and the ABI issues that this implies. * * In Linux, we are passed a comma separated set of options; - * ie. a NULL terminated string of characters. Userspace mount + * ie. a NULL terminated string of characters. Userspace mount * code does not have any knowledge of mount options expected by * each filesystem type and so each filesystem parses its mount * options in kernel space. @@ -69,10 +69,10 @@ struct xfs_mount_args { /* * XFS mount option flags */ -#define XFSMNT_CHKLOG 0x00000001 /* check log */ -#define XFSMNT_WSYNC 0x00000002 /* safe mode nfs mount +#define XFSMNT_CHKLOG 0x00000001 /* check log */ +#define XFSMNT_WSYNC 0x00000002 /* safe mode nfs mount * compatible */ -#define XFSMNT_INO64 0x00000004 /* move inode numbers up +#define XFSMNT_INO64 0x00000004 /* move inode numbers up * past 2^32 */ #define XFSMNT_UQUOTA 0x00000008 /* user quota accounting */ #define XFSMNT_PQUOTA 0x00000010 /* IRIX prj quota accounting */ diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index bc794244190e..bd112587e784 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,41 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_leaf.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_error.h" +#include "xfs_bit.h" #if defined(XFSDEBUG) && defined(CONFIG_KDB) #undef xfs_buftrace @@ -746,7 +779,7 @@ xfs_da_join(xfs_da_state_t *state) } /* - * We have only one entry in the root. Copy the only remaining child of + * We have only one entry in the root. Copy the only remaining child of * the old root to block 0 as the new root node. */ STATIC int @@ -1602,7 +1635,7 @@ xfs_da_hashname(uchar_t *name, int namelen) { xfs_dahash_t hash; -#define ROTL(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) +#define ROTL(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) #ifdef SLOWVERSION /* * This is the old one-byte-at-a-time version. @@ -1648,7 +1681,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) { xfs_fileoff_t bno, b; xfs_bmbt_irec_t map; - xfs_bmbt_irec_t *mapp; + xfs_bmbt_irec_t *mapp; xfs_inode_t *dp; int nmap, error, w, count, c, got, i, mapi; xfs_fsize_t size; @@ -1696,7 +1729,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) } /* * If we didn't get it and the block might work if fragmented, - * try without the CONTIG flag. Loop until we get it all. + * try without the CONTIG flag. Loop until we get it all. */ else if (nmap == 0 && count > 1) { mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP); @@ -1753,7 +1786,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) } /* - * Ick. We need to always be able to remove a btree block, even + * Ick. We need to always be able to remove a btree block, even * if there's no space reservation because the filesystem is full. * This is called if xfs_bunmapi on a btree block fails due to ENOSPC. * It swaps the target block with the last block in the file. The @@ -2032,7 +2065,7 @@ done: STATIC int xfs_da_map_covers_blocks( int nmap, - xfs_bmbt_irec_t *mapp, + xfs_bmbt_irec_t *mapp, xfs_dablk_t bno, int count) { @@ -2071,8 +2104,8 @@ xfs_da_do_buf( xfs_buf_t **bplist; int error=0; int i; - xfs_bmbt_irec_t map; - xfs_bmbt_irec_t *mapp; + xfs_bmbt_irec_t map; + xfs_bmbt_irec_t *mapp; xfs_daddr_t mappedbno; xfs_mount_t *mp; int nbplist=0; diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h index 7328bd26cf62..e575998a58ad 100644 --- a/fs/xfs/xfs_da_btree.h +++ b/fs/xfs/xfs_da_btree.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DA_BTREE_H__ -#define __XFS_DA_BTREE_H__ +#define __XFS_DA_BTREE_H__ struct xfs_buf; struct xfs_bmap_free; @@ -52,10 +52,10 @@ struct zone; #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_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_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */ +#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */ -#define XFS_DIRX_LEAF_MAGIC(mp) \ +#define XFS_DIRX_LEAF_MAGIC(mp) \ (XFS_DIR_IS_V1(mp) ? XFS_DIR_LEAF_MAGIC : XFS_DIR2_LEAFN_MAGIC) typedef struct xfs_da_blkinfo { @@ -74,7 +74,7 @@ typedef struct xfs_da_blkinfo { * Since we have duplicate keys, use a binary search but always follow * all match in the block, not just the first match found. */ -#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */ +#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */ typedef struct xfs_da_intnode { struct xfs_da_node_hdr { /* constant-structure header block */ @@ -97,15 +97,15 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t; */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBSIZE) int xfs_lbsize(struct xfs_mount *mp); -#define XFS_LBSIZE(mp) xfs_lbsize(mp) +#define XFS_LBSIZE(mp) xfs_lbsize(mp) #else -#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize) +#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBLOG) int xfs_lblog(struct xfs_mount *mp); -#define XFS_LBLOG(mp) xfs_lblog(mp) +#define XFS_LBLOG(mp) xfs_lblog(mp) #else -#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog) +#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog) #endif /* @@ -118,41 +118,41 @@ int xfs_lblog(struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_BNOENTRY) __uint32_t xfs_da_make_bnoentry(struct xfs_mount *mp, xfs_dablk_t bno, int entry); -#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ +#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ xfs_da_make_bnoentry(mp,bno,entry) #else -#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ +#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ (((bno) << (mp)->m_dircook_elog) | (entry)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_COOKIE) xfs_off_t xfs_da_make_cookie(struct xfs_mount *mp, xfs_dablk_t bno, int entry, xfs_dahash_t hash); -#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ +#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ xfs_da_make_cookie(mp,bno,entry,hash) #else -#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ +#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ (((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_HASH) xfs_dahash_t xfs_da_cookie_hash(struct xfs_mount *mp, xfs_off_t cookie); -#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie) +#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie) #else -#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie)) +#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_BNO) xfs_dablk_t xfs_da_cookie_bno(struct xfs_mount *mp, xfs_off_t cookie); -#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie) +#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie) #else -#define XFS_DA_COOKIE_BNO(mp,cookie) \ +#define XFS_DA_COOKIE_BNO(mp,cookie) \ (((xfs_off_t)(cookie) >> 31) == -1LL ? \ (xfs_dablk_t)0 : \ (xfs_dablk_t)((xfs_off_t)(cookie) >> ((mp)->m_dircook_elog + 32))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_ENTRY) int xfs_da_cookie_entry(struct xfs_mount *mp, xfs_off_t cookie); -#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie) +#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie) #else -#define XFS_DA_COOKIE_ENTRY(mp,cookie) \ +#define XFS_DA_COOKIE_ENTRY(mp,cookie) \ (((xfs_off_t)(cookie) >> 31) == -1LL ? \ (xfs_dablk_t)0 : \ (xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \ @@ -217,7 +217,7 @@ typedef struct xfs_dabuf { #endif struct xfs_buf *bps[1]; /* actually nbuf of these */ } xfs_dabuf_t; -#define XFS_DA_BUF_SIZE(n) \ +#define XFS_DA_BUF_SIZE(n) \ (sizeof(xfs_dabuf_t) + sizeof(struct xfs_buf *) * ((n) - 1)) #ifdef XFS_DABUF_DEBUG diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index c2f3cc5d87b8..4a6cf85eb8c4 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,25 +30,52 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <xfs_dfrag.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_ag.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_ialloc.h" +#include "xfs_itable.h" +#include "xfs_dfrag.h" +#include "xfs_error.h" +#include "xfs_mac.h" +#include "xfs_rw.h" /* * Syssgi interface for swapext */ int xfs_swapext( - xfs_swapext_t *sxp) + xfs_swapext_t *sxp) { xfs_swapext_t sx; - xfs_inode_t *ip=NULL, *tip=NULL, *ips[2]; - xfs_trans_t *tp; - xfs_mount_t *mp; + xfs_inode_t *ip=NULL, *tip=NULL, *ips[2]; + xfs_trans_t *tp; + xfs_mount_t *mp; xfs_bstat_t *sbp; struct file *fp = NULL, *tfp = NULL; vnode_t *vp, *tvp; - bhv_desc_t *bdp, *tbdp; - vn_bhv_head_t *bhp, *tbhp; + bhv_desc_t *bdp, *tbdp; + vn_bhv_head_t *bhp, *tbhp; uint lock_flags=0; int ilf_fields, tilf_fields; int error = 0; @@ -93,7 +120,7 @@ xfs_swapext( } if (ip->i_ino == tip->i_ino) { - error = XFS_ERROR(EINVAL); + error = XFS_ERROR(EINVAL); goto error0; } @@ -102,7 +129,7 @@ xfs_swapext( sbp = &sx.sx_stat; if (XFS_FORCED_SHUTDOWN(mp)) { - error = XFS_ERROR(EIO); + error = XFS_ERROR(EIO); goto error0; } @@ -222,7 +249,7 @@ xfs_swapext( if ((error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0))) { - xfs_iunlock(ip, XFS_IOLOCK_EXCL); + xfs_iunlock(ip, XFS_IOLOCK_EXCL); xfs_iunlock(tip, XFS_IOLOCK_EXCL); xfs_trans_cancel(tp, 0); return error; @@ -236,7 +263,7 @@ xfs_swapext( (ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)) { error = xfs_bmap_count_blocks(tp, ip, XFS_ATTR_FORK, &aforkblks); if (error) { - xfs_iunlock(ip, lock_flags); + xfs_iunlock(ip, lock_flags); xfs_iunlock(tip, lock_flags); xfs_trans_cancel(tp, 0); return error; @@ -247,7 +274,7 @@ xfs_swapext( error = xfs_bmap_count_blocks(tp, tip, XFS_ATTR_FORK, &taforkblks); if (error) { - xfs_iunlock(ip, lock_flags); + xfs_iunlock(ip, lock_flags); xfs_iunlock(tip, lock_flags); xfs_trans_cancel(tp, 0); return error; @@ -261,7 +288,7 @@ xfs_swapext( tifp = &tip->i_df; tempif = *ifp; /* struct copy */ *ifp = *tifp; /* struct copy */ - *tifp = tempif; /* struct copy */ + *tifp = tempif; /* struct copy */ /* * Fix the on-disk inode values @@ -347,7 +374,7 @@ xfs_swapext( error0: if (locked) { - xfs_iunlock(ip, lock_flags); + xfs_iunlock(ip, lock_flags); xfs_iunlock(tip, lock_flags); } diff --git a/fs/xfs/xfs_dfrag.h b/fs/xfs/xfs_dfrag.h index 7143248ce04c..0e1c26fba893 100644 --- a/fs/xfs/xfs_dfrag.h +++ b/fs/xfs/xfs_dfrag.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DFRAG_H__ -#define __XFS_DFRAG_H__ +#define __XFS_DFRAG_H__ /* * Structure passed to xfs_swapext diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index 5adc2eabb423..89bd040b445a 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,13 +30,13 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DINODE_H__ -#define __XFS_DINODE_H__ +#define __XFS_DINODE_H__ struct xfs_buf; struct xfs_mount; -#define XFS_DINODE_VERSION_1 1 -#define XFS_DINODE_VERSION_2 2 +#define XFS_DINODE_VERSION_1 1 +#define XFS_DINODE_VERSION_2 2 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION) int xfs_dinode_good_version(int v); #define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v) @@ -44,7 +44,7 @@ int xfs_dinode_good_version(int v); #define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \ ((v) == XFS_DINODE_VERSION_2)) #endif -#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ +#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ /* * Disk inode structure. @@ -73,9 +73,9 @@ typedef struct xfs_dinode_core __uint32_t di_nlink; /* number of links to file */ __uint16_t di_projid; /* owner's project id */ __uint8_t di_pad[10]; /* unused, zeroed space */ - xfs_timestamp_t di_atime; /* time last accessed */ - xfs_timestamp_t di_mtime; /* time last modified */ - xfs_timestamp_t di_ctime; /* time created/inode modified */ + xfs_timestamp_t di_atime; /* time last accessed */ + xfs_timestamp_t di_mtime; /* time last modified */ + xfs_timestamp_t di_ctime; /* time created/inode modified */ xfs_fsize_t di_size; /* number of bytes in file */ xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ @@ -111,7 +111,7 @@ typedef struct xfs_dinode union { xfs_bmdr_block_t di_abmbt; /* btree root block */ xfs_bmbt_rec_32_t di_abmx[1]; /* extent list */ - xfs_attr_shortform_t di_attrsf; /* shortform attribute list */ + xfs_attr_shortform_t di_attrsf; /* shortform attribute list */ } di_a; } xfs_dinode_t; @@ -120,42 +120,42 @@ typedef struct xfs_dinode * Since the pathconf interface is signed, we use 2^31 - 1 instead. * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX. */ -#define XFS_MAXLINK ((1U << 31) - 1U) -#define XFS_MAXLINK_1 65535U +#define XFS_MAXLINK ((1U << 31) - 1U) +#define XFS_MAXLINK_1 65535U /* * Bit names for logging disk inodes only */ -#define XFS_DI_MAGIC 0x0000001 -#define XFS_DI_MODE 0x0000002 -#define XFS_DI_VERSION 0x0000004 -#define XFS_DI_FORMAT 0x0000008 -#define XFS_DI_ONLINK 0x0000010 -#define XFS_DI_UID 0x0000020 -#define XFS_DI_GID 0x0000040 -#define XFS_DI_NLINK 0x0000080 -#define XFS_DI_PROJID 0x0000100 -#define XFS_DI_PAD 0x0000200 -#define XFS_DI_ATIME 0x0000400 -#define XFS_DI_MTIME 0x0000800 -#define XFS_DI_CTIME 0x0001000 -#define XFS_DI_SIZE 0x0002000 -#define XFS_DI_NBLOCKS 0x0004000 -#define XFS_DI_EXTSIZE 0x0008000 -#define XFS_DI_NEXTENTS 0x0010000 -#define XFS_DI_NAEXTENTS 0x0020000 -#define XFS_DI_FORKOFF 0x0040000 -#define XFS_DI_AFORMAT 0x0080000 -#define XFS_DI_DMEVMASK 0x0100000 -#define XFS_DI_DMSTATE 0x0200000 -#define XFS_DI_FLAGS 0x0400000 -#define XFS_DI_GEN 0x0800000 -#define XFS_DI_NEXT_UNLINKED 0x1000000 -#define XFS_DI_U 0x2000000 -#define XFS_DI_A 0x4000000 -#define XFS_DI_NUM_BITS 27 -#define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1) -#define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A)) +#define XFS_DI_MAGIC 0x0000001 +#define XFS_DI_MODE 0x0000002 +#define XFS_DI_VERSION 0x0000004 +#define XFS_DI_FORMAT 0x0000008 +#define XFS_DI_ONLINK 0x0000010 +#define XFS_DI_UID 0x0000020 +#define XFS_DI_GID 0x0000040 +#define XFS_DI_NLINK 0x0000080 +#define XFS_DI_PROJID 0x0000100 +#define XFS_DI_PAD 0x0000200 +#define XFS_DI_ATIME 0x0000400 +#define XFS_DI_MTIME 0x0000800 +#define XFS_DI_CTIME 0x0001000 +#define XFS_DI_SIZE 0x0002000 +#define XFS_DI_NBLOCKS 0x0004000 +#define XFS_DI_EXTSIZE 0x0008000 +#define XFS_DI_NEXTENTS 0x0010000 +#define XFS_DI_NAEXTENTS 0x0020000 +#define XFS_DI_FORKOFF 0x0040000 +#define XFS_DI_AFORMAT 0x0080000 +#define XFS_DI_DMEVMASK 0x0100000 +#define XFS_DI_DMSTATE 0x0200000 +#define XFS_DI_FLAGS 0x0400000 +#define XFS_DI_GEN 0x0800000 +#define XFS_DI_NEXT_UNLINKED 0x1000000 +#define XFS_DI_U 0x2000000 +#define XFS_DI_A 0x4000000 +#define XFS_DI_NUM_BITS 27 +#define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1) +#define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A)) /* * Values for di_format @@ -173,29 +173,29 @@ typedef enum xfs_dinode_fmt /* * Inode minimum and maximum sizes. */ -#define XFS_DINODE_MIN_LOG 8 -#define XFS_DINODE_MAX_LOG 11 -#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG) -#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG) +#define XFS_DINODE_MIN_LOG 8 +#define XFS_DINODE_MAX_LOG 11 +#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG) +#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG) /* * Inode size for given fs. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO) int xfs_litino(struct xfs_mount *mp); -#define XFS_LITINO(mp) xfs_litino(mp) +#define XFS_LITINO(mp) xfs_litino(mp) #else -#define XFS_LITINO(mp) ((mp)->m_litino) +#define XFS_LITINO(mp) ((mp)->m_litino) #endif -#define XFS_BROOT_SIZE_ADJ \ +#define XFS_BROOT_SIZE_ADJ \ (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t)) /* * Fork identifiers. Here so utilities can use them without including * xfs_inode.h. */ -#define XFS_DATA_FORK 0 -#define XFS_ATTR_FORK 1 +#define XFS_DATA_FORK 0 +#define XFS_ATTR_FORK 1 /* * Inode data & attribute fork sizes, per inode. @@ -203,30 +203,30 @@ int xfs_litino(struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q) int xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); int xfs_cfork_q(xfs_dinode_core_t *dcp); -#define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch) -#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp) +#define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch) +#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp) #else -#define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch)) -#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) +#define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch)) +#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF) int xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); int xfs_cfork_boff(xfs_dinode_core_t *dcp); -#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch) -#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp) +#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch) +#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp) #else -#define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3)) -#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) +#define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3)) +#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE) int xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch) -#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp) +#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch) +#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp) #else -#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \ +#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \ (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_CFORK_BOFF_ARCH(dcp, arch) : XFS_LITINO(mp)) #define XFS_CFORK_DSIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) @@ -235,10 +235,10 @@ int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE) int xfs_cfork_asize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch) -#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp) +#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch) +#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp) #else -#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \ +#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \ (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_ARCH(dcp, arch) : 0) #define XFS_CFORK_ASIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) @@ -247,10 +247,10 @@ int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE) int xfs_cfork_size_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w, xfs_arch_t arch); int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); -#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch) -#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w) +#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch) +#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w) #else -#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \ +#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \ ((w) == XFS_DATA_FORK ? \ XFS_CFORK_DSIZE_ARCH(dcp, mp, arch) : XFS_CFORK_ASIZE_ARCH(dcp, mp, arch)) #define XFS_CFORK_SIZE(dcp,mp,w) \ @@ -262,31 +262,31 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) int xfs_dfork_dsize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch) -#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) +#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch) +#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) #else -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch) +#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE) int xfs_dfork_asize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch) -#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp) +#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch) +#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp) #else -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch) +#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE) int xfs_dfork_size_arch(xfs_dinode_t *dip, struct xfs_mount *mp, int w, xfs_arch_t arch); int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch) -#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w) +#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch) +#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w) #else -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch) -#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT) +#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch) +#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT) #endif @@ -296,171 +296,171 @@ int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q) int xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_q(xfs_dinode_t *dip); -#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch) -#define XFS_DFORK_Q(dip) xfs_dfork_q(dip) +#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch) +#define XFS_DFORK_Q(dip) xfs_dfork_q(dip) #else -#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch) +#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF) int xfs_dfork_boff_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_boff(xfs_dinode_t *dip); -#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch) -#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) +#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch) +#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) #else -#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch) +#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR) char *xfs_dfork_dptr_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_dptr(xfs_dinode_t *dip); -#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch) -#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip) +#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch) +#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip) #else -#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c) -#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c) +#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR) char *xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_aptr(xfs_dinode_t *dip); -#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch) -#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip) +#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch) +#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip) #else -#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch)) -#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch)) +#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR) char *xfs_dfork_ptr_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); char *xfs_dfork_ptr(xfs_dinode_t *dip, int w); -#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch) -#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w) +#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch) +#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w) #else -#define XFS_DFORK_PTR_ARCH(dip,w,arch) \ +#define XFS_DFORK_PTR_ARCH(dip,w,arch) \ ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR_ARCH(dip, arch) : XFS_DFORK_APTR_ARCH(dip, arch)) -#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT) +#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT) int xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); int xfs_cfork_format(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch) -#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w) +#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch) +#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w) #else -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \ +#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \ ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_format, arch) : INT_GET((dcp)->di_aformat, arch)) -#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET) void xfs_cfork_fmt_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch) -#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n) +#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch) +#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n) #else -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \ ((w) == XFS_DATA_FORK ? \ (INT_SET((dcp)->di_format, arch, (n))) : \ (INT_SET((dcp)->di_aformat, arch, (n)))) -#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) +#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS) int xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch) -#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w) +#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch) +#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w) #else -#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \ +#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \ ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_nextents, arch) : INT_GET((dcp)->di_anextents, arch)) -#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET) void xfs_cfork_next_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch) -#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n) +#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch) +#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n) #else -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \ ((w) == XFS_DATA_FORK ? \ (INT_SET((dcp)->di_nextents, arch, (n))) : \ (INT_SET((dcp)->di_anextents, arch, (n)))) -#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) +#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FORMAT) int xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); int xfs_dfork_format(xfs_dinode_t *dip, int w); -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch) -#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w) +#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch) +#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w) #else -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT) +#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch) +#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FMT_SET) void xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); void xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch) -#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n) +#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch) +#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n) #else -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) +#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch) +#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS) int xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); int xfs_dfork_nextents(xfs_dinode_t *dip, int w); -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch) -#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) +#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch) +#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) #else -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT) +#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch) +#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXT_SET) void xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n) +#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch) +#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n) #else -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) +#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch) +#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) #endif /* * File types (mode field) */ -#define IFMT 0170000 /* type of file */ -#define IFIFO 0010000 /* named pipe (fifo) */ -#define IFCHR 0020000 /* character special */ -#define IFDIR 0040000 /* directory */ -#define IFBLK 0060000 /* block special */ -#define IFREG 0100000 /* regular */ -#define IFLNK 0120000 /* symbolic link */ -#define IFSOCK 0140000 /* socket */ -#define IFMNT 0160000 /* mount point */ +#define IFMT 0170000 /* type of file */ +#define IFIFO 0010000 /* named pipe (fifo) */ +#define IFCHR 0020000 /* character special */ +#define IFDIR 0040000 /* directory */ +#define IFBLK 0060000 /* block special */ +#define IFREG 0100000 /* regular */ +#define IFLNK 0120000 /* symbolic link */ +#define IFSOCK 0140000 /* socket */ +#define IFMNT 0160000 /* mount point */ /* * File execution and access modes. */ -#define ISUID 04000 /* set user id on execution */ -#define ISGID 02000 /* set group id on execution */ -#define ISVTX 01000 /* sticky directory */ -#define IREAD 0400 /* read, write, execute permissions */ -#define IWRITE 0200 -#define IEXEC 0100 +#define ISUID 04000 /* set user id on execution */ +#define ISGID 02000 /* set group id on execution */ +#define ISVTX 01000 /* sticky directory */ +#define IREAD 0400 /* read, write, execute permissions */ +#define IWRITE 0200 +#define IEXEC 0100 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp); -#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp) +#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp) #else -#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp))) #endif /* @@ -468,13 +468,13 @@ xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp); * There should be a one-to-one correspondence between these flags and the * XFS_XFLAG_s. */ -#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */ -#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ -#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */ -#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) +#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */ +#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ +#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */ +#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT) -#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT) -#define XFS_DIFLAG_ALL \ +#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT) +#define XFS_DIFLAG_ALL \ (XFS_DIFLAG_REALTIME|XFS_DIFLAG_PREALLOC|XFS_DIFLAG_NEWRTBM) #endif /* __XFS_DINODE_H__ */ diff --git a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c index 29d0720d77d8..5069c16e8afa 100644 --- a/fs/xfs/xfs_dir.c +++ b/fs/xfs/xfs_dir.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,32 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_error.h" /* * xfs_dir.c @@ -537,7 +561,7 @@ xfs_dir_shortform_validate_ondisk(xfs_mount_t *mp, xfs_dinode_t *dp) if (xfs_dir_ino_validate(mp, ino)) return 1; - count = sf->hdr.count; + count = sf->hdr.count; if ((count < 0) || ((count * 10) > XFS_LITINO(mp))) { xfs_fs_cmn_err(CE_WARN, mp, "Invalid shortform count: dp 0x%p", dp); diff --git a/fs/xfs/xfs_dir.h b/fs/xfs/xfs_dir.h index 73369f65633c..7c09e5c920fc 100644 --- a/fs/xfs/xfs_dir.h +++ b/fs/xfs/xfs_dir.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,13 +30,13 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR_H__ -#define __XFS_DIR_H__ +#define __XFS_DIR_H__ /* * Large directories are structured around Btrees where all the data * elements are in the leaf nodes. Filenames are hashed into an int, * then that int is used as the index into the Btree. Since the hashval - * of a filename may not be unique, we may have duplicate keys. The + * of a filename may not be unique, we may have duplicate keys. The * internal links in the Btree are logical block offsets into the file. * * Small directories use a different format and are packed as tightly @@ -44,7 +44,7 @@ */ #ifdef XFS_ALL_TRACE -#define XFS_DIR_TRACE +#define XFS_DIR_TRACE #endif #if !defined(DEBUG) @@ -132,31 +132,31 @@ typedef struct xfs_dirops { */ void xfs_dir_startup(void); /* called exactly once */ -#define XFS_DIR_MOUNT(mp) \ +#define XFS_DIR_MOUNT(mp) \ ((mp)->m_dirops.xd_mount(mp)) -#define XFS_DIR_ISEMPTY(mp,dp) \ +#define XFS_DIR_ISEMPTY(mp,dp) \ ((mp)->m_dirops.xd_isempty(dp)) -#define XFS_DIR_INIT(mp,tp,dp,pdp) \ +#define XFS_DIR_INIT(mp,tp,dp,pdp) \ ((mp)->m_dirops.xd_init(tp,dp,pdp)) -#define XFS_DIR_CREATENAME(mp,tp,dp,name,namelen,inum,first,flist,total) \ +#define XFS_DIR_CREATENAME(mp,tp,dp,name,namelen,inum,first,flist,total) \ ((mp)->m_dirops.xd_createname(tp,dp,name,namelen,inum,first,flist,\ total)) -#define XFS_DIR_LOOKUP(mp,tp,dp,name,namelen,inum) \ +#define XFS_DIR_LOOKUP(mp,tp,dp,name,namelen,inum) \ ((mp)->m_dirops.xd_lookup(tp,dp,name,namelen,inum)) -#define XFS_DIR_REMOVENAME(mp,tp,dp,name,namelen,ino,first,flist,total) \ +#define XFS_DIR_REMOVENAME(mp,tp,dp,name,namelen,ino,first,flist,total) \ ((mp)->m_dirops.xd_removename(tp,dp,name,namelen,ino,first,flist,total)) -#define XFS_DIR_GETDENTS(mp,tp,dp,uio,eofp) \ +#define XFS_DIR_GETDENTS(mp,tp,dp,uio,eofp) \ ((mp)->m_dirops.xd_getdents(tp,dp,uio,eofp)) -#define XFS_DIR_REPLACE(mp,tp,dp,name,namelen,inum,first,flist,total) \ +#define XFS_DIR_REPLACE(mp,tp,dp,name,namelen,inum,first,flist,total) \ ((mp)->m_dirops.xd_replace(tp,dp,name,namelen,inum,first,flist,total)) -#define XFS_DIR_CANENTER(mp,tp,dp,name,namelen) \ +#define XFS_DIR_CANENTER(mp,tp,dp,name,namelen) \ ((mp)->m_dirops.xd_canenter(tp,dp,name,namelen)) -#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) \ +#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) \ ((mp)->m_dirops.xd_shortform_validate_ondisk(mp,dip)) -#define XFS_DIR_SHORTFORM_TO_SINGLE(mp,args) \ +#define XFS_DIR_SHORTFORM_TO_SINGLE(mp,args) \ ((mp)->m_dirops.xd_shortform_to_single(args)) -#define XFS_DIR_IS_V1(mp) ((mp)->m_dirversion == 1) +#define XFS_DIR_IS_V1(mp) ((mp)->m_dirversion == 1) extern xfs_dirops_t xfsv1_dirops; #endif /* __XFS_DIR_H__ */ diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 766cbdfa4099..188a24a45d7d 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,7 +35,38 @@ * Top-level and utility routines. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_dir2_sf.h" +#include "xfs_dir2_trace.h" +#include "xfs_error.h" +#include "xfs_bit.h" /* * Declarations for interface routines. @@ -282,7 +313,7 @@ xfs_dir2_removename( int namelen, /* name length of entry to remove */ xfs_ino_t ino, /* inode number of entry to remove */ xfs_fsblock_t *first, /* bmap's firstblock */ - xfs_bmap_free_t *flist, /* bmap's freeblock list */ + xfs_bmap_free_t *flist, /* bmap's freeblock list */ xfs_extlen_t total) /* bmap's total block count */ { xfs_da_args_t args; /* operation arguments */ @@ -385,7 +416,7 @@ xfs_dir2_replace( int namelen, /* name length of entry to replace */ xfs_ino_t inum, /* new inode number */ xfs_fsblock_t *first, /* bmap's firstblock */ - xfs_bmap_free_t *flist, /* bmap's freeblock list */ + xfs_bmap_free_t *flist, /* bmap's freeblock list */ xfs_extlen_t total) /* bmap's total block count */ { xfs_da_args_t args; /* operation arguments */ @@ -510,9 +541,9 @@ xfs_dir2_grow_inode( int error; /* error return value */ int got; /* blocks actually mapped */ int i; /* temp mapping index */ - xfs_bmbt_irec_t map; /* single structure for bmap */ + xfs_bmbt_irec_t map; /* single structure for bmap */ int mapi; /* mapping index */ - xfs_bmbt_irec_t *mapp; /* bmap mapping structure(s) */ + xfs_bmbt_irec_t *mapp; /* bmap mapping structure(s) */ xfs_mount_t *mp; /* filesystem mount point */ int nmap; /* number of bmap entries */ xfs_trans_t *tp; /* transaction pointer */ diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h index c129b7014146..8f4fc7f23bcd 100644 --- a/fs/xfs/xfs_dir2.h +++ b/fs/xfs/xfs_dir2.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_H__ -#define __XFS_DIR2_H__ +#define __XFS_DIR2_H__ struct uio; struct xfs_dabuf; @@ -57,19 +57,19 @@ struct xfs_trans; /* * Byte offset in data block and shortform entry. */ -typedef __uint16_t xfs_dir2_data_off_t; -#define NULLDATAOFF 0xffffU +typedef __uint16_t xfs_dir2_data_off_t; +#define NULLDATAOFF 0xffffU typedef uint xfs_dir2_data_aoff_t; /* argument form */ /* * Directory block number (logical dirblk in file) */ -typedef __uint32_t xfs_dir2_db_t; +typedef __uint32_t xfs_dir2_db_t; /* * Byte offset in a directory. */ -typedef xfs_off_t xfs_dir2_off_t; +typedef xfs_off_t xfs_dir2_off_t; /* * For getdents, argument struct for put routines. @@ -86,7 +86,7 @@ typedef struct xfs_dir2_put_args { struct uio *uio; /* uio control structure */ } xfs_dir2_put_args_t; -#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2) +#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2) extern xfs_dirops_t xfsv2_dirops; /* diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 922e5196e25e..6e5c5c6365e8 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,8 +36,32 @@ * See xfs_dir2_block.h for the format. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_trace.h" +#include "xfs_error.h" /* * Local function prototypes. diff --git a/fs/xfs/xfs_dir2_block.h b/fs/xfs/xfs_dir2_block.h index 64b9d06e4b21..3c4f70c915ef 100644 --- a/fs/xfs/xfs_dir2_block.h +++ b/fs/xfs/xfs_dir2_block.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_BLOCK_H__ -#define __XFS_DIR2_BLOCK_H__ +#define __XFS_DIR2_BLOCK_H__ /* * xfs_dir2_block.h @@ -54,7 +54,7 @@ struct xfs_trans; * xfs_dir2_block_tail_t structure */ -#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */ +#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */ typedef struct xfs_dir2_block_tail { __uint32_t count; /* count of leaf entries */ @@ -77,9 +77,9 @@ typedef struct xfs_dir2_block { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_TAIL_P) xfs_dir2_block_tail_t * xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block); -#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block) +#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block) #else -#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \ +#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \ (((xfs_dir2_block_tail_t *)((char *)(block) + (mp)->m_dirblksize)) - 1) #endif @@ -89,10 +89,10 @@ xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_LEAF_P) struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p_arch( xfs_dir2_block_tail_t *btp, xfs_arch_t arch); -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ +#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ xfs_dir2_block_leaf_p_arch(btp,arch) #else -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ +#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, arch)) #endif diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 7481245193d4..c1b8ea010a91 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,8 +36,30 @@ * See xfs_dir2_data.h for data structures. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_error.h" #ifdef DEBUG /* @@ -397,7 +419,7 @@ xfs_dir2_data_init( int i; /* bestfree index */ xfs_mount_t *mp; /* filesystem mount point */ xfs_trans_t *tp; /* transaction pointer */ - int t; /* temp */ + int t; /* temp */ dp = args->dp; mp = dp->i_mount; diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h index 67236b27197b..b9e16ab5f622 100644 --- a/fs/xfs/xfs_dir2_data.h +++ b/fs/xfs/xfs_dir2_data.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_DATA_H__ -#define __XFS_DIR2_DATA_H__ +#define __XFS_DIR2_DATA_H__ /* * Directory format 2, data block structures. @@ -44,30 +44,30 @@ struct xfs_trans; /* * Constants. */ -#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multiblock dirs */ -#define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */ -#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG) -#define XFS_DIR2_DATA_FREE_TAG 0xffff -#define XFS_DIR2_DATA_FD_COUNT 3 +#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multiblock dirs */ +#define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */ +#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG) +#define XFS_DIR2_DATA_FREE_TAG 0xffff +#define XFS_DIR2_DATA_FD_COUNT 3 /* * Directory address space divided into sections, * spaces separated by 32gb. */ -#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG)) -#define XFS_DIR2_DATA_SPACE 0 -#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE) -#define XFS_DIR2_DATA_FIRSTDB(mp) \ +#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG)) +#define XFS_DIR2_DATA_SPACE 0 +#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE) +#define XFS_DIR2_DATA_FIRSTDB(mp) \ XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATA_OFFSET) /* * Offsets of . and .. in data space (always block 0) */ -#define XFS_DIR2_DATA_DOT_OFFSET \ +#define XFS_DIR2_DATA_DOT_OFFSET \ ((xfs_dir2_data_aoff_t)sizeof(xfs_dir2_data_hdr_t)) -#define XFS_DIR2_DATA_DOTDOT_OFFSET \ +#define XFS_DIR2_DATA_DOTDOT_OFFSET \ (XFS_DIR2_DATA_DOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(1)) -#define XFS_DIR2_DATA_FIRST_OFFSET \ +#define XFS_DIR2_DATA_FIRST_OFFSET \ (XFS_DIR2_DATA_DOTDOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(2)) /* @@ -141,7 +141,7 @@ typedef struct xfs_dir2_data { int xfs_dir2_data_entsize(int n); #define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n) #else -#define XFS_DIR2_DATA_ENTSIZE(n) \ +#define XFS_DIR2_DATA_ENTSIZE(n) \ ((int)(roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \ (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN))) #endif @@ -151,9 +151,9 @@ int xfs_dir2_data_entsize(int n); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTRY_TAG_P) xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep); -#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) +#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) #else -#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \ +#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \ ((xfs_dir2_data_off_t *)\ ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ (uint)sizeof(xfs_dir2_data_off_t))) @@ -165,10 +165,10 @@ xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P) xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p_arch( xfs_dir2_data_unused_t *dup, xfs_arch_t arch); -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ +#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ xfs_dir2_data_unused_tag_p_arch(dup,arch) #else -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ +#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ ((xfs_dir2_data_off_t *)\ ((char *)(dup) + INT_GET((dup)->length, arch) \ - (uint)sizeof(xfs_dir2_data_off_t))) @@ -182,7 +182,7 @@ xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p_arch( extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp); #else -#define xfs_dir2_data_check(dp,bp) +#define xfs_dir2_data_check(dp,bp) #endif extern xfs_dir2_data_free_t * diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index b5c5d0260ec7..3ebcdeb5c35c 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -38,7 +38,34 @@ * XFS_DIR2_LEAF1 block containing the hash table and freespace map. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_dir2_trace.h" +#include "xfs_error.h" +#include "xfs_bit.h" /* * Local function declarations. @@ -46,7 +73,7 @@ #ifdef DEBUG static void xfs_dir2_leaf_check(xfs_inode_t *dp, xfs_dabuf_t *bp); #else -#define xfs_dir2_leaf_check(dp, bp) +#define xfs_dir2_leaf_check(dp, bp) #endif static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp, int *indexp, xfs_dabuf_t **dbpp); @@ -593,7 +620,7 @@ xfs_dir2_leaf_compact( xfs_dabuf_t *bp) /* leaf buffer */ { int from; /* source leaf index */ - xfs_dir2_leaf_t *leaf; /* leaf structure */ + xfs_dir2_leaf_t *leaf; /* leaf structure */ int loglow; /* first leaf entry to log */ int to; /* target leaf index */ @@ -649,7 +676,7 @@ xfs_dir2_leaf_compact_x1( int highstale; /* stale entry at/after index */ int index; /* insertion index */ int keepstale; /* source index of kept stale */ - xfs_dir2_leaf_t *leaf; /* leaf structure */ + xfs_dir2_leaf_t *leaf; /* leaf structure */ int lowstale; /* stale entry before index */ int newindex=0; /* new insertion index */ int to; /* destination copy index */ diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h index 35549d9675a2..1260ac51c681 100644 --- a/fs/xfs/xfs_dir2_leaf.h +++ b/fs/xfs/xfs_dir2_leaf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_LEAF_H__ -#define __XFS_DIR2_LEAF_H__ +#define __XFS_DIR2_LEAF_H__ /* * Directory version 2, leaf block structures. @@ -51,9 +51,9 @@ struct xfs_trans; * Offset of the leaf/node space. First block in this space * is the btree root. */ -#define XFS_DIR2_LEAF_SPACE 1 -#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE) -#define XFS_DIR2_LEAF_FIRSTDB(mp) \ +#define XFS_DIR2_LEAF_SPACE 1 +#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE) +#define XFS_DIR2_LEAF_FIRSTDB(mp) \ XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) /* @@ -63,9 +63,9 @@ struct xfs_trans; /* * Offset in data space of a data entry. */ -typedef __uint32_t xfs_dir2_dataptr_t; -#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0x7fffffff) -#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) +typedef __uint32_t xfs_dir2_dataptr_t; +#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0x7fffffff) +#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) /* * Structures. @@ -116,10 +116,10 @@ typedef struct xfs_dir2_leaf { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_MAX_LEAF_ENTS) int xfs_dir2_max_leaf_ents(struct xfs_mount *mp); -#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ +#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ xfs_dir2_max_leaf_ents(mp) #else -#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ +#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ ((int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / \ (uint)sizeof(xfs_dir2_leaf_entry_t))) #endif @@ -130,10 +130,10 @@ xfs_dir2_max_leaf_ents(struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_TAIL_P) xfs_dir2_leaf_tail_t * xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); -#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ +#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ xfs_dir2_leaf_tail_p(mp, lp) #else -#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ +#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ ((xfs_dir2_leaf_tail_t *)\ ((char *)(lp) + (mp)->m_dirblksize - \ (uint)sizeof(xfs_dir2_leaf_tail_t))) @@ -145,9 +145,9 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P) xfs_dir2_data_off_t * xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch); -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch) +#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch) #else -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \ +#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \ ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, arch)) #endif @@ -157,9 +157,9 @@ xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_BYTE) xfs_dir2_off_t xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); -#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) +#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) #else -#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \ +#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \ ((xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG) #endif @@ -169,9 +169,9 @@ xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DATAPTR) xfs_dir2_dataptr_t xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by); -#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) +#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) #else -#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \ +#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \ ((xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG)) #endif @@ -181,9 +181,9 @@ xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_DB) xfs_dir2_db_t xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); -#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) +#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) #else -#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \ +#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \ XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) #endif @@ -193,9 +193,9 @@ xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_OFF) xfs_dir2_data_aoff_t xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); -#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) +#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) #else -#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \ +#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \ XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) #endif @@ -206,10 +206,10 @@ xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); xfs_dir2_off_t xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, xfs_dir2_data_aoff_t o); -#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ +#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ xfs_dir2_db_off_to_byte(mp, db, o) #else -#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ +#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ (((xfs_dir2_off_t)(db) << \ ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o)) #endif @@ -219,9 +219,9 @@ xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB) xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by); -#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) +#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) #else -#define XFS_DIR2_BYTE_TO_DB(mp,by) \ +#define XFS_DIR2_BYTE_TO_DB(mp,by) \ ((xfs_dir2_db_t)((by) >> \ ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog))) #endif @@ -231,9 +231,9 @@ xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA) xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by); -#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) +#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) #else -#define XFS_DIR2_BYTE_TO_DA(mp,by) \ +#define XFS_DIR2_BYTE_TO_DA(mp,by) \ XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)) #endif @@ -243,9 +243,9 @@ xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_OFF) xfs_dir2_data_aoff_t xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by); -#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by) +#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by) #else -#define XFS_DIR2_BYTE_TO_OFF(mp,by) \ +#define XFS_DIR2_BYTE_TO_OFF(mp,by) \ ((xfs_dir2_data_aoff_t)((by) & \ ((1 << ((mp)->m_sb.sb_blocklog + \ (mp)->m_sb.sb_dirblklog)) - 1))) @@ -258,10 +258,10 @@ xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by); xfs_dir2_dataptr_t xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, xfs_dir2_data_aoff_t o); -#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ +#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ xfs_dir2_db_off_to_dataptr(mp, db, o) #else -#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ +#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)) #endif @@ -270,9 +270,9 @@ xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_DA) xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db); -#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db) +#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db) #else -#define XFS_DIR2_DB_TO_DA(mp,db) \ +#define XFS_DIR2_DB_TO_DA(mp,db) \ ((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog)) #endif @@ -281,9 +281,9 @@ xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_DB) xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da); -#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) +#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) #else -#define XFS_DIR2_DA_TO_DB(mp,da) \ +#define XFS_DIR2_DA_TO_DB(mp,da) \ ((xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog)) #endif @@ -294,7 +294,7 @@ xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da); xfs_dir2_off_t xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da); #define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da) #else -#define XFS_DIR2_DA_TO_BYTE(mp,da) \ +#define XFS_DIR2_DA_TO_BYTE(mp,da) \ XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0) #endif diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index 80a3a8225883..6a2fd41178d7 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,7 +36,32 @@ * See data structures in xfs_dir2_node.h and xfs_da_btree.h. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_dir2_trace.h" +#include "xfs_error.h" /* * Function declarations. @@ -46,7 +71,7 @@ static int xfs_dir2_leafn_add(xfs_dabuf_t *bp, xfs_da_args_t *args, int index); #ifdef DEBUG static void xfs_dir2_leafn_check(xfs_inode_t *dp, xfs_dabuf_t *bp); #else -#define xfs_dir2_leafn_check(dp, bp) +#define xfs_dir2_leafn_check(dp, bp) #endif static void xfs_dir2_leafn_moveents(xfs_da_args_t *args, xfs_dabuf_t *bp_s, int start_s, xfs_dabuf_t *bp_d, int start_d, @@ -334,7 +359,7 @@ xfs_dir2_leafn_check( xfs_dabuf_t *bp) /* leaf buffer */ { int i; /* leaf index */ - xfs_dir2_leaf_t *leaf; /* leaf structure */ + xfs_dir2_leaf_t *leaf; /* leaf structure */ xfs_mount_t *mp; /* filesystem mount point */ int stale; /* count of stale leaves */ @@ -363,7 +388,7 @@ xfs_dir2_leafn_lasthash( xfs_dabuf_t *bp, /* leaf buffer */ int *count) /* count of entries in leaf */ { - xfs_dir2_leaf_t *leaf; /* leaf structure */ + xfs_dir2_leaf_t *leaf; /* leaf structure */ leaf = bp->data; ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); @@ -624,8 +649,8 @@ xfs_dir2_leafn_moveents( int start_d, /* destination leaf index */ int count) /* count of leaves to copy */ { - xfs_dir2_leaf_t *leaf_d; /* destination leaf structure */ - xfs_dir2_leaf_t *leaf_s; /* source leaf structure */ + xfs_dir2_leaf_t *leaf_d; /* destination leaf structure */ + xfs_dir2_leaf_t *leaf_s; /* source leaf structure */ int stale; /* count stale leaves copied */ xfs_trans_t *tp; /* transaction pointer */ @@ -702,8 +727,8 @@ xfs_dir2_leafn_order( xfs_dabuf_t *leaf1_bp, /* leaf1 buffer */ xfs_dabuf_t *leaf2_bp) /* leaf2 buffer */ { - xfs_dir2_leaf_t *leaf1; /* leaf1 structure */ - xfs_dir2_leaf_t *leaf2; /* leaf2 structure */ + xfs_dir2_leaf_t *leaf1; /* leaf1 structure */ + xfs_dir2_leaf_t *leaf2; /* leaf2 structure */ leaf1 = leaf1_bp->data; leaf2 = leaf2_bp->data; @@ -782,7 +807,7 @@ xfs_dir2_leafn_rebalance( else isleft = 1; /* - * Calculate moved entry count. Positive means left-to-right, + * Calculate moved entry count. Positive means left-to-right, * negative means right-to-left. Then move the entries. */ count = INT_GET(leaf1->hdr.count, ARCH_CONVERT) - mid + (isleft == 0); @@ -892,7 +917,7 @@ xfs_dir2_leafn_remove( xfs_dabuf_t *fbp; /* freeblock buffer */ xfs_dir2_db_t fdb; /* freeblock block number */ int findex; /* index in freeblock entries */ - xfs_dir2_free_t *free; /* freeblock structure */ + xfs_dir2_free_t *free; /* freeblock structure */ int logfree; /* need to log free entry */ /* @@ -1368,7 +1393,7 @@ xfs_dir2_node_addname_int( foundhole = 0; /* * If we came in with a freespace block that means that lookup - * found an entry with our hash value. This is the freespace + * found an entry with our hash value. This is the freespace * block for that data entry. */ if (fblk) { @@ -1424,7 +1449,7 @@ xfs_dir2_node_addname_int( } /* * While we haven't identified a data block, search the freeblock - * data for a good data block. If we find a null freeblock entry, + * data for a good data block. If we find a null freeblock entry, * indicating a hole in the data blocks, remember that. */ while (dbno == -1) { diff --git a/fs/xfs/xfs_dir2_node.h b/fs/xfs/xfs_dir2_node.h index af63d6a05ae6..96db420c7c5c 100644 --- a/fs/xfs/xfs_dir2_node.h +++ b/fs/xfs/xfs_dir2_node.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_NODE_H__ -#define __XFS_DIR2_NODE_H__ +#define __XFS_DIR2_NODE_H__ /* * Directory version 2, btree node format structures @@ -51,17 +51,17 @@ struct xfs_trans; /* * Offset of the freespace index. */ -#define XFS_DIR2_FREE_SPACE 2 -#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE) -#define XFS_DIR2_FREE_FIRSTDB(mp) \ +#define XFS_DIR2_FREE_SPACE 2 +#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE) +#define XFS_DIR2_FREE_FIRSTDB(mp) \ XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_FREE_OFFSET) -#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */ +#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */ /* * Structures. */ -typedef struct xfs_dir2_free_hdr { +typedef struct xfs_dir2_free_hdr { __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */ __int32_t firstdb; /* db of first entry */ __int32_t nvalid; /* count of valid entries */ @@ -73,7 +73,7 @@ typedef struct xfs_dir2_free { xfs_dir2_data_off_t bests[1]; /* best free counts */ /* unused entries are -1 */ } xfs_dir2_free_t; -#define XFS_DIR2_MAX_FREE_BESTS(mp) \ +#define XFS_DIR2_MAX_FREE_BESTS(mp) \ (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \ (uint)sizeof(xfs_dir2_data_off_t)) @@ -87,9 +87,9 @@ typedef struct xfs_dir2_free { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDB) xfs_dir2_db_t xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db); -#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db) +#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db) #else -#define XFS_DIR2_DB_TO_FDB(mp,db) \ +#define XFS_DIR2_DB_TO_FDB(mp,db) \ (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp)) #endif @@ -99,9 +99,9 @@ xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDINDEX) int xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db); -#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db) +#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db) #else -#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)) +#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)) #endif /* diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c index 17fdf4f3720d..81cbda8ffec4 100644 --- a/fs/xfs/xfs_dir2_sf.c +++ b/fs/xfs/xfs_dir2_sf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,7 +35,32 @@ * Shortform directory implementation for v2 directories. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_error.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_trace.h" /* * Prototypes for internal functions. @@ -52,7 +77,7 @@ static int xfs_dir2_sf_addname_pick(xfs_da_args_t *args, int objchange, #ifdef DEBUG static void xfs_dir2_sf_check(xfs_da_args_t *args); #else -#define xfs_dir2_sf_check(args) +#define xfs_dir2_sf_check(args) #endif /* DEBUG */ #if XFS_BIG_FILESYSTEMS static void xfs_dir2_sf_toino4(xfs_da_args_t *args); @@ -165,7 +190,7 @@ xfs_dir2_block_to_sf( char *ptr; /* current data pointer */ xfs_dir2_sf_entry_t *sfep; /* shortform entry */ xfs_dir2_sf_t *sfp; /* shortform structure */ - xfs_ino_t temp; + xfs_ino_t temp; xfs_dir2_trace_args_sb("block_to_sf", args, size, bp); dp = args->dp; @@ -477,7 +502,7 @@ xfs_dir2_sf_addname_hard( } /* * Get rid of the old directory, then allocate space for - * the new one. We do this so xfs_idata_realloc won't copy + * the new one. We do this so xfs_idata_realloc won't copy * the data. */ xfs_idata_realloc(dp, -old_isize, XFS_DATA_FORK); diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h index 4a9ef05678cc..3fea83ecd59c 100644 --- a/fs/xfs/xfs_dir2_sf.h +++ b/fs/xfs/xfs_dir2_sf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR2_SF_H__ -#define __XFS_DIR2_SF_H__ +#define __XFS_DIR2_SF_H__ /* * Directory layout when stored internal to an inode. @@ -50,18 +50,18 @@ struct xfs_trans; /* * Maximum size of a shortform directory. */ -#define XFS_DIR2_SF_MAX_SIZE \ +#define XFS_DIR2_SF_MAX_SIZE \ (XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \ (uint)sizeof(xfs_agino_t)) /* * Inode number stored as 8 8-bit values. */ -typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; +typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; -#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \ +#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \ (xfs_ino_t)(DIRINO_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO8(di) \ +#define XFS_DIR2_SF_GET_INO8(di) \ XFS_DIR2_SF_GET_INO8_ARCH(di,ARCH_NOCONVERT) /* @@ -70,16 +70,16 @@ typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; * fit in 32 bits. */ typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t; -#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \ +#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \ (xfs_ino_t)(DIRINO4_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO4(di) \ +#define XFS_DIR2_SF_GET_INO4(di) \ XFS_DIR2_SF_GET_INO4_ARCH(di,ARCH_NOCONVERT) typedef union { - xfs_dir2_ino8_t i8; - xfs_dir2_ino4_t i4; + xfs_dir2_ino8_t i8; + xfs_dir2_ino4_t i4; } xfs_dir2_inou_t; -#define XFS_DIR2_MAX_SHORT_INUM ((xfs_ino_t)0xffffffffULL) +#define XFS_DIR2_MAX_SHORT_INUM ((xfs_ino_t)0xffffffffULL) /* * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. @@ -115,9 +115,9 @@ typedef struct xfs_dir2_sf { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_HDR_SIZE) int xfs_dir2_sf_hdr_size(int i8count); -#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) +#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) #else -#define XFS_DIR2_SF_HDR_SIZE(i8count) \ +#define XFS_DIR2_SF_HDR_SIZE(i8count) \ ((uint)sizeof(xfs_dir2_sf_hdr_t) - \ ((i8count) == 0) * \ ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) @@ -125,20 +125,20 @@ int xfs_dir2_sf_hdr_size(int i8count); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_INUMBERP) xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep); -#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) +#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) #else -#define XFS_DIR2_SF_INUMBERP(sfep) \ +#define XFS_DIR2_SF_INUMBERP(sfep) \ ((xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER) xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from, xfs_arch_t arch); -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ +#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ xfs_dir2_sf_get_inumber_arch(sfp, from, arch) #else -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ +#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ ((sfp)->hdr.i8count == 0 ? \ (xfs_intino_t)XFS_DIR2_SF_GET_INO4_ARCH(*(from), arch) : \ (xfs_intino_t)XFS_DIR2_SF_GET_INO8_ARCH(*(from), arch)) @@ -147,10 +147,10 @@ xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *f #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) void xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from, xfs_dir2_inou_t *to, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ +#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ xfs_dir2_sf_put_inumber_arch(sfp,from,to,arch) #else -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ +#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ if ((sfp)->hdr.i8count == 0) { \ DIRINO4_COPY_ARCH(from,to,arch); \ } else { \ @@ -162,20 +162,20 @@ void xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from, xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset_arch(xfs_dir2_sf_entry_t *sfep, xfs_arch_t arch); xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep); -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ +#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ xfs_dir2_sf_get_offset_arch(sfep,arch) #else -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ +#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ INT_GET_UNALIGNED_16_ARCH(&(sfep)->offset.i,arch) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET) void xfs_dir2_sf_put_offset_arch(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ +#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ xfs_dir2_sf_put_offset_arch(sfep,off,arch) #else -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ +#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ INT_SET_UNALIGNED_16_ARCH(&(sfep)->offset.i,off,arch) #endif diff --git a/fs/xfs/xfs_dir2_trace.c b/fs/xfs/xfs_dir2_trace.c index 3e517abee119..4468c299a610 100644 --- a/fs/xfs/xfs_dir2_trace.c +++ b/fs/xfs/xfs_dir2_trace.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,8 +34,20 @@ * xfs_dir2_trace.c * Tracing for xfs v2 directories. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_trace.h" #ifdef DEBUG ktrace_t *xfs_dir2_trace_buf; diff --git a/fs/xfs/xfs_dir2_trace.h b/fs/xfs/xfs_dir2_trace.h index 96118532bbbf..2bec08f05e47 100644 --- a/fs/xfs/xfs_dir2_trace.h +++ b/fs/xfs/xfs_dir2_trace.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -48,17 +48,17 @@ struct xfs_da_args; #undef XFS_DIR2_TRACE #endif /* !DEBUG */ -#define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */ -#define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */ +#define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */ +#define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */ -#define XFS_DIR2_KTRACE_ARGS 1 /* args only */ -#define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */ -#define XFS_DIR2_KTRACE_ARGS_BB 3 /* args + 2 buffers */ -#define XFS_DIR2_KTRACE_ARGS_DB 4 /* args, db, buffer */ -#define XFS_DIR2_KTRACE_ARGS_I 5 /* args, inum */ -#define XFS_DIR2_KTRACE_ARGS_S 6 /* args, int */ -#define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */ -#define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */ +#define XFS_DIR2_KTRACE_ARGS 1 /* args only */ +#define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */ +#define XFS_DIR2_KTRACE_ARGS_BB 3 /* args + 2 buffers */ +#define XFS_DIR2_KTRACE_ARGS_DB 4 /* args, db, buffer */ +#define XFS_DIR2_KTRACE_ARGS_I 5 /* args, inum */ +#define XFS_DIR2_KTRACE_ARGS_S 6 /* args, int */ +#define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */ +#define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */ #ifdef XFS_DIR2_TRACE @@ -79,14 +79,14 @@ void xfs_dir2_trace_args_sb(char *where, struct xfs_da_args *args, int s, #else /* XFS_DIR2_TRACE */ -#define xfs_dir2_trace_args(where, args) -#define xfs_dir2_trace_args_b(where, args, bp) -#define xfs_dir2_trace_args_bb(where, args, lbp, dbp) -#define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) -#define xfs_dir2_trace_args_db(where, args, db, bp) -#define xfs_dir2_trace_args_i(where, args, i) -#define xfs_dir2_trace_args_s(where, args, s) -#define xfs_dir2_trace_args_sb(where, args, s, bp) +#define xfs_dir2_trace_args(where, args) +#define xfs_dir2_trace_args_b(where, args, bp) +#define xfs_dir2_trace_args_bb(where, args, lbp, dbp) +#define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) +#define xfs_dir2_trace_args_db(where, args, db, bp) +#define xfs_dir2_trace_args_i(where, args, i) +#define xfs_dir2_trace_args_s(where, args, s) +#define xfs_dir2_trace_args_sb(where, args, s, bp) #endif /* XFS_DIR2_TRACE */ diff --git a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c index 40273a5c5574..a085b9870058 100644 --- a/fs/xfs/xfs_dir_leaf.c +++ b/fs/xfs/xfs_dir_leaf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,8 +36,33 @@ * GROT: figure out how to recover gracefully when bmap returns ENOSPC. */ -#include <xfs.h> - +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_error.h" /* * xfs_dir_leaf.c @@ -461,7 +486,7 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp, ((char *)sfe >= ((char *)sf + dp->i_df.if_bytes)) || (sfe->namelen >= MAXNAMELEN))) { xfs_dir_trace_g_du("sf: corrupted", dp, uio); - XFS_CORRUPTION_ERROR("xfs_dir_shortform_getdents", + XFS_CORRUPTION_ERROR("xfs_dir_shortform_getdents", XFS_ERRLEVEL_LOW, mp, sfe); kmem_free(sbuf, sbsize); return XFS_ERROR(EFSCORRUPTED); @@ -924,7 +949,7 @@ xfs_dir_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args, int index) return(error); /* * After compaction, the block is guaranteed to have only one - * free region, in freemap[0]. If it is not big enough, give up. + * free region, in freemap[0]. If it is not big enough, give up. */ if (INT_GET(hdr->freemap[0].size, ARCH_CONVERT) < (entsize + (uint)sizeof(xfs_dir_leaf_entry_t))) @@ -1649,7 +1674,7 @@ xfs_dir_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, memset(tmpbuffer, 0, state->blocksize); tmp_leaf = (xfs_dir_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; - tmp_hdr->info = save_hdr->info; /* struct copy */ + tmp_hdr->info = save_hdr->info; /* struct copy */ INT_ZERO(tmp_hdr->count, ARCH_CONVERT); INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) @@ -1978,7 +2003,7 @@ xfs_dir_leaf_getdents_int( ((char *)namest < (char *)leaf) || ((char *)namest >= (char *)leaf + XFS_LBSIZE(mp)) || (entry->namelen >= MAXNAMELEN))) { - XFS_CORRUPTION_ERROR("xfs_dir_leaf_getdents_int(1)", + XFS_CORRUPTION_ERROR("xfs_dir_leaf_getdents_int(1)", XFS_ERRLEVEL_LOW, mp, leaf); xfs_dir_trace_g_du("leaf: corrupted", dp, uio); return XFS_ERROR(EFSCORRUPTED); @@ -2121,7 +2146,7 @@ xfs_dir_leaf_getdents_int( * of same hashval entries. For this, lastoffset is set * to the first in the run of equal hashvals so we don't * include any entries unless we can include all entries - * that share the same hashval. Hopefully the buffer + * that share the same hashval. Hopefully the buffer * provided is big enough to handle it (see pv763517). */ #if (BITS_PER_LONG == 32) diff --git a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h index ddcc9e065940..ad74774011d2 100644 --- a/fs/xfs/xfs_dir_leaf.h +++ b/fs/xfs/xfs_dir_leaf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR_LEAF_H__ -#define __XFS_DIR_LEAF_H__ +#define __XFS_DIR_LEAF_H__ /* * Directory layout, internal structure, access macros, etc. @@ -38,7 +38,7 @@ * Large directories are structured around Btrees where all the data * elements are in the leaf nodes. Filenames are hashed into an int, * then that int is used as the index into the Btree. Since the hashval - * of a filename may not be unique, we may have duplicate keys. The + * of a filename may not be unique, we may have duplicate keys. The * internal links in the Btree are logical block offsets into the file. */ @@ -60,8 +60,8 @@ struct xfs_trans; /* * This is the structure of the leaf nodes in the Btree. * - * Struct leaf_entry's are packed from the top. Names grow from the bottom - * but are not packed. The freemap contains run-length-encoded entries + * Struct leaf_entry's are packed from the top. Names grow from the bottom + * but are not packed. The freemap contains run-length-encoded entries * for the free bytes after the leaf_entry's, but only the N largest such, * smaller runs are dropped. When the freemap doesn't show enough space * for an allocation, we compact the namelist area and try again. If we @@ -114,7 +114,7 @@ typedef struct xfs_dir_leaf_name xfs_dir_leaf_name_t; * Length of name for which a 512-byte block filesystem * can get a double split. */ -#define XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN \ +#define XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN \ (512 - (uint)sizeof(xfs_dir_leaf_hdr_t) - \ (uint)sizeof(xfs_dir_leaf_entry_t) * 2 - \ (uint)sizeof(xfs_dir_leaf_name_t) * 2 - (MAXNAMELEN - 2) + 1 + 1) @@ -137,12 +137,12 @@ typedef union { } s; } xfs_dircook_t; -#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ +#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash)) -#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \ +#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \ DIRINO_GET_ARCH(&(di),arch) -#define XFS_GET_DIR_INO(mp,di) \ +#define XFS_GET_DIR_INO(mp,di) \ XFS_GET_DIR_INO_ARCH(mp,di,ARCH_NOCONVERT) typedef struct xfs_dir_put_args diff --git a/fs/xfs/xfs_dir_sf.h b/fs/xfs/xfs_dir_sf.h index 10c60645f1fc..24b117a9c96a 100644 --- a/fs/xfs/xfs_dir_sf.h +++ b/fs/xfs/xfs_dir_sf.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_DIR_SF_H__ -#define __XFS_DIR_SF_H__ +#define __XFS_DIR_SF_H__ /* * Directory layout when stored internal to an inode. @@ -65,7 +65,7 @@ typedef struct xfs_dir_sf_entry xfs_dir_sf_entry_t; /* * We generate this then sort it, so that readdirs are returned in - * hash-order. Else seekdir won't work. + * hash-order. Else seekdir won't work. */ typedef struct xfs_dir_sf_sort { __uint8_t entno; /* .=0, ..=1, else entry# + 2 */ @@ -79,20 +79,20 @@ typedef struct xfs_dir_sf_sort { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) void xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch) -#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) +#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch) +#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) #else -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) +#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO) void xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) +#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch) +#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) #else -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) +#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME) int xfs_dir_sf_entsize_byname(int len); @@ -127,7 +127,7 @@ int xfs_dir_sf_allfit(int count, int totallen); #endif #ifdef XFS_ALL_TRACE -#define XFS_DIR_TRACE +#define XFS_DIR_TRACE #endif #if !defined(DEBUG) @@ -144,17 +144,17 @@ struct xfs_dinode; struct xfs_dir_leafblock; struct xfs_dir_leaf_entry; -#define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */ +#define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */ /* * Trace record types. */ -#define XFS_DIR_KTRACE_G_DU 1 /* dp, uio */ -#define XFS_DIR_KTRACE_G_DUB 2 /* dp, uio, bno */ -#define XFS_DIR_KTRACE_G_DUN 3 /* dp, uio, node */ -#define XFS_DIR_KTRACE_G_DUL 4 /* dp, uio, leaf */ -#define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */ -#define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */ +#define XFS_DIR_KTRACE_G_DU 1 /* dp, uio */ +#define XFS_DIR_KTRACE_G_DUB 2 /* dp, uio, bno */ +#define XFS_DIR_KTRACE_G_DUN 3 /* dp, uio, node */ +#define XFS_DIR_KTRACE_G_DUL 4 /* dp, uio, leaf */ +#define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */ +#define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */ #if defined(XFS_DIR_TRACE) @@ -177,12 +177,12 @@ void xfs_dir_trace_enter(int type, char *where, __psunsigned_t a8, __psunsigned_t a9, __psunsigned_t a10, __psunsigned_t a11); #else -#define xfs_dir_trace_g_du(w,d,u) -#define xfs_dir_trace_g_dub(w,d,u,b) -#define xfs_dir_trace_g_dun(w,d,u,n) -#define xfs_dir_trace_g_dul(w,d,u,l) -#define xfs_dir_trace_g_due(w,d,u,e) -#define xfs_dir_trace_g_duc(w,d,u,c) +#define xfs_dir_trace_g_du(w,d,u) +#define xfs_dir_trace_g_dub(w,d,u,b) +#define xfs_dir_trace_g_dun(w,d,u,n) +#define xfs_dir_trace_g_dul(w,d,u,l) +#define xfs_dir_trace_g_due(w,d,u,e) +#define xfs_dir_trace_g_duc(w,d,u,c) #endif /* DEBUG */ #endif /* __XFS_DIR_SF_H__ */ diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h index 3c3eac379e82..718f0517b6e3 100644 --- a/fs/xfs/xfs_dmapi.h +++ b/fs/xfs/xfs_dmapi.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,9 +35,9 @@ /* Values used to define the on-disk version of dm_attrname_t. All * on-disk attribute names start with the 8-byte string "SGI_DMI_". * - * In the on-disk inode, DMAPI attribute names consist of the user-provided - * name with the DMATTR_PREFIXSTRING pre-pended. This string must NEVER be - * changed. + * In the on-disk inode, DMAPI attribute names consist of the user-provided + * name with the DMATTR_PREFIXSTRING pre-pended. This string must NEVER be + * changed. */ #define DMATTR_PREFIXLEN 8 @@ -80,13 +80,13 @@ typedef enum { #define HAVE_DM_RIGHT_T /* Defines for determining if an event message should be sent. */ -#define DM_EVENT_ENABLED(vfsp, ip, event) ( \ +#define DM_EVENT_ENABLED(vfsp, ip, event) ( \ unlikely ((vfsp)->vfs_flag & VFS_DMI) && \ ( ((ip)->i_d.di_dmevmask & (1 << event)) || \ ((ip)->i_mount->m_dmevmask & (1 << event)) ) \ ) -#define DM_EVENT_ENABLED_IO(vfsp, io, event) ( \ +#define DM_EVENT_ENABLED_IO(vfsp, io, event) ( \ unlikely ((vfsp)->vfs_flag & VFS_DMI) && \ ( ((io)->io_dmevmask & (1 << event)) || \ ((io)->io_mount->m_dmevmask & (1 << event)) ) \ @@ -111,18 +111,18 @@ typedef enum { (1 << DM_EVENT_DESTROY) ) /* Events valid in dm_set_eventlist() when called with a file handle for - a regular file or a symlink. These events are persistent. + a regular file or a symlink. These events are persistent. */ -#define DM_XFS_VALID_FILE_EVENTS ( \ +#define DM_XFS_VALID_FILE_EVENTS ( \ (1 << DM_EVENT_ATTRIBUTE) | \ (1 << DM_EVENT_DESTROY) ) /* Events valid in dm_set_eventlist() when called with a file handle for - a directory. These events are persistent. + a directory. These events are persistent. */ -#define DM_XFS_VALID_DIRECTORY_EVENTS ( \ +#define DM_XFS_VALID_DIRECTORY_EVENTS ( \ (1 << DM_EVENT_CREATE) | \ (1 << DM_EVENT_POSTCREATE) | \ (1 << DM_EVENT_REMOVE) | \ @@ -137,7 +137,7 @@ typedef enum { (1 << DM_EVENT_DESTROY) ) /* Events supported by the XFS filesystem. */ -#define DM_XFS_SUPPORTED_EVENTS ( \ +#define DM_XFS_SUPPORTED_EVENTS ( \ (1 << DM_EVENT_MOUNT) | \ (1 << DM_EVENT_PREUNMOUNT) | \ (1 << DM_EVENT_UNMOUNT) | \ @@ -189,4 +189,4 @@ extern struct bhv_vfsops xfs_dmops; extern int dmapi_init(void); extern void dmapi_uninit(void); -#endif /* __XFS_DMAPI_H__ */ +#endif /* __XFS_DMAPI_H__ */ diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c index 7448bac1e642..03e15f07bd80 100644 --- a/fs/xfs/xfs_dmops.c +++ b/fs/xfs/xfs_dmops.c @@ -29,7 +29,20 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" + #ifndef CONFIG_XFS_DMAPI xfs_dmops_t xfs_dmcore_xfs = { diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index e926de8fa779..bb31038a7c41 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,26 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_sb.h" +#include "xfs_trans.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_utils.h" +#include "xfs_error.h" #ifdef DEBUG @@ -63,7 +81,7 @@ xfs_error_trap(int e) #if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) int xfs_etest[XFS_NUM_INJECT_ERROR]; -int64_t xfs_etest_fsid[XFS_NUM_INJECT_ERROR]; +int64_t xfs_etest_fsid[XFS_NUM_INJECT_ERROR]; char * xfs_etest_fsname[XFS_NUM_INJECT_ERROR]; void @@ -258,11 +276,11 @@ xfs_error_report( if (mp != NULL) { xfs_cmn_err(XFS_PTAG_ERROR_REPORT, CE_ALERT, mp, - "XFS internal error %s at line %d of file %s. Caller 0x%x\n", + "XFS internal error %s at line %d of file %s. Caller 0x%p\n", tag, linenum, fname, ra); } else { cmn_err(CE_ALERT, - "XFS internal error %s at line %d of file %s. Caller 0x%x\n", + "XFS internal error %s at line %d of file %s. Caller 0x%p\n", tag, linenum, fname, ra); } @@ -276,7 +294,7 @@ xfs_hex_dump(void *p, int length) __uint8_t *uip = (__uint8_t*)p; int i; char sbuf[128], *s; - + s = sbuf; *s = '\0'; for (i=0; i<length; i++, uip++) { diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h index 87b380219480..4d96abd0846a 100644 --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,27 +29,27 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_ERROR_H__ -#define __XFS_ERROR_H__ +#ifndef __XFS_ERROR_H__ +#define __XFS_ERROR_H__ #define prdev(fmt,dev,args...) \ printk("XFS: device 0x%x- " fmt "\n", (unsigned)dev, ## args) #define XFS_ERECOVER 1 /* Failure to recover log */ #define XFS_ELOGSTAT 2 /* Failure to stat log in user space */ -#define XFS_ENOLOGSPACE 3 /* Reservation too large */ +#define XFS_ENOLOGSPACE 3 /* Reservation too large */ #define XFS_ENOTSUP 4 /* Operation not supported */ -#define XFS_ENOLSN 5 /* Can't find the lsn you asked for */ +#define XFS_ENOLSN 5 /* Can't find the lsn you asked for */ #define XFS_ENOTFOUND 6 #define XFS_ENOTXFS 7 /* Not XFS filesystem */ #ifdef DEBUG -#define XFS_ERROR_NTRAP 10 +#define XFS_ERROR_NTRAP 10 extern int xfs_etrap[XFS_ERROR_NTRAP]; extern int xfs_error_trap(int); -#define XFS_ERROR(e) xfs_error_trap(e) +#define XFS_ERROR(e) xfs_error_trap(e) #else -#define XFS_ERROR(e) (e) +#define XFS_ERROR(e) (e) #endif struct xfs_mount; @@ -98,15 +98,15 @@ xfs_hex_dump(void *p, int length); #define XFS_ERRTAG_IFLUSH_4 4 #define XFS_ERRTAG_IFLUSH_5 5 #define XFS_ERRTAG_IFLUSH_6 6 -#define XFS_ERRTAG_DA_READ_BUF 7 -#define XFS_ERRTAG_BTREE_CHECK_LBLOCK 8 -#define XFS_ERRTAG_BTREE_CHECK_SBLOCK 9 -#define XFS_ERRTAG_ALLOC_READ_AGF 10 -#define XFS_ERRTAG_IALLOC_READ_AGI 11 -#define XFS_ERRTAG_ITOBP_INOTOBP 12 -#define XFS_ERRTAG_IUNLINK 13 -#define XFS_ERRTAG_IUNLINK_REMOVE 14 -#define XFS_ERRTAG_DIR_INO_VALIDATE 15 +#define XFS_ERRTAG_DA_READ_BUF 7 +#define XFS_ERRTAG_BTREE_CHECK_LBLOCK 8 +#define XFS_ERRTAG_BTREE_CHECK_SBLOCK 9 +#define XFS_ERRTAG_ALLOC_READ_AGF 10 +#define XFS_ERRTAG_IALLOC_READ_AGI 11 +#define XFS_ERRTAG_ITOBP_INOTOBP 12 +#define XFS_ERRTAG_IUNLINK 13 +#define XFS_ERRTAG_IUNLINK_REMOVE 14 +#define XFS_ERRTAG_DIR_INO_VALIDATE 15 #define XFS_ERRTAG_BULKSTAT_READ_CHUNK 16 #define XFS_ERRTAG_IODONE_IOERR 17 #define XFS_ERRTAG_STRATREAD_IOERR 18 @@ -145,7 +145,7 @@ xfs_hex_dump(void *p, int length); extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); void xfs_error_test_init(void); -#define XFS_NUM_INJECT_ERROR 10 +#define XFS_NUM_INJECT_ERROR 10 #ifdef __ANSI_CPP__ #define XFS_TEST_ERROR(expr, mp, tag, rf) \ diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index 3ec3cbf89b03..5eafd5b63211 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,7 +35,20 @@ * and xfs_efd_log_item items. */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_buf_item.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_extfree_item.h" kmem_zone_t *xfs_efi_zone; @@ -213,7 +226,7 @@ xfs_efi_item_unlock(xfs_efi_log_item_t *efip) /* * The EFI is logged only once and cannot be moved in the log, so * simply return the lsn at which it's been logged. The canceled - * flag is not paid any attention here. Checking for that is delayed + * flag is not paid any attention here. Checking for that is delayed * until the EFI is unpinned. */ /*ARGSUSED*/ @@ -225,8 +238,8 @@ xfs_efi_item_committed(xfs_efi_log_item_t *efip, xfs_lsn_t lsn) /* * This is called when the transaction logging the EFI is aborted. - * Free up the EFI and return. No need to clean up the slot for - * the item in the transaction. That was done by the unpin code + * Free up the EFI and return. No need to clean up the slot for + * the item in the transaction. That was done by the unpin code * which is called prior to this routine in the abort/fs-shutdown path. */ STATIC void @@ -247,7 +260,7 @@ xfs_efi_item_abort(xfs_efi_log_item_t *efip) } /* - * There isn't much you can do to push on an efi item. It is simply + * There isn't much you can do to push on an efi item. It is simply * stuck waiting for all of its corresponding efd items to be * committed to disk. */ @@ -327,7 +340,7 @@ xfs_efi_init(xfs_mount_t *mp, /* * This is called by the efd item code below to release references to - * the given efi item. Each efd calls this with the number of + * the given efi item. Each efd calls this with the number of * extents that it has logged, and when the sum of these reaches * the total number of extents logged by this efi item we can free * the efi item. @@ -546,7 +559,7 @@ xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn) * The transaction of which this EFD is a part has been aborted. * Inform its companion EFI of this fact and then clean up after * ourselves. No need to clean up the slot for the item in the - * transaction. That was done by the unpin code which is called + * transaction. That was done by the unpin code which is called * prior to this routine in the abort/fs-shutdown path. */ STATIC void @@ -575,7 +588,7 @@ xfs_efd_item_abort(xfs_efd_log_item_t *efdp) } /* - * There isn't much you can do to push on an efd item. It is simply + * There isn't much you can do to push on an efd item. It is simply * stuck waiting for the log to be flushed to disk. */ /*ARGSUSED*/ @@ -627,7 +640,7 @@ struct xfs_item_ops xfs_efd_item_ops = { */ xfs_efd_log_item_t * xfs_efd_init(xfs_mount_t *mp, - xfs_efi_log_item_t *efip, + xfs_efi_log_item_t *efip, uint nextents) { diff --git a/fs/xfs/xfs_extfree_item.h b/fs/xfs/xfs_extfree_item.h index d3bf293c2b96..7122d6101d15 100644 --- a/fs/xfs/xfs_extfree_item.h +++ b/fs/xfs/xfs_extfree_item.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,8 +29,8 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_EXTFREE_ITEM_H__ -#define __XFS_EXTFREE_ITEM_H__ +#ifndef __XFS_EXTFREE_ITEM_H__ +#define __XFS_EXTFREE_ITEM_H__ struct xfs_mount; struct kmem_zone; @@ -42,7 +42,7 @@ typedef struct xfs_extent { /* * This is the structure used to lay out an efi log item in the - * log. The efi_extents field is a variable size array whose + * log. The efi_extents field is a variable size array whose * size is given by efi_nextents. */ typedef struct xfs_efi_log_format { @@ -50,12 +50,12 @@ typedef struct xfs_efi_log_format { unsigned short efi_size; /* size of this item */ uint efi_nextents; /* # extents to free */ __uint64_t efi_id; /* efi identifier */ - xfs_extent_t efi_extents[1]; /* array of extents to free */ + xfs_extent_t efi_extents[1]; /* array of extents to free */ } xfs_efi_log_format_t; /* * This is the structure used to lay out an efd log item in the - * log. The efd_extents array is a variable size array whose + * log. The efd_extents array is a variable size array whose * size is given by efd_nextents; */ typedef struct xfs_efd_log_format { @@ -63,7 +63,7 @@ typedef struct xfs_efd_log_format { unsigned short efd_size; /* size of this item */ uint efd_nextents; /* # of extents freed */ __uint64_t efd_efi_id; /* id of corresponding efi */ - xfs_extent_t efd_extents[1]; /* array of extents freed */ + xfs_extent_t efd_extents[1]; /* array of extents freed */ } xfs_efd_log_format_t; @@ -72,14 +72,14 @@ typedef struct xfs_efd_log_format { /* * Max number of extents in fast allocation path. */ -#define XFS_EFI_MAX_FAST_EXTENTS 16 +#define XFS_EFI_MAX_FAST_EXTENTS 16 /* * Define EFI flags. */ -#define XFS_EFI_RECOVERED 0x1 -#define XFS_EFI_COMMITTED 0x2 -#define XFS_EFI_CANCELED 0x4 +#define XFS_EFI_RECOVERED 0x1 +#define XFS_EFI_COMMITTED 0x2 +#define XFS_EFI_CANCELED 0x4 /* * This is the "extent free intention" log item. It is used @@ -109,7 +109,7 @@ typedef struct xfs_efd_log_item { /* * Max number of extents in fast allocation path. */ -#define XFS_EFD_MAX_FAST_EXTENTS 16 +#define XFS_EFD_MAX_FAST_EXTENTS 16 extern struct kmem_zone *xfs_efi_zone; extern struct kmem_zone *xfs_efd_zone; diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index b3f6e0463368..93b956695f7a 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,37 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_ag.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_error.h" +#include "xfs_alloc.h" +#include "xfs_ialloc.h" +#include "xfs_fsops.h" +#include "xfs_itable.h" +#include "xfs_rw.h" +#include "xfs_trans_space.h" +#include "xfs_rtalloc.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_inode_item.h" /* * File system operations @@ -473,12 +503,12 @@ xfs_fs_counts( int xfs_reserve_blocks( - xfs_mount_t *mp, - __uint64_t *inval, - xfs_fsop_resblks_t *outval) + xfs_mount_t *mp, + __uint64_t *inval, + xfs_fsop_resblks_t *outval) { - __uint64_t lcounter, delta; - __uint64_t request; + __uint64_t lcounter, delta; + __uint64_t request; unsigned long s; /* If inval is null, report current values and return */ diff --git a/fs/xfs/xfs_fsops.h b/fs/xfs/xfs_fsops.h index c0caa7353e51..76adb1e30bcb 100644 --- a/fs/xfs/xfs_fsops.h +++ b/fs/xfs/xfs_fsops.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_FSOPS_H__ -#define __XFS_FSOPS_H__ +#define __XFS_FSOPS_H__ int xfs_fs_geometry( diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 405f2e7132fe..1cec842d1d01 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,33 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_alloc.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_error.h" /* * Log specified fields for the inode given by bp and off. @@ -111,9 +136,9 @@ xfs_ialloc_ag_alloc( int *alloc) { xfs_agi_t *agi; /* allocation group header */ - xfs_alloc_arg_t args; /* allocation argument structure */ + xfs_alloc_arg_t args; /* allocation argument structure */ int blks_per_cluster; /* fs blocks per inode cluster */ - xfs_btree_cur_t *cur; /* inode btree cursor */ + xfs_btree_cur_t *cur; /* inode btree cursor */ xfs_daddr_t d; /* disk addr of buffer */ int error; xfs_buf_t *fbuf; /* new free inodes' buffer */ @@ -129,7 +154,7 @@ xfs_ialloc_ag_alloc( static xfs_timestamp_t ztime; /* zero xfs timestamp */ int isaligned; /* inode allocation at stripe unit */ /* boundary */ - xfs_dinode_core_t dic; /* a dinode_core to copy to new */ + xfs_dinode_core_t dic; /* a dinode_core to copy to new */ /* inodes */ args.tp = tp; @@ -202,7 +227,7 @@ xfs_ialloc_ag_alloc( else args.alignment = 1; if ((error = xfs_alloc_vextent(&args))) - return error; + return error; } if (args.fsbno == NULLFSBLOCK) { @@ -353,7 +378,7 @@ xfs_ialloc_next_ag( /* * Select an allocation group to look for a free inode in, based on the parent - * inode and then mode. Return the allocation group buffer. + * inode and then mode. Return the allocation group buffer. */ STATIC xfs_buf_t * /* allocation group buffer */ xfs_ialloc_ag_select( @@ -479,10 +504,10 @@ nextag: * The arguments IO_agbp and alloc_done are defined to work within * the constraint of one allocation per transaction. * xfs_dialloc() is designed to be called twice if it has to do an - * allocation to make more free inodes. On the first call, + * allocation to make more free inodes. On the first call, * IO_agbp should be set to NULL. If an inode is available, * i.e., xfs_dialloc() did not need to do an allocation, an inode - * number is returned. In this case, IO_agbp would be set to the + * number is returned. In this case, IO_agbp would be set to the * current ag_buf and alloc_done set to false. * If an allocation needed to be done, xfs_dialloc would return * the current ag_buf in IO_agbp and set alloc_done to true. @@ -493,7 +518,7 @@ nextag: * guaranteed to have a free inode available. * * Once we successfully pick an inode its number is returned and the - * on-disk data structures are updated. The inode itself is not read + * on-disk data structures are updated. The inode itself is not read * in, since doing so would break ordering constraints with xfs_reclaim. */ int @@ -511,7 +536,7 @@ xfs_dialloc( xfs_buf_t *agbp; /* allocation group header's buffer */ xfs_agnumber_t agno; /* allocation group number */ xfs_agi_t *agi; /* allocation group header structure */ - xfs_btree_cur_t *cur; /* inode allocation btree cursor */ + xfs_btree_cur_t *cur; /* inode allocation btree cursor */ int error; /* error return value */ int i; /* result code */ int ialloced; /* inode allocation status */ @@ -523,10 +548,10 @@ xfs_dialloc( int offset; /* index of inode in chunk */ xfs_agino_t pagino; /* parent's a.g. relative inode # */ xfs_agnumber_t pagno; /* parent's allocation group number */ - xfs_inobt_rec_t rec; /* inode allocation record */ + xfs_inobt_rec_t rec; /* inode allocation record */ xfs_agnumber_t tagno; /* testing allocation group number */ - xfs_btree_cur_t *tcur; /* temp cursor */ - xfs_inobt_rec_t trec; /* temp inode allocation record */ + xfs_btree_cur_t *tcur; /* temp cursor */ + xfs_inobt_rec_t trec; /* temp inode allocation record */ if (*IO_agbp == NULL) { @@ -930,12 +955,12 @@ xfs_difree( xfs_agino_t agino; /* inode number relative to allocation group */ xfs_agnumber_t agno; /* allocation group number */ xfs_agi_t *agi; /* allocation group header */ - xfs_btree_cur_t *cur; /* inode btree cursor */ + xfs_btree_cur_t *cur; /* inode btree cursor */ int error; /* error return value */ int i; /* result code */ xfs_mount_t *mp; /* mount structure for filesystem */ int off; /* offset of inode in inode chunk */ - xfs_inobt_rec_t rec; /* btree record */ + xfs_inobt_rec_t rec; /* btree record */ mp = tp->t_mountp; @@ -951,7 +976,7 @@ xfs_difree( return XFS_ERROR(EINVAL); } agino = XFS_INO_TO_AGINO(mp, inode); - if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { + if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { cmn_err(CE_WARN, "xfs_difree: inode != XFS_AGINO_TO_INO() (%d != %d) on %s. Returning EINVAL.", inode, XFS_AGINO_TO_INO(mp, agno, agino), mp->m_fsname); @@ -974,7 +999,7 @@ xfs_difree( up_read(&mp->m_peraglock); if (error) { cmn_err(CE_WARN, - "xfs_difree: xfs_ialloc_read_agi() returned an error %d on %s. Returning error.", + "xfs_difree: xfs_ialloc_read_agi() returned an error %d on %s. Returning error.", error, mp->m_fsname); return error; } @@ -1010,7 +1035,7 @@ xfs_difree( */ if ((error = xfs_inobt_lookup_le(cur, agino, 0, 0, &i))) { cmn_err(CE_WARN, - "xfs_difree: xfs_inobt_lookup_le returned() an error %d on %s. Returning error.", + "xfs_difree: xfs_inobt_lookup_le returned() an error %d on %s. Returning error.", error, mp->m_fsname); goto error0; } @@ -1036,7 +1061,7 @@ xfs_difree( rec.ir_freecount++; if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, rec.ir_free))) { cmn_err(CE_WARN, - "xfs_difree: xfs_inobt_update() returned an error %d on %s. Returning error.", + "xfs_difree: xfs_inobt_update() returned an error %d on %s. Returning error.", error, mp->m_fsname); goto error0; } @@ -1100,10 +1125,10 @@ xfs_dilocate( __int32_t chunk_cnt; /* count of free inodes in chunk */ xfs_inofree_t chunk_free; /* mask of free inodes in chunk */ xfs_agblock_t cluster_agbno; /* first block in inode cluster */ - xfs_btree_cur_t *cur; /* inode btree cursor */ + xfs_btree_cur_t *cur; /* inode btree cursor */ int error; /* error code */ int i; /* temp state */ - int offset; /* index of inode in its buffer */ + int offset; /* index of inode in its buffer */ int offset_agbno; /* blks from chunk start to inode */ ASSERT(ino != NULLFSINO); diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h index bc88dd9c7a77..20b38c8cdfb7 100644 --- a/fs/xfs/xfs_ialloc.h +++ b/fs/xfs/xfs_ialloc.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_IALLOC_H__ -#define __XFS_IALLOC_H__ +#define __XFS_IALLOC_H__ struct xfs_buf; struct xfs_dinode; @@ -42,15 +42,15 @@ struct xfs_trans; */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_INODES) int xfs_ialloc_inodes(struct xfs_mount *mp); -#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp) +#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp) #else -#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos) +#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_BLOCKS) xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp); -#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp) +#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp) #else -#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks) +#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks) #endif /* @@ -60,18 +60,18 @@ xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp); * around for xfs_dilocate(). We choose which one to use in * xfs_mount_int(). */ -#define XFS_INODE_BIG_CLUSTER_SIZE 8192 -#define XFS_INODE_SMALL_CLUSTER_SIZE 4096 -#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size +#define XFS_INODE_BIG_CLUSTER_SIZE 8192 +#define XFS_INODE_SMALL_CLUSTER_SIZE 4096 +#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size /* * Make an inode pointer out of the buffer/offset. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MAKE_IPTR) struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o); -#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o) +#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o) #else -#define XFS_MAKE_IPTR(mp,b,o) \ +#define XFS_MAKE_IPTR(mp,b,o) \ ((xfs_dinode_t *)(xfs_buf_offset(b, (o) << (mp)->m_sb.sb_inodelog))) #endif @@ -80,9 +80,9 @@ struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_FIND_FREE) int xfs_ialloc_find_free(xfs_inofree_t *fp); -#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp) +#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp) #else -#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp)) +#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp)) #endif @@ -99,17 +99,17 @@ int xfs_ialloc_find_free(xfs_inofree_t *fp); * * To work within the constraint of one allocation per transaction, * xfs_dialloc() is designed to be called twice if it has to do an - * allocation to make more free inodes. If an inode is + * allocation to make more free inodes. If an inode is * available without an allocation, agbp would be set to the current * agbp and alloc_done set to false. * If an allocation needed to be done, agbp would be set to the * inode header of the allocation group and alloc_done set to true. * The caller should then commit the current transaction and allocate a new - * transaction. xfs_dialloc() should then be called again with + * transaction. xfs_dialloc() should then be called again with * the agbp value returned from the previous call. * * Once we successfully pick an inode its number is returned and the - * on-disk data structures are updated. The inode itself is not read + * on-disk data structures are updated. The inode itself is not read * in, since doing so would break ordering constraints with xfs_reclaim. * * *agbp should be set to NULL on the first call, *alloc_done set to FALSE. diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c index e77969f472e1..67bead12b193 100644 --- a/fs/xfs/xfs_ialloc_btree.c +++ b/fs/xfs/xfs_ialloc_btree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,13 +30,30 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ + +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" + /* * Inode allocation management for XFS. */ -#include <xfs.h> - - /* * Prototypes for internal functions. */ @@ -70,10 +87,10 @@ xfs_inobt_delrec( int *stat) /* fail/done/go-on */ { xfs_buf_t *agbp; /* buffer for a.g. inode header */ - xfs_agnumber_t agfbno; /* agf block of freed btree block */ - xfs_buf_t *agfbp; /* bp of agf block of freed block */ + xfs_agnumber_t agfbno; /* agf block of freed btree block */ + xfs_buf_t *agfbp; /* bp of agf block of freed block */ xfs_agi_t *agi; /* allocation group inode header */ - xfs_inobt_block_t *block; /* btree block record/key lives in */ + xfs_inobt_block_t *block; /* btree block record/key lives in */ xfs_agblock_t bno; /* btree block number */ xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ @@ -91,7 +108,7 @@ xfs_inobt_delrec( int ptr; /* index in btree block for this rec */ xfs_agblock_t rbno; /* right block's block number */ xfs_buf_t *rbp; /* right block's buffer pointer */ - xfs_inobt_block_t *right; /* right btree block */ + xfs_inobt_block_t *right; /* right btree block */ xfs_inobt_key_t *rkp; /* right block key pointer */ xfs_inobt_rec_t *rp; /* pointer to btree records */ xfs_inobt_ptr_t *rpp; /* right block address pointer */ @@ -148,7 +165,7 @@ xfs_inobt_delrec( } } /* - * It's a leaf. Excise the record being deleted, by sliding the + * It's a leaf. Excise the record being deleted, by sliding the * entries past it down one. Log the changed areas of the block. */ else { @@ -424,7 +441,7 @@ xfs_inobt_delrec( } /* * Otherwise, we can't fix the imbalance. - * Just return. This is probably a logic error, but it's not fatal. + * Just return. This is probably a logic error, but it's not fatal. */ else { if (level > 0 && (error = xfs_inobt_decrement(cur, level, &i))) @@ -458,7 +475,7 @@ xfs_inobt_delrec( INT_GET(left->bb_numrecs, ARCH_CONVERT) + INT_GET(right->bb_numrecs, ARCH_CONVERT)); } else { /* - * It's a leaf. Move records. + * It's a leaf. Move records. */ lrp = XFS_INOBT_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, cur); rrp = XFS_INOBT_REC_ADDR(right, 1, cur); @@ -560,10 +577,10 @@ xfs_inobt_insrec( int level, /* level to insert record at */ xfs_agblock_t *bnop, /* i/o: block number inserted */ xfs_inobt_rec_t *recp, /* i/o: record data inserted */ - xfs_btree_cur_t **curp, /* output: new cursor replacing cur */ + xfs_btree_cur_t **curp, /* output: new cursor replacing cur */ int *stat) /* success/failure */ { - xfs_inobt_block_t *block; /* btree block record/key lives in */ + xfs_inobt_block_t *block; /* btree block record/key lives in */ xfs_buf_t *bp; /* buffer for block */ int error; /* error return value */ int i; /* loop index */ @@ -764,7 +781,7 @@ STATIC void xfs_inobt_log_block( xfs_trans_t *tp, /* transaction pointer */ xfs_buf_t *bp, /* buffer containing btree block */ - int fields) /* mask of fields: XFS_BB_... */ + int fields) /* mask of fields: XFS_BB_... */ { int first; /* first byte offset logged */ int last; /* last byte offset logged */ @@ -788,10 +805,10 @@ STATIC void xfs_inobt_log_keys( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int kfirst, /* index of first key to log */ + int kfirst, /* index of first key to log */ int klast) /* index of last key to log */ { - xfs_inobt_block_t *block; /* btree block to log from */ + xfs_inobt_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ xfs_inobt_key_t *kp; /* key pointer in btree block */ int last; /* last byte offset logged */ @@ -810,10 +827,10 @@ STATIC void xfs_inobt_log_ptrs( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int pfirst, /* index of first pointer to log */ + int pfirst, /* index of first pointer to log */ int plast) /* index of last pointer to log */ { - xfs_inobt_block_t *block; /* btree block to log from */ + xfs_inobt_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ int last; /* last byte offset logged */ xfs_inobt_ptr_t *pp; /* block-pointer pointer in btree blk */ @@ -832,10 +849,10 @@ STATIC void xfs_inobt_log_recs( xfs_btree_cur_t *cur, /* btree cursor */ xfs_buf_t *bp, /* buffer containing btree block */ - int rfirst, /* index of first record to log */ + int rfirst, /* index of first record to log */ int rlast) /* index of last record to log */ { - xfs_inobt_block_t *block; /* btree block to log from */ + xfs_inobt_block_t *block; /* btree block to log from */ int first; /* first byte offset logged */ int last; /* last byte offset logged */ xfs_inobt_rec_t *rp; /* record pointer for btree block */ @@ -927,8 +944,8 @@ xfs_inobt_lookup( */ else { int high; /* high entry number */ - xfs_inobt_key_t *kkbase=NULL;/* base of keys in block */ - xfs_inobt_rec_t *krbase=NULL;/* base of records in block */ + xfs_inobt_key_t *kkbase=NULL;/* base of keys in block */ + xfs_inobt_rec_t *krbase=NULL;/* base of records in block */ int low; /* low entry number */ /* @@ -966,12 +983,12 @@ xfs_inobt_lookup( * Get startino. */ if (level > 0) { - xfs_inobt_key_t *kkp; + xfs_inobt_key_t *kkp; kkp = kkbase + keyno - 1; startino = INT_GET(kkp->ir_startino, ARCH_CONVERT); } else { - xfs_inobt_rec_t *krp; + xfs_inobt_rec_t *krp; krp = krbase + keyno - 1; startino = INT_GET(krp->ir_startino, ARCH_CONVERT); @@ -1074,7 +1091,7 @@ xfs_inobt_lshift( xfs_inobt_rec_t *lrp=NULL; /* record pointer for left block */ int nrec; /* new number of left block entries */ xfs_buf_t *rbp; /* buffer for right (current) block */ - xfs_inobt_block_t *right; /* right (current) btree block */ + xfs_inobt_block_t *right; /* right (current) btree block */ xfs_inobt_key_t *rkp=NULL; /* key pointer for right block */ xfs_inobt_ptr_t *rpp=NULL; /* address pointer for right block */ xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */ @@ -1204,7 +1221,7 @@ xfs_inobt_newroot( { xfs_agi_t *agi; /* a.g. inode header */ xfs_alloc_arg_t args; /* allocation argument structure */ - xfs_inobt_block_t *block; /* one half of the old root block */ + xfs_inobt_block_t *block; /* one half of the old root block */ xfs_buf_t *bp; /* buffer containing block */ int error; /* error return value */ xfs_inobt_key_t *kp; /* btree key pointer */ @@ -1217,7 +1234,7 @@ xfs_inobt_newroot( xfs_inobt_ptr_t *pp; /* btree address pointer */ xfs_agblock_t rbno; /* right block number */ xfs_buf_t *rbp; /* right buffer pointer */ - xfs_inobt_block_t *right; /* right btree block */ + xfs_inobt_block_t *right; /* right btree block */ xfs_inobt_rec_t *rp; /* btree record pointer */ ASSERT(cur->bc_nlevels < XFS_IN_MAXLEVELS(cur->bc_mp)); @@ -1360,7 +1377,7 @@ xfs_inobt_rshift( xfs_inobt_ptr_t *lpp; /* address pointer for left block */ xfs_inobt_rec_t *lrp; /* record pointer for left block */ xfs_buf_t *rbp; /* buffer for right neighbor block */ - xfs_inobt_block_t *right; /* right neighbor btree block */ + xfs_inobt_block_t *right; /* right neighbor btree block */ xfs_inobt_key_t *rkp; /* key pointer for right block */ xfs_inobt_ptr_t *rpp; /* address pointer for right block */ xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */ @@ -1481,7 +1498,7 @@ xfs_inobt_split( int level, /* level to split */ xfs_agblock_t *bnop, /* output: block number allocated */ xfs_inobt_key_t *keyp, /* output: first key of new block */ - xfs_btree_cur_t **curp, /* output: new cursor */ + xfs_btree_cur_t **curp, /* output: new cursor */ int *stat) /* success/failure */ { xfs_alloc_arg_t args; /* allocation argument structure */ @@ -1494,7 +1511,7 @@ xfs_inobt_split( xfs_inobt_ptr_t *lpp; /* left btree address pointer */ xfs_inobt_rec_t *lrp; /* left btree record pointer */ xfs_buf_t *rbp; /* buffer for right block */ - xfs_inobt_block_t *right; /* right (new) btree block */ + xfs_inobt_block_t *right; /* right (new) btree block */ xfs_inobt_key_t *rkp; /* right btree key pointer */ xfs_inobt_ptr_t *rpp; /* right btree address pointer */ xfs_inobt_rec_t *rrp; /* right btree record pointer */ @@ -1649,7 +1666,7 @@ xfs_inobt_updkey( */ for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) { xfs_buf_t *bp; /* buffer for block */ - xfs_inobt_block_t *block; /* btree block */ + xfs_inobt_block_t *block; /* btree block */ #ifdef DEBUG int error; /* error return value */ #endif @@ -1683,7 +1700,7 @@ xfs_inobt_decrement( int level, /* level in btree, 0 is leaf */ int *stat) /* success/failure */ { - xfs_inobt_block_t *block; /* btree block */ + xfs_inobt_block_t *block; /* btree block */ int error; int lev; /* btree level */ @@ -1765,7 +1782,7 @@ xfs_inobt_decrement( */ int /* error */ xfs_inobt_delete( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ int *stat) /* success/failure */ { int error; @@ -1805,9 +1822,9 @@ xfs_inobt_get_rec( __int32_t *fcnt, /* output: number of free inodes */ xfs_inofree_t *free, /* output: free inode mask */ int *stat, /* output: success/failure */ - xfs_arch_t arch) /* input: architecture */ + xfs_arch_t arch) /* input: architecture */ { - xfs_inobt_block_t *block; /* btree block */ + xfs_inobt_block_t *block; /* btree block */ xfs_buf_t *bp; /* buffer containing btree block */ #ifdef DEBUG int error; /* error return value */ @@ -1857,7 +1874,7 @@ xfs_inobt_increment( int level, /* level in btree, 0 is leaf */ int *stat) /* success/failure */ { - xfs_inobt_block_t *block; /* btree block */ + xfs_inobt_block_t *block; /* btree block */ xfs_buf_t *bp; /* buffer containing btree block */ int error; /* error return value */ int lev; /* btree level */ @@ -1944,16 +1961,16 @@ xfs_inobt_increment( */ int /* error */ xfs_inobt_insert( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ int *stat) /* success/failure */ { int error; /* error return value */ int i; /* result value, 0 for failure */ int level; /* current level number in btree */ xfs_agblock_t nbno; /* new block number (split result) */ - xfs_btree_cur_t *ncur; /* new cursor (split result) */ - xfs_inobt_rec_t nrec; /* record being inserted this level */ - xfs_btree_cur_t *pcur; /* previous level's cursor */ + xfs_btree_cur_t *ncur; /* new cursor (split result) */ + xfs_inobt_rec_t nrec; /* record being inserted this level */ + xfs_btree_cur_t *pcur; /* previous level's cursor */ level = 0; nbno = NULLAGBLOCK; @@ -2004,7 +2021,7 @@ xfs_inobt_insert( */ int /* error */ xfs_inobt_lookup_eq( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ @@ -2022,7 +2039,7 @@ xfs_inobt_lookup_eq( */ int /* error */ xfs_inobt_lookup_ge( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ @@ -2040,7 +2057,7 @@ xfs_inobt_lookup_ge( */ int /* error */ xfs_inobt_lookup_le( - xfs_btree_cur_t *cur, /* btree cursor */ + xfs_btree_cur_t *cur, /* btree cursor */ xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ @@ -2064,7 +2081,7 @@ xfs_inobt_update( __int32_t fcnt, /* free inode count */ xfs_inofree_t free) /* free inode mask */ { - xfs_inobt_block_t *block; /* btree block to update */ + xfs_inobt_block_t *block; /* btree block to update */ xfs_buf_t *bp; /* buffer containing btree block */ int error; /* error return value */ int ptr; /* current record number (updating) */ @@ -2095,7 +2112,7 @@ xfs_inobt_update( * Updating first record in leaf. Pass new key value up to our parent. */ if (ptr == 1) { - xfs_inobt_key_t key; /* key containing [ino] */ + xfs_inobt_key_t key; /* key containing [ino] */ INT_SET(key.ir_startino, ARCH_CONVERT, ino); if ((error = xfs_inobt_updkey(cur, &key, 1))) diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h index fd27bc62bf44..c02586a14578 100644 --- a/fs/xfs/xfs_ialloc_btree.h +++ b/fs/xfs/xfs_ialloc_btree.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_IALLOC_BTREE_H__ -#define __XFS_IALLOC_BTREE_H__ +#define __XFS_IALLOC_BTREE_H__ /* * Inode map on-disk structures @@ -44,18 +44,18 @@ struct xfs_mount; /* * There is a btree for the inode map per allocation group. */ -#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */ +#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */ -typedef __uint64_t xfs_inofree_t; -#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t)) -#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) -#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) +typedef __uint64_t xfs_inofree_t; +#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t)) +#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) +#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASKN) xfs_inofree_t xfs_inobt_maskn(int i, int n); -#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n) +#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n) #else -#define XFS_INOBT_MASKN(i,n) \ +#define XFS_INOBT_MASKN(i,n) \ ((((n) >= XFS_INODES_PER_CHUNK ? \ (xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i)) #endif @@ -80,13 +80,13 @@ typedef struct xfs_inobt_key typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */ /* btree block header type */ -typedef struct xfs_btree_sblock xfs_inobt_block_t; +typedef struct xfs_btree_sblock xfs_inobt_block_t; #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_INOBT_BLOCK) xfs_inobt_block_t *xfs_buf_to_inobt_block(struct xfs_buf *bp); -#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp) +#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp) #else -#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp))) +#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp))) #endif /* @@ -94,28 +94,28 @@ xfs_inobt_block_t *xfs_buf_to_inobt_block(struct xfs_buf *bp); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASK) xfs_inofree_t xfs_inobt_mask(int i); -#define XFS_INOBT_MASK(i) xfs_inobt_mask(i) +#define XFS_INOBT_MASK(i) xfs_inobt_mask(i) #else -#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) +#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch) +#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch) #else -#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \ +#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \ & XFS_INOBT_MASK(i)) != 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE) void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch) +#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch) #else -#define XFS_INOBT_SET_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= XFS_INOBT_MASK(i))) +#define XFS_INOBT_SET_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= XFS_INOBT_MASK(i))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_CLR_FREE) void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch) +#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch) #else -#define XFS_INOBT_CLR_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i))) +#define XFS_INOBT_CLR_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i))) #endif /* @@ -123,31 +123,31 @@ void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_SIZE) int xfs_inobt_block_size(int lev, struct xfs_btree_cur *cur); -#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur) +#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur) #else -#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) +#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MAXRECS) int xfs_inobt_block_maxrecs(int lev, struct xfs_btree_cur *cur); -#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur) +#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur) #else -#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \ +#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \ ((cur)->bc_mp->m_inobt_mxr[lev != 0]) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MINRECS) int xfs_inobt_block_minrecs(int lev, struct xfs_btree_cur *cur); -#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur) +#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur) #else -#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \ +#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \ ((cur)->bc_mp->m_inobt_mnr[lev != 0]) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_LAST_REC) int xfs_inobt_is_last_rec(struct xfs_btree_cur *cur); -#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur) +#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur) #else -#define XFS_INOBT_IS_LAST_REC(cur) \ +#define XFS_INOBT_IS_LAST_REC(cur) \ ((cur)->bc_ptrs[0] == \ INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT)) #endif @@ -157,9 +157,9 @@ int xfs_inobt_is_last_rec(struct xfs_btree_cur *cur); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IN_MAXLEVELS) int xfs_in_maxlevels(struct xfs_mount *mp); -#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp) +#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp) #else -#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) +#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) #endif /* @@ -167,15 +167,15 @@ int xfs_in_maxlevels(struct xfs_mount *mp); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IBT_BLOCK) xfs_agblock_t xfs_ibt_block(struct xfs_mount *mp); -#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp) +#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp) #else -#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1)) +#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_PREALLOC_BLOCKS) xfs_agblock_t xfs_prealloc_blocks(struct xfs_mount *mp); -#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp) +#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp) #else -#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1)) +#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1)) #endif /* @@ -184,9 +184,9 @@ xfs_agblock_t xfs_prealloc_blocks(struct xfs_mount *mp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_REC_ADDR) xfs_inobt_rec_t * xfs_inobt_rec_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur) +#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur) #else -#define XFS_INOBT_REC_ADDR(bb,i,cur) \ +#define XFS_INOBT_REC_ADDR(bb,i,cur) \ XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, i, \ XFS_INOBT_BLOCK_MAXRECS(0, cur)) #endif @@ -194,9 +194,9 @@ xfs_inobt_rec_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_KEY_ADDR) xfs_inobt_key_t * xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur) +#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur) #else -#define XFS_INOBT_KEY_ADDR(bb,i,cur) \ +#define XFS_INOBT_KEY_ADDR(bb,i,cur) \ XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \ XFS_INOBT_BLOCK_MAXRECS(1, cur)) #endif @@ -204,9 +204,9 @@ xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_PTR_ADDR) xfs_inobt_ptr_t * xfs_inobt_ptr_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); -#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur) +#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur) #else -#define XFS_INOBT_PTR_ADDR(bb,i,cur) \ +#define XFS_INOBT_PTR_ADDR(bb,i,cur) \ XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \ XFS_INOBT_BLOCK_MAXRECS(1, cur)) #endif @@ -234,7 +234,7 @@ xfs_inobt_decrement( int /* error */ xfs_inobt_delete( struct xfs_btree_cur *cur, /* btree cursor */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ #endif /* _NOTYET_ */ /* @@ -257,7 +257,7 @@ int /* error */ xfs_inobt_increment( struct xfs_btree_cur *cur, /* btree cursor */ int level, /* level in btree, 0 is leaf */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Insert the current record at the point referenced by cur. @@ -266,7 +266,7 @@ xfs_inobt_increment( int /* error */ xfs_inobt_insert( struct xfs_btree_cur *cur, /* btree cursor */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the record equal to ino in the btree given by cur. @@ -277,7 +277,7 @@ xfs_inobt_lookup_eq( xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the first record greater than or equal to ino @@ -289,7 +289,7 @@ xfs_inobt_lookup_ge( xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Lookup the first record less than or equal to ino @@ -301,7 +301,7 @@ xfs_inobt_lookup_le( xfs_agino_t ino, /* starting inode of chunk */ __int32_t fcnt, /* free inode count */ xfs_inofree_t free, /* free inode mask */ - int *stat); /* success/failure */ + int *stat); /* success/failure */ /* * Update the record referred to by cur, to the value given diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 15382b98392a..dc3e15062caf 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,13 +30,37 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_quota.h" +#include "xfs_utils.h" /* * Initialize the inode hash table for the newly mounted file system. * * mp -- this is the mount point structure for the file system being - * initialized + * initialized */ void xfs_ihash_init(xfs_mount_t *mp) @@ -66,7 +90,7 @@ xfs_ihash_free(xfs_mount_t *mp) * Initialize the inode cluster hash table for the newly mounted file system. * * mp -- this is the mount point structure for the file system being - * initialized + * initialized */ void xfs_chash_init(xfs_mount_t *mp) @@ -111,11 +135,11 @@ xfs_chash_free(xfs_mount_t *mp) /* * Look up an inode by number in the given file system. * The inode is looked up in the hash table for the file system - * represented by the mount point parameter mp. Each bucket of + * represented by the mount point parameter mp. Each bucket of * the hash table is guarded by an individual semaphore. * * If the inode is found in the hash table, its corresponding vnode - * is obtained with a call to vn_get(). This call takes care of + * is obtained with a call to vn_get(). This call takes care of * coordination with the reclamation of the inode and vnode. Note * that the vmap structure is filled in while holding the hash lock. * This gives us the state of the inode/vnode when we found it and @@ -128,12 +152,12 @@ xfs_chash_free(xfs_mount_t *mp) * This flag parameter indicates how and if the inode's IO lock and inode lock * should be taken. * - * mp -- the mount point structure for the current file system. It points - * to the inode hash table. - * tp -- a pointer to the current transaction if there is one. This is - * simply passed through to the xfs_iread() call. + * mp -- the mount point structure for the current file system. It points + * to the inode hash table. + * tp -- a pointer to the current transaction if there is one. This is + * simply passed through to the xfs_iread() call. * ino -- the number of the inode desired. This is the unique identifier - * within the file system for the inode being requested. + * within the file system for the inode being requested. * lock_flags -- flags indicating how to lock the inode. See the comment * for xfs_ilock() for a list of valid values. * bno -- the block number starting the buffer containing the inode, @@ -158,7 +182,7 @@ xfs_iget_core( /* REFERENCED */ int newnode; xfs_chash_t *ch; - xfs_chashlist_t *chl, *chlnew; + xfs_chashlist_t *chl, *chlnew; SPLDECL(s); @@ -456,7 +480,7 @@ inode_allocate: error = 0; } } else - error = ENOMEM; /* If we got no inode we are out of memory */ + error = ENOMEM; /* If we got no inode we are out of memory */ return error; } @@ -508,7 +532,7 @@ xfs_inode_incore(xfs_mount_t *mp, } break; } - } + } read_unlock(&ih->ih_lock); return (NULL); } @@ -518,14 +542,14 @@ xfs_inode_incore(xfs_mount_t *mp, * * ip -- the inode being released * lock_flags -- this parameter indicates the inode's locks to be - * to be released. See the comment on xfs_iunlock() for a list + * to be released. See the comment on xfs_iunlock() for a list * of valid values. */ void xfs_iput(xfs_inode_t *ip, uint lock_flags) { - vnode_t *vp = XFS_ITOV(ip); + vnode_t *vp = XFS_ITOV(ip); vn_trace_entry(vp, "xfs_iput", (inst_t *)__return_address); @@ -577,7 +601,7 @@ xfs_ireclaim(xfs_inode_t *ip) /* * Here we do a spurious inode lock in order to coordinate with - * xfs_sync(). This is because xfs_sync() references the inodes + * xfs_sync(). This is because xfs_sync() references the inodes * in the mount list without taking references on the corresponding * vnodes. We make that OK here by ensuring that we wait until * the inode is unlocked in xfs_sync() before we go ahead and @@ -610,7 +634,7 @@ xfs_ireclaim(xfs_inode_t *ip) /* * This routine removes an about-to-be-destroyed inode from * all of the lists in which it is located with the exception - * of the behavior chain. + * of the behavior chain. */ void xfs_iextract( @@ -702,7 +726,7 @@ xfs_iextract( /* * This is a wrapper routine around the xfs_ilock() routine - * used to centralize some grungy code. It is used in places + * used to centralize some grungy code. It is used in places * that wish to lock the inode solely for reading the extents. * The reason these places can't just call xfs_ilock(SHARED) * is that the inode lock also guards to bringing in of the @@ -750,7 +774,7 @@ xfs_iunlock_map_shared( /* * The xfs inode contains 2 locks: a multi-reader lock called the - * i_iolock and a multi-reader lock called the i_lock. This routine + * i_iolock and a multi-reader lock called the i_lock. This routine * allows either or both of the locks to be obtained. * * The 2 locks should always be ordered so that the IO lock is @@ -758,7 +782,7 @@ xfs_iunlock_map_shared( * * ip -- the inode being locked * lock_flags -- this parameter indicates the inode's locks - * to be locked. It can be: + * to be locked. It can be: * XFS_IOLOCK_SHARED, * XFS_IOLOCK_EXCL, * XFS_ILOCK_SHARED, @@ -800,14 +824,14 @@ xfs_ilock(xfs_inode_t *ip, /* * This is just like xfs_ilock(), except that the caller - * is guaranteed not to sleep. It returns 1 if it gets - * the requested locks and 0 otherwise. If the IO lock is + * is guaranteed not to sleep. It returns 1 if it gets + * the requested locks and 0 otherwise. If the IO lock is * obtained but the inode lock cannot be, then the IO lock * is dropped before returning. * * ip -- the inode being locked * lock_flags -- this parameter indicates the inode's locks to be - * to be locked. See the comment for xfs_ilock() for a list + * to be locked. See the comment for xfs_ilock() for a list * of valid values. * */ @@ -866,18 +890,18 @@ xfs_ilock_nowait(xfs_inode_t *ip, /* * xfs_iunlock() is used to drop the inode locks acquired with - * xfs_ilock() and xfs_ilock_nowait(). The caller must pass + * xfs_ilock() and xfs_ilock_nowait(). The caller must pass * in the flags given to xfs_ilock() or xfs_ilock_nowait() so * that we know which locks to drop. * * ip -- the inode being unlocked * lock_flags -- this parameter indicates the inode's locks to be - * to be unlocked. See the comment for xfs_ilock() for a list + * to be unlocked. See the comment for xfs_ilock() for a list * of valid values for this parameter. * */ void -xfs_iunlock(xfs_inode_t *ip, +xfs_iunlock(xfs_inode_t *ip, uint lock_flags) { /* @@ -924,7 +948,7 @@ xfs_iunlock(xfs_inode_t *ip, } /* - * give up write locks. the i/o lock cannot be held nested + * give up write locks. the i/o lock cannot be held nested * if it is being demoted. */ void diff --git a/fs/xfs/xfs_imap.h b/fs/xfs/xfs_imap.h index 40cbb47e7069..e385064a066a 100644 --- a/fs/xfs/xfs_imap.h +++ b/fs/xfs/xfs_imap.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_IMAP_H__ -#define __XFS_IMAP_H__ +#define __XFS_IMAP_H__ /* * This is the structure passed to xfs_imap() to map diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 118025e51cd7..31a19b19b7b4 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,41 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <asm/unaligned.h> /* for get_unaligned, put_unaligned */ +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_imap.h" +#include "xfs_alloc.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_buf_item.h" +#include "xfs_rw.h" +#include "xfs_error.h" +#include "xfs_bit.h" +#include "xfs_utils.h" +#include "xfs_dir2_trace.h" +#include "xfs_quota.h" +#include "xfs_mac.h" +#include "xfs_acl.h" kmem_zone_t *xfs_ifork_zone; @@ -42,7 +75,7 @@ kmem_zone_t *xfs_chashlist_zone; * Used in xfs_itruncate(). This is the maximum number of extents * freed from a file in a single transaction. */ -#define XFS_ITRUNC_MAX_EXTENTS 2 +#define XFS_ITRUNC_MAX_EXTENTS 2 STATIC int xfs_iflush_int(xfs_inode_t *, xfs_buf_t *); STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int); @@ -102,7 +135,7 @@ xfs_inobp_check( i * mp->m_sb.sb_inodesize); if (INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)) { xfs_fs_cmn_err(CE_ALERT, mp, - "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.", + "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.", bp); ASSERT(!INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)); } @@ -128,7 +161,7 @@ xfs_inobp_bwcheck(xfs_buf_t *bp) j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; - for (i = 0; i < j; i++) { + for (i = 0; i < j; i++) { dip = (xfs_dinode_t *) xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize); if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) { @@ -205,13 +238,13 @@ xfs_inotobp( XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) { cmn_err(CE_WARN, "xfs_inotobp: inode number (%d + %d) maps to a block outside the bounds " - "of the file system %s. Returning EINVAL.", + "of the file system %s. Returning EINVAL.", imap.im_blkno, imap.im_len,mp->m_fsname); return XFS_ERROR(EINVAL); } /* - * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will + * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will * default to just a read_buf() call. */ error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno, @@ -232,7 +265,7 @@ xfs_inotobp( XFS_CORRUPTION_ERROR("xfs_inotobp", XFS_ERRLEVEL_LOW, mp, dip); xfs_trans_brelse(tp, bp); cmn_err(CE_WARN, - "xfs_inotobp: XFS_TEST_ERROR() returned an " + "xfs_inotobp: XFS_TEST_ERROR() returned an " "error on %s. Returning EFSCORRUPTED.", mp->m_fsname); return XFS_ERROR(EFSCORRUPTED); } @@ -263,10 +296,10 @@ xfs_inotobp( * to determine the size and location of the buffer to read from disk. * If the inode has already been mapped to its buffer and read in once, * then use the mapping information stored in the inode rather than - * calling xfs_imap(). This allows us to avoid the overhead of looking + * calling xfs_imap(). This allows us to avoid the overhead of looking * at the inode btree for small block file systems (see xfs_dilocate()). * We can tell whether the inode has been mapped in before by comparing - * its disk block address to 0. Only uninitialized inodes will have + * its disk block address to 0. Only uninitialized inodes will have * 0 for the disk block address. */ int @@ -337,7 +370,7 @@ xfs_itobp( ASSERT(bno == 0 || bno == imap.im_blkno); /* - * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will + * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will * default to just a read_buf() call. */ error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno, @@ -403,8 +436,8 @@ xfs_itobp( /* * Move inode type and inode format specific information from the - * on-disk inode to the in-core inode. For fifos, devs, and sockets - * this means set if_rdev to the proper value. For files, directories, + * on-disk inode to the in-core inode. For fifos, devs, and sockets + * this means set if_rdev to the proper value. For files, directories, * and symlinks this means to bring in the in-line data or extent * pointers. For a file in B-tree format, only the root is immediately * brought in-core. The rest will be in-lined in if_extents when it @@ -418,7 +451,7 @@ xfs_iformat( xfs_attr_shortform_t *atp; int size; int error; - xfs_fsize_t di_size; + xfs_fsize_t di_size; ip->i_df.if_ext_max = XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); error = 0; @@ -618,14 +651,12 @@ xfs_iformat_extents( xfs_dinode_t *dip, int whichfork) { + xfs_bmbt_rec_t *ep, *dp; xfs_ifork_t *ifp; int nex; int real_size; int size; -#if ARCH_CONVERT != ARCH_NOCONVERT int i; -#endif - xfs_bmbt_rec_t *ep, *dp; ifp = XFS_IFORK_PTR(ip, whichfork); nex = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); @@ -752,72 +783,75 @@ xfs_iformat_btree( * xfs_xlate_dinode_core - translate an xfs_inode_core_t between ondisk * and native format * - * buf = on-disk representation - * dip = native representation - * dir = direction - +ve -> disk to native - * -ve -> native to disk + * buf = on-disk representation + * dip = native representation + * dir = direction - +ve -> disk to native + * -ve -> native to disk * arch = on-disk architecture */ - void -xfs_xlate_dinode_core(xfs_caddr_t buf, xfs_dinode_core_t *dip, - int dir, xfs_arch_t arch) +xfs_xlate_dinode_core( + xfs_caddr_t buf, + xfs_dinode_core_t *dip, + int dir, + xfs_arch_t arch) { - xfs_dinode_core_t *buf_core; - xfs_dinode_core_t *mem_core; - - ASSERT(dir); + xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf; + xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip; + + ASSERT(dir); + if (arch == ARCH_NOCONVERT) { + if (dir > 0) { + memcpy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, + sizeof(xfs_dinode_core_t)); + } else { + memcpy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, + sizeof(xfs_dinode_core_t)); + } + return; + } - buf_core=(xfs_dinode_core_t*)buf; - mem_core=(xfs_dinode_core_t*)dip; + INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch); + INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch); + INT_XLATE(buf_core->di_version, mem_core->di_version, dir, arch); + INT_XLATE(buf_core->di_format, mem_core->di_format, dir, arch); + INT_XLATE(buf_core->di_onlink, mem_core->di_onlink, dir, arch); + INT_XLATE(buf_core->di_uid, mem_core->di_uid, dir, arch); + INT_XLATE(buf_core->di_gid, mem_core->di_gid, dir, arch); + INT_XLATE(buf_core->di_nlink, mem_core->di_nlink, dir, arch); + INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch); - if (arch == ARCH_NOCONVERT) { - if (dir>0) { - memcpy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, sizeof(xfs_dinode_core_t)); + if (dir > 0) { + memcpy(mem_core->di_pad, buf_core->di_pad, + sizeof(buf_core->di_pad)); } else { - memcpy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, sizeof(xfs_dinode_core_t)); - } - return; - } - - INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch); - INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch); - INT_XLATE(buf_core->di_version, mem_core->di_version, dir, arch); - INT_XLATE(buf_core->di_format, mem_core->di_format, dir, arch); - INT_XLATE(buf_core->di_onlink, mem_core->di_onlink, dir, arch); - INT_XLATE(buf_core->di_uid, mem_core->di_uid, dir, arch); - INT_XLATE(buf_core->di_gid, mem_core->di_gid, dir, arch); - INT_XLATE(buf_core->di_nlink, mem_core->di_nlink, dir, arch); - INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch); - - if (dir>0) { - memcpy(mem_core->di_pad, buf_core->di_pad, sizeof(buf_core->di_pad)); - } else { - memcpy(buf_core->di_pad, mem_core->di_pad, sizeof(buf_core->di_pad)); - } - - INT_XLATE(buf_core->di_atime.t_sec, mem_core->di_atime.t_sec, dir, arch); - INT_XLATE(buf_core->di_atime.t_nsec,mem_core->di_atime.t_nsec, dir, arch); - - INT_XLATE(buf_core->di_mtime.t_sec, mem_core->di_mtime.t_sec, dir, arch); - INT_XLATE(buf_core->di_mtime.t_nsec,mem_core->di_mtime.t_nsec, dir, arch); - - INT_XLATE(buf_core->di_ctime.t_sec, mem_core->di_ctime.t_sec, dir, arch); - INT_XLATE(buf_core->di_ctime.t_nsec,mem_core->di_ctime.t_nsec, dir, arch); - - INT_XLATE(buf_core->di_size, mem_core->di_size, dir, arch); - INT_XLATE(buf_core->di_nblocks, mem_core->di_nblocks, dir, arch); - INT_XLATE(buf_core->di_extsize, mem_core->di_extsize, dir, arch); - - INT_XLATE(buf_core->di_nextents, mem_core->di_nextents, dir, arch); - INT_XLATE(buf_core->di_anextents, mem_core->di_anextents, dir, arch); - INT_XLATE(buf_core->di_forkoff, mem_core->di_forkoff, dir, arch); - INT_XLATE(buf_core->di_aformat, mem_core->di_aformat, dir, arch); - INT_XLATE(buf_core->di_dmevmask, mem_core->di_dmevmask, dir, arch); - INT_XLATE(buf_core->di_dmstate, mem_core->di_dmstate, dir, arch); - INT_XLATE(buf_core->di_flags, mem_core->di_flags, dir, arch); - INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch); - + memcpy(buf_core->di_pad, mem_core->di_pad, + sizeof(buf_core->di_pad)); + } + + INT_XLATE(buf_core->di_atime.t_sec, mem_core->di_atime.t_sec, + dir, arch); + INT_XLATE(buf_core->di_atime.t_nsec, mem_core->di_atime.t_nsec, + dir, arch); + INT_XLATE(buf_core->di_mtime.t_sec, mem_core->di_mtime.t_sec, + dir, arch); + INT_XLATE(buf_core->di_mtime.t_nsec, mem_core->di_mtime.t_nsec, + dir, arch); + INT_XLATE(buf_core->di_ctime.t_sec, mem_core->di_ctime.t_sec, + dir, arch); + INT_XLATE(buf_core->di_ctime.t_nsec, mem_core->di_ctime.t_nsec, + dir, arch); + INT_XLATE(buf_core->di_size, mem_core->di_size, dir, arch); + INT_XLATE(buf_core->di_nblocks, mem_core->di_nblocks, dir, arch); + INT_XLATE(buf_core->di_extsize, mem_core->di_extsize, dir, arch); + INT_XLATE(buf_core->di_nextents, mem_core->di_nextents, dir, arch); + INT_XLATE(buf_core->di_anextents, mem_core->di_anextents, dir, arch); + INT_XLATE(buf_core->di_forkoff, mem_core->di_forkoff, dir, arch); + INT_XLATE(buf_core->di_aformat, mem_core->di_aformat, dir, arch); + INT_XLATE(buf_core->di_dmevmask, mem_core->di_dmevmask, dir, arch); + INT_XLATE(buf_core->di_dmstate, mem_core->di_dmstate, dir, arch); + INT_XLATE(buf_core->di_flags, mem_core->di_flags, dir, arch); + INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch); } /* @@ -851,7 +885,7 @@ xfs_iread( * Get pointer's to the on-disk inode and the buffer containing it. * If the inode number refers to a block outside the file system * then xfs_itobp() will return NULL. In this case we should - * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will + * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will * know that this is a new incore inode. */ error = xfs_itobp(mp, tp, ip, &dip, &bp, bno); @@ -936,7 +970,7 @@ xfs_iread( ip->i_d.di_mode = 0; /* * Initialize the per-fork minima and maxima for a new - * inode here. xfs_iformat will do it for old inodes. + * inode here. xfs_iformat will do it for old inodes. */ ip->i_df.if_ext_max = XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); @@ -945,10 +979,10 @@ xfs_iread( /* * The inode format changed when we moved the link count and * made it 32 bits long. If this is an old format inode, - * convert it in memory to look like a new one. If it gets + * convert it in memory to look like a new one. If it gets * flushed to disk we will convert back before flushing or - * logging it. We zero out the new projid field and the old link - * count field. We'll handle clearing the pad field (the remains + * logging it. We zero out the new projid field and the old link + * count field. We'll handle clearing the pad field (the remains * of the old uuid field) when we actually convert the inode to * the new format. We don't change the version number so that we * can distinguish this from a real new format inode. @@ -963,7 +997,7 @@ xfs_iread( /* * Mark the buffer containing the inode as something to keep - * around for a while. This helps to keep recently accessed + * around for a while. This helps to keep recently accessed * meta-data in-core longer. */ XFS_BUF_SET_REF(bp, XFS_INO_REF); @@ -974,7 +1008,7 @@ xfs_iread( * in xfs_itobp() above. If tp is NULL, this is just a normal * brelse(). If we're within a transaction, then xfs_trans_brelse() * will only release the buffer if it is not dirty within the - * transaction. It will be OK to release the buffer in this case, + * transaction. It will be OK to release the buffer in this case, * because inodes on disk are never destroyed and we will be * locking the new in-core inode before putting it in the hash * table where other processes can find it. Thus we don't have @@ -1217,7 +1251,7 @@ xfs_isize_check( { xfs_fileoff_t map_first; int nimaps; - xfs_bmbt_irec_t imaps[2]; + xfs_bmbt_irec_t imaps[2]; if ((ip->i_d.di_mode & IFMT) != IFREG) return; @@ -1244,12 +1278,12 @@ xfs_isize_check( #endif /* DEBUG */ /* - * Calculate the last possible buffered byte in a file. This must + * Calculate the last possible buffered byte in a file. This must * include data that was buffered beyond the EOF by the write code. * This also needs to deal with overflowing the xfs_fsize_t type * which can happen for sizes near the limit. * - * We also need to take into account any blocks beyond the EOF. It + * We also need to take into account any blocks beyond the EOF. It * may be the case that they were buffered by a write which failed. * In that case the pages will still be in memory, but the inode size * will never have been updated. @@ -1329,7 +1363,7 @@ xfs_itrunc_trace( (void*)0); } #else -#define xfs_itrunc_trace(tag, ip, flag, new_size, toss_start, toss_finish) +#define xfs_itrunc_trace(tag, ip, flag, new_size, toss_start, toss_finish) #endif /* @@ -1345,10 +1379,10 @@ xfs_itrunc_trace( * inode lock when we do so. * * The flags parameter can have either the value XFS_ITRUNC_DEFINITE - * or XFS_ITRUNC_MAYBE. The XFS_ITRUNC_MAYBE value should be used + * or XFS_ITRUNC_MAYBE. The XFS_ITRUNC_MAYBE value should be used * in the case that the caller is locking things out of order and * may not be able to call xfs_itruncate_finish() with the inode lock - * held without dropping the I/O lock. If the caller must drop the + * held without dropping the I/O lock. If the caller must drop the * I/O lock before calling xfs_itruncate_finish(), then xfs_itruncate_start() * must be called again with all the same restrictions as the initial * call. @@ -1438,11 +1472,11 @@ xfs_itruncate_start( * for it within the transaction. * * The fork parameter must be either xfs_attr_fork or xfs_data_fork, - * and it indicates the fork which is to be truncated. For the + * and it indicates the fork which is to be truncated. For the * attribute fork we only support truncation to size 0. * * We use the sync parameter to indicate whether or not the first - * transaction we perform might have to be synchronous. For the attr fork, + * transaction we perform might have to be synchronous. For the attr fork, * it needs to be so if the unlink of the inode is not yet known to be * permanent in the log. This keeps us from freeing and reusing the * blocks of the attribute fork before the unlink of the inode becomes @@ -1480,7 +1514,7 @@ xfs_itruncate_finish( xfs_trans_t *ntp; int done; int committed; - xfs_bmap_free_t free_list; + xfs_bmap_free_t free_list; int error; ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE) != 0); @@ -1509,7 +1543,7 @@ xfs_itruncate_finish( * The first thing we do is set the size to new_size permanently * on disk. This way we don't have to worry about anyone ever * being able to look at the data being freed even in the face - * of a crash. What we're getting around here is the case where + * of a crash. What we're getting around here is the case where * we free a block, it is allocated to another file, it is written * to, and then we crash. If the new data gets written to the * file but the log buffers containing the free and reallocation @@ -1552,7 +1586,7 @@ xfs_itruncate_finish( * * For the attribute fork we allow the caller to tell us whether * the unlink of the inode that led to this call is yet permanent - * in the on disk log. If it is not and we will be freeing extents + * in the on disk log. If it is not and we will be freeing extents * in this inode then we make the first transaction synchronous * to make sure that the unlink is permanent by the time we free * the blocks. @@ -1577,7 +1611,7 @@ xfs_itruncate_finish( * the end of the file (in a crash where the space is allocated * but the inode size is not yet updated), simply remove any * blocks which show up between the new EOF and the maximum - * possible file size. If the first block to be removed is + * possible file size. If the first block to be removed is * beyond the maximum file size (ie it is the same as last_block), * then there is nothing to do. */ @@ -1593,7 +1627,7 @@ xfs_itruncate_finish( /* * Free up up to XFS_ITRUNC_MAX_EXTENTS. xfs_bunmapi() * will tell us whether it freed the entire range or - * not. If this is a synchronous mount (wsync), + * not. If this is a synchronous mount (wsync), * then we can tell bunmapi to keep all the * transactions asynchronous since the unlink * transaction that made this inode inactive has @@ -1650,7 +1684,7 @@ xfs_itruncate_finish( * level code, because it always knows that * the inode is locked and held in the * transaction that returns to it whether - * errors occur or not. We don't mark the + * errors occur or not. We don't mark the * inode dirty so that this transaction can * be easily aborted if possible. */ @@ -1845,7 +1879,7 @@ xfs_iunlink( if (INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != NULLAGINO) { /* * There is already another inode in the bucket we need - * to add ourselves to. Add us at the front of the list. + * to add ourselves to. Add us at the front of the list. * Here we put the head pointer into our next pointer, * and then we fall through to point the head at us. */ @@ -1918,7 +1952,7 @@ xfs_iunlink_remove( XFS_FSS_TO_BB(mp, 1), 0, &agibp); if (error) { cmn_err(CE_WARN, - "xfs_iunlink_remove: xfs_trans_read_buf() returned an error %d on %s. Returning error.", + "xfs_iunlink_remove: xfs_trans_read_buf() returned an error %d on %s. Returning error.", error, mp->m_fsname); return error; } @@ -1935,7 +1969,7 @@ xfs_iunlink_remove( mp, agi); xfs_trans_brelse(tp, agibp); cmn_err(CE_WARN, - "xfs_iunlink_remove: XFS_TEST_ERROR() returned an error on %s. Returning EFSCORRUPTED.", + "xfs_iunlink_remove: XFS_TEST_ERROR() returned an error on %s. Returning EFSCORRUPTED.", mp->m_fsname); return XFS_ERROR(EFSCORRUPTED); } @@ -1953,7 +1987,7 @@ xfs_iunlink_remove( /* * We're at the head of the list. Get the inode's * on-disk buffer to see if there is anyone after us - * on the list. Only modify our next pointer if it + * on the list. Only modify our next pointer if it * is not already NULLAGINO. This saves us the overhead * of dealing with the buffer when there is no need to * change it. @@ -2008,7 +2042,7 @@ xfs_iunlink_remove( &last_ibp, &last_offset); if (error) { cmn_err(CE_WARN, - "xfs_iunlink_remove: xfs_inotobp() returned an error %d on %s. Returning error.", + "xfs_iunlink_remove: xfs_inotobp() returned an error %d on %s. Returning error.", error, mp->m_fsname); return error; } @@ -2058,7 +2092,7 @@ xfs_iunlink_remove( /* * This is called to return an inode to the inode free list. * The inode should already be truncated to 0 length and have - * no pages associated with it. This routine also assumes that + * no pages associated with it. This routine also assumes that * the inode is already a part of the transaction. * * The on-disk copy of the inode will have been added to the list @@ -2116,12 +2150,12 @@ xfs_ifree( * being added or deleted as indicated in rec_diff. Move the records * and pointers in if_broot to fit the new size. When shrinking this * will eliminate holes between the records and pointers created by - * the caller. When growing this will create holes to be filled in + * the caller. When growing this will create holes to be filled in * by the caller. * * The caller must not request to add more records than would fit in * the on-disk inode root. If the if_broot is currently NULL, then - * if we adding records one will be allocated. The caller must also + * if we adding records one will be allocated. The caller must also * not request that the number of records go below zero, although * it can go to zero. * @@ -2389,7 +2423,7 @@ xfs_idata_realloc( * Stuck with malloc/realloc. * For inline data, the underlying buffer must be * a multiple of 4 bytes in size so that it can be - * logged and stay on word boundaries. We enforce + * logged and stay on word boundaries. We enforce * that here. */ real_size = roundup(new_size, 4); @@ -2476,7 +2510,7 @@ xfs_idestroy_fork( /* * If the format is local, then we can't have an extents - * array so just look for an inline data array. If we're + * array so just look for an inline data array. If we're * not local then we may or may not have an extents list, * so check and free it up if we do. */ @@ -2581,7 +2615,7 @@ xfs_ipin( /* * Decrement the pin count of the given inode, and wake up - * anyone in xfs_iwait_unpin() if the count goes to 0. The + * anyone in xfs_iwait_unpin() if the count goes to 0. The * inode must have been previoulsy pinned with a call to xfs_ipin(). */ void @@ -2867,7 +2901,7 @@ xfs_iflush( /* * We can't flush the inode until it is unpinned, so - * wait for it. We know noone new can pin it, because + * wait for it. We know noone new can pin it, because * we are holding the inode lock shared and you need * to hold it exclusively to pin the inode. */ @@ -2967,7 +3001,7 @@ xfs_iflush( for (iq = ip->i_cnext; iq != ip; iq = iq->i_cnext) { /* * Do an un-protected check to see if the inode is dirty and - * is a candidate for flushing. These checks will be repeated + * is a candidate for flushing. These checks will be repeated * later after the appropriate locks are acquired. */ iip = iq->i_itemp; @@ -3049,13 +3083,13 @@ corrupt_out: return XFS_ERROR(EFSCORRUPTED); cluster_corrupt_out: - /* Corruption detected in the clustering loop. Invalidate the + /* Corruption detected in the clustering loop. Invalidate the * inode buffer and shut down the filesystem. */ mutex_spinunlock(&ch->ch_lock, s); /* - * Clean up the buffer. If it was B_DELWRI, just release it -- + * Clean up the buffer. If it was B_DELWRI, just release it -- * brelse can handle it with no problems. If not, shut down the * filesystem before releasing the buffer. */ @@ -3135,7 +3169,7 @@ xfs_iflush_int( * so if we clear i_update_core after they set it we * are guaranteed to see their updates to the timestamps. * I believe that this depends on strongly ordered memory - * semantics, but we have that. We use the SYNCHRONIZE + * semantics, but we have that. We use the SYNCHRONIZE * macro to make sure that the compiler does not reorder * the i_update_core access below the data copy below. */ @@ -3252,7 +3286,7 @@ xfs_iflush_int( /* * We've recorded everything logged in the inode, so we'd * like to clear the ilf_fields bits so we don't log and - * flush things unnecessarily. However, we can't stop + * flush things unnecessarily. However, we can't stop * logging all this information until the data we've copied * into the disk buffer is written to disk. If we did we might * overwrite the copy of the inode in the log with all the @@ -3263,7 +3297,7 @@ xfs_iflush_int( * When logging the inode, these bits are moved back to the * ilf_fields field. In the xfs_iflush_done() routine we * clear ili_last_fields, since we know that the information - * those bits represent is permanently on disk. As long as + * those bits represent is permanently on disk. As long as * the flush completes before the inode is logged again, then * both ilf_fields and ili_last_fields will be cleared. * @@ -3282,7 +3316,7 @@ xfs_iflush_int( iip->ili_format.ilf_fields = 0; iip->ili_logged = 1; - ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ + ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ AIL_LOCK(mp,s); iip->ili_flush_lsn = iip->ili_item.li_lsn; AIL_UNLOCK(mp, s); @@ -3395,7 +3429,7 @@ xfs_iflush_all( * nonexistent vnode. We break from the loop * since we know that we modify * it by pulling ourselves from it in xfs_reclaim() - * called via vn_purge() below. Set ip to the next + * called via vn_purge() below. Set ip to the next * entry in the list anyway so we'll know below * whether we reached the end or not. */ @@ -3493,7 +3527,7 @@ xfs_iaccess( /* * Return whether or not it is OK to swap to the given file in the - * given range. Return 0 for OK and otherwise return the error. + * given range. Return 0 for OK and otherwise return the error. * * It is only OK to swap to a file if it has no holes, and all * extents have been initialized. @@ -3564,7 +3598,7 @@ xfs_ichgtime(xfs_inode_t *ip, /* * We're not supposed to change timestamps in readonly-mounted - * filesystems. Throw it away if anyone asks us. + * filesystems. Throw it away if anyone asks us. */ if (vp->v_vfsp->vfs_flag & VFS_RDONLY) return; diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 562abe71a22f..f735172c5f3c 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,19 +29,19 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_INODE_H__ -#define __XFS_INODE_H__ +#ifndef __XFS_INODE_H__ +#define __XFS_INODE_H__ /* * File incore extent information, present for each of data & attr forks. */ -#define XFS_INLINE_EXTS 2 -#define XFS_INLINE_DATA 32 +#define XFS_INLINE_EXTS 2 +#define XFS_INLINE_DATA 32 typedef struct xfs_ifork { int if_bytes; /* bytes in if_u1 */ int if_real_bytes; /* bytes allocated in if_u1 */ xfs_bmbt_block_t *if_broot; /* file's incore btree root */ - short if_broot_bytes; /* bytes allocated for root */ + short if_broot_bytes; /* bytes allocated for root */ unsigned char if_flags; /* per-fork flags */ unsigned char if_ext_max; /* max # of extent records */ xfs_extnum_t if_lastex; /* last if_extents used */ @@ -62,26 +62,26 @@ typedef struct xfs_ifork { /* * Flags for xfs_ichgtime(). */ -#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ -#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */ -#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */ +#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ +#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */ +#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */ /* * Per-fork incore inode flags. */ -#define XFS_IFINLINE 0x0001 /* Inline data is read in */ -#define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */ -#define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */ +#define XFS_IFINLINE 0x0001 /* Inline data is read in */ +#define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */ +#define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */ /* * Flags for xfs_imap() and xfs_dilocate(). */ -#define XFS_IMAP_LOOKUP 0x1 +#define XFS_IMAP_LOOKUP 0x1 /* * Maximum number of extent pointers in if_u1.if_extents. */ -#define XFS_MAX_INCORE_EXTENTS 32768 +#define XFS_MAX_INCORE_EXTENTS 32768 #ifdef __KERNEL__ @@ -144,8 +144,8 @@ typedef struct xfs_iocore { } xfs_iocore_t; -#define io_dmevmask io_dmattrs.da_dmevmask -#define io_dmstate io_dmattrs.da_dmstate +#define io_dmevmask io_dmattrs.da_dmevmask +#define io_dmstate io_dmattrs.da_dmstate #define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj)) #define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj)) @@ -170,7 +170,7 @@ extern void xfs_iocore_inode_reinit(struct xfs_inode *); * file system to hash the inodes for that file system. */ typedef struct xfs_ihash { - struct xfs_inode *ih_next; + struct xfs_inode *ih_next; rwlock_t ih_lock; uint ih_version; } xfs_ihash_t; @@ -182,7 +182,7 @@ typedef struct xfs_ihash { #define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)ino) % (mp)->m_ihsize)) /* - * This is the xfs inode cluster hash. This hash is used by xfs_iflush to + * This is the xfs inode cluster hash. This hash is used by xfs_iflush to * find inodes that share a cluster and can be flushed to disk at the same * time. */ @@ -208,7 +208,7 @@ typedef struct xfs_chash { * Most of the on-disk inode is embedded in the i_d field. * * The extent pointers/inline file space, however, are managed - * separately. The memory for this information is pointed to by + * separately. The memory for this information is pointed to by * the if_u1 unions depending on the type of the data. * This is used to linearize the array of extents for fast in-core * access. This is used until the file's number of extents @@ -274,7 +274,7 @@ typedef struct xfs_inode { unsigned char i_update_core; /* timestamps/size is dirty */ unsigned char i_update_size; /* di_size field is dirty */ unsigned int i_gen; /* generation count */ - unsigned int i_delayed_blks; /* count of delay alloc blks */ + unsigned int i_delayed_blks; /* count of delay alloc blks */ xfs_dinode_core_t i_d; /* most of ondisk inode */ xfs_chashlist_t *i_chash; /* cluster hash list header */ @@ -286,7 +286,7 @@ typedef struct xfs_inode { struct ktrace *i_xtrace; /* inode extent list trace */ struct ktrace *i_btrace; /* inode bmap btree trace */ struct ktrace *i_rwtrace; /* inode read/write trace */ - struct ktrace *i_strat_trace; /* inode strat_write trace */ + struct ktrace *i_strat_trace; /* inode strat_write trace */ struct ktrace *i_lock_trace; /* inode lock/unlock trace */ struct ktrace *i_dir_trace; /* inode directory trace */ #endif /* DEBUG */ @@ -300,57 +300,57 @@ typedef struct xfs_inode { */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR) xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w); -#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w) +#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w) #else -#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp) +#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q) int xfs_ifork_q(xfs_inode_t *ip); -#define XFS_IFORK_Q(ip) xfs_ifork_q(ip) +#define XFS_IFORK_Q(ip) xfs_ifork_q(ip) #else -#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) +#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE) int xfs_ifork_dsize(xfs_inode_t *ip); -#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip) +#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip) #else -#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) +#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE) int xfs_ifork_asize(xfs_inode_t *ip); -#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip) +#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip) #else -#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) +#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE) int xfs_ifork_size(xfs_inode_t *ip, int w); -#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w) +#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w) #else -#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) +#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT) int xfs_ifork_format(xfs_inode_t *ip, int w); -#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w) +#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w) #else -#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) +#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET) void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n); -#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n) +#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n) #else -#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) +#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS) int xfs_ifork_nextents(xfs_inode_t *ip, int w); -#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w) +#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w) #else -#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) +#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET) void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); -#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n) +#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n) #else -#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) +#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) #endif @@ -359,25 +359,25 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); /* * In-core inode flags. */ -#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */ -#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */ -#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */ -#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */ +#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */ +#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */ +#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */ +#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */ /* * Flags for inode locking. */ -#define XFS_IOLOCK_EXCL 0x001 -#define XFS_IOLOCK_SHARED 0x002 -#define XFS_ILOCK_EXCL 0x004 -#define XFS_ILOCK_SHARED 0x008 -#define XFS_IUNLOCK_NONOTIFY 0x010 +#define XFS_IOLOCK_EXCL 0x001 +#define XFS_IOLOCK_SHARED 0x002 +#define XFS_ILOCK_EXCL 0x004 +#define XFS_ILOCK_SHARED 0x008 +#define XFS_IUNLOCK_NONOTIFY 0x010 #define XFS_EXTENT_TOKEN_RD 0x040 #define XFS_SIZE_TOKEN_RD 0x080 #define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD) #define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */ #define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND) -#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) +#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) #define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND) @@ -389,22 +389,22 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); /* * Flags for xfs_iflush() */ -#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1 -#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2 -#define XFS_IFLUSH_SYNC 3 -#define XFS_IFLUSH_ASYNC 4 -#define XFS_IFLUSH_DELWRI 5 +#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1 +#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2 +#define XFS_IFLUSH_SYNC 3 +#define XFS_IFLUSH_ASYNC 4 +#define XFS_IFLUSH_DELWRI 5 /* * Flags for xfs_iflush_all. */ -#define XFS_FLUSH_ALL 0x1 +#define XFS_FLUSH_ALL 0x1 /* * Flags for xfs_itruncate_start(). */ -#define XFS_ITRUNC_DEFINITE 0x1 -#define XFS_ITRUNC_MAYBE 0x2 +#define XFS_ITRUNC_DEFINITE 0x1 +#define XFS_ITRUNC_MAYBE 0x2 /* * max file offset is 2^(31+PAGE_SHIFT) - 1 (due to linux page cache) @@ -416,22 +416,22 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV) struct vnode *xfs_itov(xfs_inode_t *ip); -#define XFS_ITOV(ip) xfs_itov(ip) +#define XFS_ITOV(ip) xfs_itov(ip) #else -#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) +#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) #endif -#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) +#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV) struct bhv_desc *xfs_itobhv(xfs_inode_t *ip); -#define XFS_ITOBHV(ip) xfs_itobhv(ip) +#define XFS_ITOBHV(ip) xfs_itobhv(ip) #else -#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) +#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI) xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp); -#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp) +#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp) #else -#define XFS_BHVTOI(bhvp) \ +#define XFS_BHVTOI(bhvp) \ ((xfs_inode_t *)((char *)(bhvp) - \ (char *)&(((xfs_inode_t *)0)->i_bhv_desc))) #endif @@ -461,7 +461,7 @@ void xfs_chash_init(struct xfs_mount *); void xfs_chash_free(struct xfs_mount *); xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t, struct xfs_trans *); -void xfs_inode_lock_init(xfs_inode_t *, struct vnode *); +void xfs_inode_lock_init(xfs_inode_t *, struct vnode *); int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, uint, xfs_inode_t **, xfs_daddr_t); void xfs_iput(xfs_inode_t *, uint); @@ -533,7 +533,7 @@ void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t); #if defined(DEBUG) void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *); #else -#define xfs_inobp_check(mp, bp) +#define xfs_inobp_check(mp, bp) #endif /* DEBUG */ extern struct kmem_zone *xfs_chashlist_zone; diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 15be5aa6f41d..ddb56a743e15 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -36,7 +36,32 @@ * items as well as utility routines used by the inode specific * transaction routines. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_buf_item.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_ag.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_rw.h" kmem_zone_t *xfs_ili_zone; /* inode log item zone */ @@ -244,15 +269,15 @@ xfs_inode_item_format( * update the timestamps BEFORE setting i_update_core, * so if we clear i_update_core after they set it we * are guaranteed to see their updates to the timestamps - * either here. Likewise, if they set it after we clear it + * either here. Likewise, if they set it after we clear it * here, we'll see it either on the next commit of this * inode or the next time the inode gets flushed via * xfs_iflush(). This depends on strongly ordered memory - * semantics, but we have that. We use the SYNCHRONIZE + * semantics, but we have that. We use the SYNCHRONIZE * macro to make sure that the compiler does not reorder * the i_update_core access below the data copy below. */ - if (ip->i_update_core) { + if (ip->i_update_core) { ip->i_update_core = 0; SYNCHRONIZE(); } @@ -274,7 +299,7 @@ xfs_inode_item_format( /* * If this is really an old format inode, then we need to * log it as such. This means that we have to copy the link - * count from the new field to the old. We don't have to worry + * count from the new field to the old. We don't have to worry * about the new fields, because nothing trusts them as long as * the old inode version number is there. If the superblock already * has a new version number, then we don't bother converting back. @@ -324,7 +349,7 @@ xfs_inode_item_format( vecp->i_addr = (char *)(ip->i_df.if_u1.if_extents); vecp->i_len = ip->i_df.if_bytes; - } else + } else #endif { /* @@ -449,7 +474,7 @@ xfs_inode_item_format( */ vecp->i_addr = (char *)(ip->i_afp->if_u1.if_extents); vecp->i_len = ip->i_afp->if_bytes; -#else +#else ASSERT(iip->ili_aextents_buf == NULL); /* * Need to endian flip before logging @@ -516,7 +541,7 @@ xfs_inode_item_format( /* * This is called to pin the inode associated with the inode log - * item in memory so it cannot be written out. Do this by calling + * item in memory so it cannot be written out. Do this by calling * xfs_ipin() to bump the pin count in the inode while holding the * inode pin lock. */ @@ -842,7 +867,7 @@ xfs_inode_item_push( * Since we were able to lock the inode's flush lock and * we found it on the AIL, the inode must be dirty. This * is because the inode is removed from the AIL while still - * holding the flush lock in xfs_iflush_done(). Thus, if + * holding the flush lock in xfs_iflush_done(). Thus, if * we found it in the AIL and were able to obtain the flush * lock without sleeping, then there must not have been * anyone in the process of flushing the inode. @@ -851,7 +876,7 @@ xfs_inode_item_push( iip->ili_format.ilf_fields != 0); /* - * Write out the inode. The completion routine ('iflush_done') will + * Write out the inode. The completion routine ('iflush_done') will * pull it from the AIL, mark it clean, unlock the flush lock. */ (void) xfs_iflush(ip, XFS_IFLUSH_DELWRI); @@ -966,7 +991,7 @@ xfs_iflush_done( /* * We only want to pull the item from the AIL if it is * actually there and its location in the log has not - * changed since we started the flush. Thus, we only bother + * changed since we started the flush. Thus, we only bother * if the ili_logged flag is set and the inode's lsn has not * changed. First we check the lsn outside * the lock since it's cheaper, and then we recheck while diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h index c893dbfc9d37..ffd20f88fea9 100644 --- a/fs/xfs/xfs_inode_item.h +++ b/fs/xfs/xfs_inode_item.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,12 +29,12 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_INODE_ITEM_H__ -#define __XFS_INODE_ITEM_H__ +#ifndef __XFS_INODE_ITEM_H__ +#define __XFS_INODE_ITEM_H__ /* * This is the structure used to lay out an inode log item in the - * log. The size of the inline data/extents/b-tree root to be logged + * log. The size of the inline data/extents/b-tree root to be logged * (if any) is indicated in the ilf_dsize field. Changes to this structure * must be added on to the end. * @@ -48,13 +48,13 @@ * -Version 2 of this structure (XFS_LI_6_1_INODE) is currently the entire * structure. This was released with IRIX 6.0.1-XFS and IRIX 6.1. * -Version 3 of this structure (XFS_LI_INODE) is the same as version 2 - * so a new structure definition wasn't necessary. However, we had + * so a new structure definition wasn't necessary. However, we had * to add a new type because the inode cluster size changed from 4K * to 8K and the version number had to be rev'ved to keep older kernels * from trying to recover logs with the 8K buffers in them. The logging * code can handle recovery on different-sized clusters now so hopefully * this'll be the last time we need to change the inode log item just - * for a change in the inode cluster size. This new version was + * for a change in the inode cluster size. This new version was * released with IRIX 6.2. */ typedef struct xfs_inode_log_format { @@ -89,38 +89,38 @@ typedef struct xfs_inode_log_format_v1 { /* * Flags for xfs_trans_log_inode flags field. */ -#define XFS_ILOG_CORE 0x001 /* log standard inode fields */ -#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */ -#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */ -#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */ -#define XFS_ILOG_DEV 0x010 /* log the dev field */ -#define XFS_ILOG_UUID 0x020 /* log the uuid field */ -#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */ -#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */ -#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */ - -#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ +#define XFS_ILOG_CORE 0x001 /* log standard inode fields */ +#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */ +#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */ +#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */ +#define XFS_ILOG_DEV 0x010 /* log the dev field */ +#define XFS_ILOG_UUID 0x020 /* log the uuid field */ +#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */ +#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */ +#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */ + +#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ XFS_ILOG_DBROOT | XFS_ILOG_DEV | \ XFS_ILOG_UUID | XFS_ILOG_ADATA | \ XFS_ILOG_AEXT | XFS_ILOG_ABROOT) -#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ +#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ XFS_ILOG_DBROOT) -#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ +#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ XFS_ILOG_ABROOT) -#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ +#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \ XFS_ILOG_DEV | XFS_ILOG_UUID | \ XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ XFS_ILOG_ABROOT) -#define XFS_ILI_HOLD 0x1 -#define XFS_ILI_IOLOCKED_EXCL 0x2 -#define XFS_ILI_IOLOCKED_SHARED 0x4 +#define XFS_ILI_HOLD 0x1 +#define XFS_ILI_IOLOCKED_EXCL 0x2 +#define XFS_ILI_IOLOCKED_SHARED 0x4 -#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) +#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) #ifdef __KERNEL__ @@ -145,10 +145,10 @@ typedef struct xfs_inode_log_item { data exts */ struct xfs_bmbt_rec_64 *ili_aextents_buf; /* array of logged attr exts */ - unsigned int ili_pushbuf_flag; /* one bit used in push_ail */ + unsigned int ili_pushbuf_flag; /* one bit used in push_ail */ #ifdef DEBUG - uint64_t ili_push_owner; /* one who sets pushbuf_flag + uint64_t ili_push_owner; /* one who sets pushbuf_flag above gets to push the buf */ #endif #ifdef XFS_TRANS_DEBUG @@ -161,9 +161,9 @@ typedef struct xfs_inode_log_item { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA) int xfs_ilog_fdata(int w); -#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w) +#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w) #else -#define XFS_ILOG_FDATA(w) \ +#define XFS_ILOG_FDATA(w) \ ((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA) #endif @@ -171,16 +171,16 @@ int xfs_ilog_fdata(int w); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT) int xfs_ilog_fbroot(int w); -#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w) +#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w) #else -#define XFS_ILOG_FBROOT(w) \ +#define XFS_ILOG_FBROOT(w) \ ((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT) int xfs_ilog_fext(int w); -#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w) +#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w) #else -#define XFS_ILOG_FEXT(w) \ +#define XFS_ILOG_FEXT(w) \ ((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT) #endif diff --git a/fs/xfs/xfs_inum.h b/fs/xfs/xfs_inum.h index 7fa4aca62d09..044306dc428e 100644 --- a/fs/xfs/xfs_inum.h +++ b/fs/xfs/xfs_inum.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_INUM_H__ -#define __XFS_INUM_H__ +#define __XFS_INUM_H__ /* * Inode number format: @@ -40,7 +40,7 @@ * high agno_log-agblklog-inopblog bits - 0 */ -typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */ +typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */ /* * Useful inode bits for this kernel. @@ -48,126 +48,126 @@ typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */ * costs too much. */ #if XFS_BIG_FILESYSTEMS -typedef xfs_ino_t xfs_intino_t; +typedef xfs_ino_t xfs_intino_t; #else -typedef __uint32_t xfs_intino_t; +typedef __uint32_t xfs_intino_t; #endif -#define NULLFSINO ((xfs_ino_t)-1) -#define NULLAGINO ((xfs_agino_t)-1) +#define NULLFSINO ((xfs_ino_t)-1) +#define NULLAGINO ((xfs_agino_t)-1) struct xfs_mount; #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK) __uint32_t xfs_ino_mask(int k); -#define XFS_INO_MASK(k) xfs_ino_mask(k) +#define XFS_INO_MASK(k) xfs_ino_mask(k) #else -#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1)) +#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS) int xfs_ino_offset_bits(struct xfs_mount *mp); -#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp) +#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp) #else -#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog) +#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS) int xfs_ino_agbno_bits(struct xfs_mount *mp); -#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp) +#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp) #else -#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog) +#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS) int xfs_ino_agino_bits(struct xfs_mount *mp); -#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp) +#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp) #else -#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log) +#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS) int xfs_ino_agno_bits(struct xfs_mount *mp); -#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp) +#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp) #else -#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log) +#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS) int xfs_ino_bits(struct xfs_mount *mp); -#define XFS_INO_BITS(mp) xfs_ino_bits(mp) +#define XFS_INO_BITS(mp) xfs_ino_bits(mp) #else -#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)) +#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO) xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i); -#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i) +#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i) #else -#define XFS_INO_TO_AGNO(mp,i) \ +#define XFS_INO_TO_AGNO(mp,i) \ ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO) xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i); -#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i) +#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i) #else -#define XFS_INO_TO_AGINO(mp,i) \ +#define XFS_INO_TO_AGINO(mp,i) \ ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO) xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i); -#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i) +#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i) #else -#define XFS_INO_TO_AGBNO(mp,i) \ +#define XFS_INO_TO_AGBNO(mp,i) \ (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET) int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i); -#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i) +#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i) #else -#define XFS_INO_TO_OFFSET(mp,i) \ +#define XFS_INO_TO_OFFSET(mp,i) \ ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB) xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i); -#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i) +#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i) #else -#define XFS_INO_TO_FSB(mp,i) \ +#define XFS_INO_TO_FSB(mp,i) \ XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO) xfs_ino_t xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i); -#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i) +#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i) #else -#define XFS_AGINO_TO_INO(mp,a,i) \ +#define XFS_AGINO_TO_INO(mp,a,i) \ (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO) xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i); -#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i) +#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i) #else -#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) +#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET) int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i); -#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i) +#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i) #else -#define XFS_AGINO_TO_OFFSET(mp,i) \ +#define XFS_AGINO_TO_OFFSET(mp,i) \ ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO) xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o); -#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o) +#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o) #else -#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ +#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) #endif #if XFS_BIG_FILESYSTEMS -#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) -#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32)) +#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) +#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32)) #else -#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL)) +#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL)) #endif -#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL)) +#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL)) #endif /* __XFS_INUM_H__ */ diff --git a/fs/xfs/xfs_iocore.c b/fs/xfs/xfs_iocore.c index 38f7d9dde577..0d97aeae6d6b 100644 --- a/fs/xfs/xfs_iocore.c +++ b/fs/xfs/xfs_iocore.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,38 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_itable.h" +#include "xfs_btree.h" +#include "xfs_alloc.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_error.h" +#include "xfs_bit.h" +#include "xfs_rw.h" +#include "xfs_quota.h" +#include "xfs_trans_space.h" +#include "xfs_dmapi.h" STATIC xfs_fsize_t diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 8fe8097215df..50836e4864b4 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,30 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_ag.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_ialloc.h" +#include "xfs_itable.h" +#include "xfs_error.h" /* * Return stat information for one inode. @@ -51,8 +74,8 @@ xfs_bulkstat_one( xfs_dinode_t *dip; /* dinode inode pointer */ xfs_dinode_core_t *dic; /* dinode core info pointer */ xfs_inode_t *ip = NULL; /* incore inode pointer */ - xfs_arch_t arch; /* these are set according to */ - __uint16_t di_flags; /* temp */ + xfs_arch_t arch; /* these are set according to */ + __uint16_t di_flags; /* temp */ buf = (xfs_bstat_t *)buffer; dip = (xfs_dinode_t *)dibuff; @@ -100,10 +123,10 @@ xfs_bulkstat_one( /* * The inode format changed when we moved the link count and * made it 32 bits long. If this is an old format inode, - * convert it in memory to look like a new one. If it gets + * convert it in memory to look like a new one. If it gets * flushed to disk we will convert back before flushing or - * logging it. We zero out the new projid field and the old link - * count field. We'll handle clearing the pad field (the remains + * logging it. We zero out the new projid field and the old link + * count field. We'll handle clearing the pad field (the remains * of the old uuid field) when we actually convert the inode to * the new format. We don't change the version number so that we * can distinguish this from a real new format inode. @@ -214,25 +237,25 @@ xfs_bulkstat( xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ int end_of_ag; /* set if we've seen the ag end */ int error; /* error code */ - int fmterror;/* bulkstat formatter result */ + int fmterror;/* bulkstat formatter result */ __int32_t gcnt; /* current btree rec's count */ xfs_inofree_t gfree; /* current btree rec's free mask */ xfs_agino_t gino; /* current btree rec's start inode */ int i; /* loop index */ - int icount; /* count of inodes good in irbuf */ + int icount; /* count of inodes good in irbuf */ xfs_ino_t ino; /* inode number (filesystem) */ xfs_inobt_rec_t *irbp; /* current irec buffer pointer */ - xfs_inobt_rec_t *irbuf; /* start of irec buffer */ + xfs_inobt_rec_t *irbuf; /* start of irec buffer */ xfs_inobt_rec_t *irbufend; /* end of good irec buffer entries */ xfs_ino_t lastino=0; /* last inode number returned */ int nbcluster; /* # of blocks in a cluster */ int nicluster; /* # of inodes in a cluster */ - int nimask; /* mask for inode clusters */ - int nirbuf; /* size of irbuf */ + int nimask; /* mask for inode clusters */ + int nirbuf; /* size of irbuf */ int rval; /* return value error code */ int tmp; /* result value from btree calls */ int ubcount; /* size of user's buffer */ - int ubleft; /* spaces left in user's buffer */ + int ubleft; /* spaces left in user's buffer */ xfs_caddr_t ubufp; /* current pointer into user's buffer */ xfs_buf_t *bp; /* ptr to on-disk inode cluster buf */ xfs_dinode_t *dip; /* ptr into bp for specific inode */ @@ -360,7 +383,7 @@ xfs_bulkstat( error = xfs_inobt_increment(cur, 0, &tmp); } else { /* - * Start of ag. Lookup the first inode chunk. + * Start of ag. Lookup the first inode chunk. */ error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &tmp); icount = 0; @@ -595,7 +618,7 @@ int /* error status */ xfs_bulkstat_single( xfs_mount_t *mp, /* mount point for filesystem */ xfs_ino_t *lastinop, /* inode to return */ - xfs_caddr_t buffer, /* buffer with inode stats */ + xfs_caddr_t buffer, /* buffer with inode stats */ int *done) /* 1 if there're more stats to get */ { xfs_bstat_t bstat; /* one bulkstat result structure */ @@ -654,7 +677,7 @@ xfs_inumbers( int bcount; xfs_inogrp_t *buffer; int bufidx; - xfs_btree_cur_t *cur; + xfs_btree_cur_t *cur; int error; __int32_t gcnt; xfs_inofree_t gfree; diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h index 9e68317ecb7f..6e636668072c 100644 --- a/fs/xfs/xfs_itable.h +++ b/fs/xfs/xfs_itable.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_ITABLE_H__ -#define __XFS_ITABLE_H__ +#define __XFS_ITABLE_H__ /* * xfs_bulkstat() is used to fill in xfs_bstat structures as well as dm_stat @@ -38,8 +38,8 @@ * that will iget the inode and fill in the appropriate structure. * see xfs_bulkstat_one() and dm_bulkstat_one() in dmi_xfs.c */ -typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, - struct xfs_trans *tp, +typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, + struct xfs_trans *tp, xfs_ino_t ino, void *buffer, xfs_daddr_t bno, @@ -48,15 +48,15 @@ typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, /* * Values for stat return value. */ -#define BULKSTAT_RV_NOTHING 0 -#define BULKSTAT_RV_DIDONE 1 -#define BULKSTAT_RV_GIVEUP 2 +#define BULKSTAT_RV_NOTHING 0 +#define BULKSTAT_RV_DIDONE 1 +#define BULKSTAT_RV_GIVEUP 2 /* * Values for bulkstat flag argument. */ -#define BULKSTAT_FG_IGET 0x1 /* Go through the buffer cache */ -#define BULKSTAT_FG_QUICK 0x2 /* No iget, walk the dinode cluster */ +#define BULKSTAT_FG_IGET 0x1 /* Go through the buffer cache */ +#define BULKSTAT_FG_QUICK 0x2 /* No iget, walk the dinode cluster */ #define BULKSTAT_FG_VFSLOCKED 0x4 /* Already have vfs lock */ /* @@ -96,7 +96,7 @@ xfs_inumbers( xfs_mount_t *mp, /* mount point for filesystem */ xfs_trans_t *tp, /* transaction pointer */ xfs_ino_t *last, /* last inode returned */ - int *count, /* size of buffer/count returned */ + int *count, /* size of buffer/count returned */ xfs_caddr_t buffer);/* buffer with inode descriptions */ #endif /* __XFS_ITABLE_H__ */ diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index b758a8bdc618..c87fc8f15cc9 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,25 @@ * High level interface routines for log manager */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_ag.h" +#include "xfs_sb.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_error.h" +#include "xfs_log_priv.h" +#include "xfs_buf_item.h" +#include "xfs_alloc_btree.h" +#include "xfs_log_recover.h" +#include "xfs_bit.h" +#include "xfs_rw.h" +#include "xfs_trans_priv.h" #define xlog_write_adv_cnt(ptr, len, off, bytes) \ @@ -46,7 +64,7 @@ STATIC int xlog_bdstrat_cb(struct xfs_buf *); STATIC int xlog_commit_record(xfs_mount_t *mp, xlog_ticket_t *ticket, xlog_in_core_t **, xfs_lsn_t *); -STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, +STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, dev_t log_dev, xfs_daddr_t blk_offset, int num_bblks); @@ -77,7 +95,7 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log, int eventual_size); STATIC int xlog_state_sync(xlog_t *log, xfs_lsn_t lsn, uint flags); STATIC int xlog_state_sync_all(xlog_t *log, uint flags); -STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); +STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); /* local functions to manipulate grant head */ STATIC int xlog_grant_log_space(xlog_t *log, @@ -87,7 +105,7 @@ STATIC void xlog_grant_push_ail(xfs_mount_t *mp, STATIC void xlog_regrant_reserve_log_space(xlog_t *log, xlog_ticket_t *ticket); STATIC int xlog_regrant_write_log_space(xlog_t *log, - xlog_ticket_t *ticket); + xlog_ticket_t *ticket); STATIC void xlog_ungrant_log_space(xlog_t *log, xlog_ticket_t *ticket); @@ -137,7 +155,7 @@ int xlog_error_mod = 33; */ #if defined(XLOG_NOLOG) || defined(DEBUG) int xlog_debug = 1; -dev_t xlog_devt = 0; +dev_t xlog_devt = 0; #endif #if defined(XFS_LOG_TRACE) @@ -220,8 +238,8 @@ xlog_trace_iclog(xlog_in_core_t *iclog, uint state) } #else -#define xlog_trace_loggrant(log,tic,string) -#define xlog_trace_iclog(iclog,state) +#define xlog_trace_loggrant(log,tic,string) +#define xlog_trace_iclog(iclog,state) #endif /* XFS_LOG_TRACE */ /* @@ -251,7 +269,7 @@ xfs_log_done(xfs_mount_t *mp, void **iclog, uint flags) { - xlog_t *log = mp->m_log; + xlog_t *log = mp->m_log; xlog_ticket_t *ticket = (xfs_log_ticket_t) xtic; xfs_lsn_t lsn = 0; @@ -306,7 +324,7 @@ xfs_log_done(xfs_mount_t *mp, * Asynchronous forces are implemented by setting the WANT_SYNC * bit in the appropriate in-core log and then returning. * - * Synchronous forces are implemented with a semaphore. All callers + * Synchronous forces are implemented with a semaphore. All callers * to force a given lsn to disk will wait on a semaphore attached to the * specific in-core log. When given in-core log finally completes its * write to disk, that thread will wake up all threads waiting on the @@ -396,7 +414,7 @@ xfs_log_release_iclog(xfs_mount_t *mp, } /* - * Initialize log manager data. This routine is intended to be called when + * Initialize log manager data. This routine is intended to be called when * a system boots up. It is not a per filesystem initialization. * * As you can see, we currently do nothing. @@ -588,7 +606,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) #ifdef DEBUG xlog_in_core_t *first_iclog; #endif - xfs_log_iovec_t reg[1]; + xfs_log_iovec_t reg[1]; xfs_log_ticket_t tic = 0; xfs_lsn_t lsn; int error; @@ -717,8 +735,8 @@ xfs_log_unmount_dealloc(xfs_mount_t *mp) } /* - * Write region vectors to log. The write happens using the space reservation - * of the ticket (tic). It is not a requirement that all writes for a given + * Write region vectors to log. The write happens using the space reservation + * of the ticket (tic). It is not a requirement that all writes for a given * transaction occur with one call to xfs_log_write(). */ int @@ -774,7 +792,7 @@ xfs_log_move_tail(xfs_mount_t *mp, s = GRANT_LOCK(log); - /* Also an illegal lsn. 1 implies that we aren't passing in a legal + /* Also an illegal lsn. 1 implies that we aren't passing in a legal * tail_lsn. */ if (tail_lsn != 1) @@ -895,7 +913,7 @@ xlog_assign_tail_lsn(xfs_mount_t *mp) * is passed in the cycle/bytes formal parms. In the special case where * the reserve head has wrapped passed the tail, this calculation is no * longer valid. In this case, just return 0 which means there is no space - * in the log. This works for all places where this function is called + * in the log. This works for all places where this function is called * with the reserve head. Of course, if the write head were to ever * wrap the tail, we should blow up. Rather than catch this case here, * we depend on other ASSERTions in other parts of the code. XXXmiken @@ -1030,8 +1048,8 @@ xlog_bdstrat_cb(struct xfs_buf *bp) /* * Return size of each in-core log record buffer. * - * Low memory machines only get 2 16KB buffers. We don't want to waste - * memory here. However, all other machines get at least 2 32KB buffers. + * Low memory machines only get 2 16KB buffers. We don't want to waste + * memory here. However, all other machines get at least 2 32KB buffers. * The number is hard coded because we don't care about the minimum * memory size, just 32MB systems. * @@ -1177,7 +1195,7 @@ xlog_alloc_log(xfs_mount_t *mp, log->l_mp = mp; log->l_dev = log_dev; - log->l_logsize = BBTOB(num_bblks); + log->l_logsize = BBTOB(num_bblks); log->l_logBBstart = blk_offset; log->l_logBBsize = num_bblks; log->l_roundoff = 0; @@ -1194,11 +1212,11 @@ xlog_alloc_log(xfs_mount_t *mp, log->l_grant_reserve_cycle = 1; log->l_grant_write_bytes = 0; log->l_grant_write_cycle = 1; - log->l_quotaoffs_flag = 0; /* XFS_LI_QUOTAOFF logitems */ + log->l_quotaoffs_flag = 0; /* XFS_LI_QUOTAOFF logitems */ xlog_get_iclog_buffer_size(mp, log); - bp = log->l_xbuf = XFS_getrbuf(0,mp); /* get my locked buffer */ /* mp needed for pagebuf/linux only */ + bp = log->l_xbuf = XFS_getrbuf(0,mp); /* get my locked buffer */ /* mp needed for pagebuf/linux only */ XFS_BUF_SET_TARGET(bp, mp->m_logdev_targp); XFS_BUF_SET_SIZE(bp, log->l_iclog_size); @@ -1278,13 +1296,13 @@ xlog_alloc_log(xfs_mount_t *mp, * ticket. Return the lsn of the commit record. */ STATIC int -xlog_commit_record(xfs_mount_t *mp, +xlog_commit_record(xfs_mount_t *mp, xlog_ticket_t *ticket, xlog_in_core_t **iclog, xfs_lsn_t *commitlsnp) { int error; - xfs_log_iovec_t reg[1]; + xfs_log_iovec_t reg[1]; reg[0].i_addr = 0; reg[0].i_len = 0; @@ -1301,12 +1319,12 @@ xlog_commit_record(xfs_mount_t *mp, /* * Push on the buffer cache code if we ever use more than 75% of the on-disk * log space. This code pushes on the lsn which would supposedly free up - * the 25% which we want to leave free. We may need to adopt a policy which + * the 25% which we want to leave free. We may need to adopt a policy which * pushes on an lsn which is further along in the log once we reach the high - * water mark. In this manner, we would be creating a low water mark. + * water mark. In this manner, we would be creating a low water mark. */ void -xlog_grant_push_ail(xfs_mount_t *mp, +xlog_grant_push_ail(xfs_mount_t *mp, int need_bytes) { xlog_t *log = mp->m_log; /* pointer to the log */ @@ -1368,14 +1386,14 @@ xlog_grant_push_ail(xfs_mount_t *mp, /* * Flush out the in-core log (iclog) to the on-disk log in a synchronous or * asynchronous fashion. Previously, we should have moved the current iclog - * ptr in the log to point to the next available iclog. This allows further + * ptr in the log to point to the next available iclog. This allows further * write to continue while this code syncs out an iclog ready to go. * Before an in-core log can be written out, the data section must be scanned * to save away the 1st word of each BBSIZE block into the header. We replace * it with the current cycle count. Each BBSIZE block is tagged with the * cycle count because there in an implicit assumption that drives will * guarantee that entire 512 byte blocks get written at once. In other words, - * we can't have part of a 512 byte block written and part not written. By + * we can't have part of a 512 byte block written and part not written. By * tagging each block, we will know which blocks are valid when recovering * after an unclean shutdown. * @@ -1386,7 +1404,7 @@ xlog_grant_push_ail(xfs_mount_t *mp, * * The entire log manager uses a logical block numbering scheme. Only * log_sync (and then only bwrite()) know about the fact that the log may - * not start with block zero on a given device. The log block start offset + * not start with block zero on a given device. The log block start offset * is added immediately before calling bwrite(). */ @@ -1432,7 +1450,7 @@ xlog_sync(xlog_t *log, log->l_roundoff += iclog->ic_roundoff; - xlog_pack_data(log, iclog); /* put cycle number in every block */ + xlog_pack_data(log, iclog); /* put cycle number in every block */ /* real byte length */ INT_SET(iclog->ic_header.h_len, ARCH_CONVERT, iclog->ic_offset); @@ -1510,7 +1528,7 @@ xlog_sync(xlog_t *log, /* * Bump the cycle numbers at the start of each block * since this part of the buffer is at the start of - * a new cycle. Watch out for the header magic number + * a new cycle. Watch out for the header magic number * case, though. */ for (i=0; i<split; i += BBSIZE) { @@ -1651,7 +1669,7 @@ xlog_state_finish_copy(xlog_t *log, * syncing routine. When a single log_write region needs to span * multiple in-core logs, the XLOG_CONTINUE_TRANS bit should be set * on all log operation writes which don't contain the end of the - * region. The XLOG_END_TRANS bit is used for the in-core log + * region. The XLOG_END_TRANS bit is used for the in-core log * operation which contains the end of the continued log_write region. * 3. When xlog_state_get_iclog_space() grabs the rest of the current iclog, * we don't really know exactly how much space will be used. As a result, @@ -1744,7 +1762,7 @@ xlog_write(xfs_mount_t * mp, INT_SET(logop_head->oh_tid, ARCH_CONVERT, ticket->t_tid); logop_head->oh_clientid = ticket->t_clientid; INT_ZERO(logop_head->oh_len, ARCH_CONVERT); - logop_head->oh_flags = XLOG_START_TRANS; + logop_head->oh_flags = XLOG_START_TRANS; INT_ZERO(logop_head->oh_res2, ARCH_CONVERT); ticket->t_flags &= ~XLOG_TIC_INITED; /* clear bit */ firstwr = 1; /* increment log ops below */ @@ -1787,7 +1805,7 @@ xlog_write(xfs_mount_t * mp, * need_copy is the amount we'd like to copy if everything could * fit in the current memcpy. */ - need_copy = reg[index].i_len - partial_copy_len; + need_copy = reg[index].i_len - partial_copy_len; copy_off = partial_copy_len; if (need_copy <= iclog->ic_size - log_offset) { /*complete write */ @@ -1866,9 +1884,9 @@ xlog_write(xfs_mount_t * mp, ***************************************************************************** */ -/* Clean iclogs starting from the head. This ordering must be +/* Clean iclogs starting from the head. This ordering must be * maintained, so an iclog doesn't become ACTIVE beyond one that - * is SYNCING. This is also required to maintain the notion that we use + * is SYNCING. This is also required to maintain the notion that we use * a counting semaphore to hold off would be writers to the log when every * iclog is trying to sync to disk. * @@ -1883,7 +1901,7 @@ xlog_state_clean_log(xlog_t *log) iclog = log->l_iclog; do { if (iclog->ic_state == XLOG_STATE_DIRTY) { - iclog->ic_state = XLOG_STATE_ACTIVE; + iclog->ic_state = XLOG_STATE_ACTIVE; iclog->ic_offset = 0; iclog->ic_callback = 0; /* don't need to free */ /* @@ -1956,7 +1974,7 @@ STATIC xfs_lsn_t xlog_get_lowest_lsn( xlog_t *log) { - xlog_in_core_t *lsn_log; + xlog_in_core_t *lsn_log; xfs_lsn_t lowest_lsn, lsn; lsn_log = log->l_iclog; @@ -2003,7 +2021,7 @@ xlog_state_do_callback( do { /* * Scan all iclogs starting with the one pointed to by the - * log. Reset this starting point each time the log is + * log. Reset this starting point each time the log is * unlocked (during callbacks). * * Keep looping through iclogs until one full pass is made @@ -2032,7 +2050,7 @@ xlog_state_do_callback( */ if (!(iclog->ic_state & XLOG_STATE_IOERROR)) { /* - * Can only perform callbacks in order. Since + * Can only perform callbacks in order. Since * this iclog is not in the DONE_SYNC/ * DO_CALLBACK state, we skip the rest and * just try to clean up. If we set our iclog @@ -2159,7 +2177,7 @@ xlog_state_do_callback( * * SYNCING - i/o completion will go through logs * DONE_SYNC - interrupt thread should be waiting for - * LOG_LOCK + * LOG_LOCK * IOERROR - give up hope all ye who enter here */ if (iclog->ic_state == XLOG_STATE_SYNCING || @@ -2185,7 +2203,7 @@ xlog_state_do_callback( * Finish transitioning this iclog to the dirty state. * * Make sure that we completely execute this routine only when this is - * the last call to the iclog. There is a good chance that iclog flushes, + * the last call to the iclog. There is a good chance that iclog flushes, * when we reach the end of the physical log, get turned into 2 separate * calls to bwrite. Hence, one iclog flush could generate two calls to this * routine. By using the reference count bwritecnt, we guarantee that only @@ -2241,7 +2259,7 @@ xlog_state_done_syncing( * sleep. The flush semaphore is set to the number of in-core buffers and * decremented around disk syncing. Therefore, if all buffers are syncing, * this semaphore will cause new writes to sleep until a sync completes. - * Otherwise, this code just does p() followed by v(). This approximates + * Otherwise, this code just does p() followed by v(). This approximates * a sleep/wakeup except we can't race. * * The in-core logs are used in a circular fashion. They are not used @@ -2336,7 +2354,7 @@ restart: /* Do we have enough room to write the full amount in the remainder * of this iclog? Or must we continue a write on the next iclog and - * mark this iclog as completely taken? In the case where we switch + * mark this iclog as completely taken? In the case where we switch * iclogs (to mark it taken), this particular iclog will release/sync * to disk in xlog_write(). */ @@ -2654,8 +2672,8 @@ xlog_regrant_reserve_log_space(xlog_t *log, * Give back the space left from a reservation. * * All the information we need to make a correct determination of space left - * is present. For non-permanent reservations, things are quite easy. The - * count should have been decremented to zero. We only need to deal with the + * is present. For non-permanent reservations, things are quite easy. The + * count should have been decremented to zero. We only need to deal with the * space remaining in the current reservation part of the ticket. If the * ticket contains a permanent reservation, there may be left over space which * needs to be released. A count of N means that N-1 refills of the current @@ -2722,7 +2740,7 @@ xlog_state_put_ticket(xlog_t *log, */ int xlog_state_release_iclog(xlog_t *log, - xlog_in_core_t *iclog) + xlog_in_core_t *iclog) { SPLDECL(s); int sync = 0; /* do we sync? */ @@ -2770,7 +2788,7 @@ xlog_state_release_iclog(xlog_t *log, * This routine will mark the current iclog in the ring as WANT_SYNC * and move the current iclog pointer to the next iclog in the ring. * When this routine is called from xlog_state_get_iclog_space(), the - * exact size of the iclog has not yet been determined. All we know is + * exact size of the iclog has not yet been determined. All we know is * that every data block. We have run out of space in this log record. */ STATIC void @@ -2823,7 +2841,7 @@ xlog_state_switch_iclogs(xlog_t *log, * implementation means this routine will *not* write out zero length LRs. * * Basically, we try and perform an intelligent scan of the in-core logs. - * If we determine there is no flushable data, we just return. There is no + * If we determine there is no flushable data, we just return. There is no * flushable data if: * * 1. the current iclog is active and has no data; the previous iclog @@ -2866,7 +2884,7 @@ xlog_state_sync_all(xlog_t *log, uint flags) * If the head is dirty or (active and empty), then * we need to look at the previous iclog. If the previous * iclog is active or dirty we are done. There is nothing - * to sync out. Otherwise, we attach ourselves to the + * to sync out. Otherwise, we attach ourselves to the * previous iclog and go to sleep. */ if (iclog->ic_state == XLOG_STATE_DIRTY || @@ -2901,7 +2919,7 @@ xlog_state_sync_all(xlog_t *log, uint flags) goto no_sleep; } else { /* Someone else is writing to this iclog. - * Use its call to flush out the data. However, + * Use its call to flush out the data. However, * the other thread may not force out this LR, * so we mark it WANT_SYNC. */ @@ -3101,7 +3119,7 @@ xlog_state_ticket_alloc(xlog_t *log) /* * The kmem_zalloc may sleep, so we shouldn't be holding the - * global lock. XXXmiken: may want to use zone allocator. + * global lock. XXXmiken: may want to use zone allocator. */ buf = (xfs_caddr_t) kmem_zalloc(NBPP, 0); @@ -3150,7 +3168,7 @@ xlog_ticket_put(xlog_t *log, sv_destroy(&ticket->t_sema); /* - * Don't think caching will make that much difference. It's + * Don't think caching will make that much difference. It's * more important to make debug easier. */ #if 0 @@ -3160,7 +3178,7 @@ xlog_ticket_put(xlog_t *log, /* no need to clear fields */ #else /* When we debug, it is easier if tickets are cycled */ - ticket->t_next = 0; + ticket->t_next = 0; if (log->l_tail != 0) { log->l_tail->t_next = ticket; } else { @@ -3196,7 +3214,7 @@ xlog_ticket_get(xlog_t *log, goto alloc; } tic = log->l_freelist; - log->l_freelist = tic->t_next; + log->l_freelist = tic->t_next; if (log->l_freelist == NULL) log->l_tail = NULL; log->l_ticket_cnt--; @@ -3204,7 +3222,7 @@ xlog_ticket_get(xlog_t *log, /* * Permanent reservations have up to 'cnt'-1 active log operations - * in the log. A unit in this case is the amount of space for one + * in the log. A unit in this case is the amount of space for one * of these log operations. Normal reservations have a cnt of 1 * and their unit amount is the total amount of space required. * The following line of code adds one log record header length @@ -3212,7 +3230,7 @@ xlog_ticket_get(xlog_t *log, * log record. * * One more XLOG_HEADER_SIZE is added to account for possible - * round off errors when syncing a LR to disk. The bytes are + * round off errors when syncing a LR to disk. The bytes are * subtracted if the thread using this ticket is the first writer * to a new LR. * @@ -3251,8 +3269,8 @@ xlog_ticket_get(xlog_t *log, * part of the log in case we trash the log structure. */ void -xlog_verify_dest_ptr(xlog_t *log, - __psint_t ptr) +xlog_verify_dest_ptr(xlog_t *log, + __psint_t ptr) { int i; int good_ptr = 0; @@ -3275,7 +3293,7 @@ xlog_verify_disk_cycle_no(xlog_t *log, { xfs_buf_t *bp; uint cycle_no; - xfs_daddr_t i; + xfs_daddr_t i; if (BLOCK_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT) < 10) { cycle_no = CYCLE_LSN(iclog->ic_header.h_lsn, ARCH_CONVERT); @@ -3608,4 +3626,3 @@ xlog_iclogs_empty(xlog_t *log) } while (iclog != log->l_iclog); return(1); } - diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index e6c1a8a78351..7b280da83a4d 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,7 +29,7 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_LOG_H__ +#ifndef __XFS_LOG_H__ #define __XFS_LOG_H__ #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -69,10 +69,10 @@ xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch) return 0; } -#define XFS_LSN_CMP_ARCH(x,y,arch) _lsn_cmp(x, y, arch) -#define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT) -#define XFS_LSN_DIFF_ARCH(x,y,arch) _lsn_cmp(x, y, arch) -#define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT) +#define XFS_LSN_CMP_ARCH(x,y,arch) _lsn_cmp(x, y, arch) +#define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT) +#define XFS_LSN_DIFF_ARCH(x,y,arch) _lsn_cmp(x, y, arch) +#define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT) /* * Macros, structures, prototypes for interface to the log manager. @@ -86,7 +86,7 @@ xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch) /* * Flags to xfs_log_done() */ -#define XFS_LOG_REL_PERM_RESERV 0x1 +#define XFS_LOG_REL_PERM_RESERV 0x1 /* @@ -137,7 +137,7 @@ typedef void* xfs_log_ticket_t; * to the log manager. */ typedef struct xfs_log_callback { - struct xfs_log_callback *cb_next; + struct xfs_log_callback *cb_next; void (*cb_func)(void *, int); void *cb_arg; } xfs_log_callback_t; @@ -173,13 +173,13 @@ int xfs_log_reserve(struct xfs_mount *mp, __uint8_t clientid, uint flags); int xfs_log_write(struct xfs_mount *mp, - xfs_log_iovec_t region[], + xfs_log_iovec_t region[], int nentries, xfs_log_ticket_t ticket, xfs_lsn_t *start_lsn); int xfs_log_unmount(struct xfs_mount *mp); int xfs_log_unmount_write(struct xfs_mount *mp); -void xfs_log_unmount_dealloc(struct xfs_mount *mp); +void xfs_log_unmount_dealloc(struct xfs_mount *mp); int xfs_log_force_umount(struct xfs_mount *mp, int logerror); int xfs_log_need_covered(struct xfs_mount *mp); diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index 3fd8a12bc280..37bcde28d967 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,11 +29,11 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_LOG_PRIV_H__ +#ifndef __XFS_LOG_PRIV_H__ #define __XFS_LOG_PRIV_H__ #if defined(XFS_ALL_TRACE) -#define XFS_LOG_TRACE +#define XFS_LOG_TRACE #endif #if !defined(DEBUG) @@ -136,7 +136,7 @@ void xlog_grant_sub_space(struct log *log, int bytes, int type); if (type == 'w') { \ (log)->l_grant_write_bytes -= (bytes); \ if ((log)->l_grant_write_bytes < 0) { \ - (log)->l_grant_write_bytes += (log)->l_logsize; \ + (log)->l_grant_write_bytes += (log)->l_logsize; \ (log)->l_grant_write_cycle--; \ } \ } else { \ @@ -158,7 +158,7 @@ void xlog_grant_add_space(struct log *log, int bytes, int type); if (type == 'w') { \ (log)->l_grant_write_bytes += (bytes); \ if ((log)->l_grant_write_bytes > (log)->l_logsize) { \ - (log)->l_grant_write_bytes -= (log)->l_logsize; \ + (log)->l_grant_write_bytes -= (log)->l_logsize; \ (log)->l_grant_write_cycle++; \ } \ } else { \ @@ -259,7 +259,7 @@ void xlog_grant_add_space(struct log *log, int bytes, int type); */ #define XLOG_CHKSUM_MISMATCH 0x1 /* used only during recovery */ #define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */ -#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ +#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ #define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being shutdown */ typedef __uint32_t xlog_tid_t; @@ -343,11 +343,11 @@ typedef __uint32_t xlog_tid_t; typedef struct xlog_ticket { sv_t t_sema; /* sleep on this semaphore :20 */ - struct xlog_ticket *t_next; /* : 4 */ + struct xlog_ticket *t_next; /* : 4 */ struct xlog_ticket *t_prev; /* : 4 */ xlog_tid_t t_tid; /* transaction identifier : 4 */ int t_curr_res; /* current reservation in bytes : 4 */ - int t_unit_res; /* unit reservation in bytes : 4 */ + int t_unit_res; /* unit reservation in bytes : 4 */ __uint8_t t_ocnt; /* original count : 1 */ __uint8_t t_cnt; /* current count : 1 */ __uint8_t t_clientid; /* who does this belong to; : 1 */ @@ -359,7 +359,7 @@ typedef struct xlog_ticket { typedef struct xlog_op_header { xlog_tid_t oh_tid; /* transaction id of operation : 4 b */ int oh_len; /* bytes in data region : 4 b */ - __uint8_t oh_clientid; /* who sent me this : 1 b */ + __uint8_t oh_clientid; /* who sent me this : 1 b */ __uint8_t oh_flags; /* : 1 b */ ushort oh_res2; /* 32 bit align : 2 b */ } xlog_op_header_t; @@ -391,12 +391,12 @@ typedef struct xlog_rec_header { xfs_lsn_t h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */ uint h_chksum; /* may not be used; non-zero if used : 4 */ int h_prev_block; /* block number to previous LR : 4 */ - int h_num_logops; /* number of log operations in this LR : 4 */ + int h_num_logops; /* number of log operations in this LR : 4 */ uint h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* new fields */ - int h_fmt; /* format of log record : 4 */ - uuid_t h_fs_uuid; /* uuid of FS : 16 */ - int h_size; /* iclog size : 4 */ + int h_fmt; /* format of log record : 4 */ + uuid_t h_fs_uuid; /* uuid of FS : 16 */ + int h_size; /* iclog size : 4 */ } xlog_rec_header_t; typedef struct xlog_rec_ext_header { @@ -405,7 +405,7 @@ typedef struct xlog_rec_ext_header { } xlog_rec_ext_header_t; #ifdef __KERNEL__ /* - * - A log record header is 512 bytes. There is plenty of room to grow the + * - A log record header is 512 bytes. There is plenty of room to grow the * xlog_rec_header_t into the reserved space. * - ic_data follows, so a write to disk can start at the beginning of * the iclog. @@ -457,21 +457,21 @@ typedef struct xlog_in_core { /* * Defines to save our code from this glop. */ -#define ic_forcesema hic_fields.ic_forcesema +#define ic_forcesema hic_fields.ic_forcesema #define ic_writesema hic_fields.ic_writesema -#define ic_next hic_fields.ic_next -#define ic_prev hic_fields.ic_prev -#define ic_bp hic_fields.ic_bp -#define ic_log hic_fields.ic_log -#define ic_callback hic_fields.ic_callback -#define ic_callback_tail hic_fields.ic_callback_tail -#define ic_trace hic_fields.ic_trace -#define ic_size hic_fields.ic_size -#define ic_offset hic_fields.ic_offset -#define ic_refcnt hic_fields.ic_refcnt -#define ic_roundoff hic_fields.ic_roundoff -#define ic_bwritecnt hic_fields.ic_bwritecnt -#define ic_state hic_fields.ic_state +#define ic_next hic_fields.ic_next +#define ic_prev hic_fields.ic_prev +#define ic_bp hic_fields.ic_bp +#define ic_log hic_fields.ic_log +#define ic_callback hic_fields.ic_callback +#define ic_callback_tail hic_fields.ic_callback_tail +#define ic_trace hic_fields.ic_trace +#define ic_size hic_fields.ic_size +#define ic_offset hic_fields.ic_offset +#define ic_refcnt hic_fields.ic_refcnt +#define ic_roundoff hic_fields.ic_roundoff +#define ic_bwritecnt hic_fields.ic_bwritecnt +#define ic_state hic_fields.ic_state #define ic_datap hic_fields.ic_datap #define ic_header hic_data->ic_h.hic_header @@ -483,29 +483,29 @@ typedef struct xlog_in_core { */ typedef struct log { /* The following block of fields are changed while holding icloglock */ - sema_t l_flushsema; /* iclog flushing semaphore */ + sema_t l_flushsema; /* iclog flushing semaphore */ int l_flushcnt; /* # of procs waiting on this sema */ int l_ticket_cnt; /* free ticket count */ int l_ticket_tcnt; /* total ticket count */ int l_covered_state;/* state of "covering disk log entries" */ - xlog_ticket_t *l_freelist; /* free list of tickets */ + xlog_ticket_t *l_freelist; /* free list of tickets */ xlog_ticket_t *l_unmount_free;/* kmem_free these addresses */ - xlog_ticket_t *l_tail; /* free list of tickets */ - xlog_in_core_t *l_iclog; /* head log queue */ - lock_t l_icloglock; /* grab to change iclog state */ - xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */ + xlog_ticket_t *l_tail; /* free list of tickets */ + xlog_in_core_t *l_iclog; /* head log queue */ + lock_t l_icloglock; /* grab to change iclog state */ + xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */ xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */ - struct xfs_mount *l_mp; /* mount point */ - struct xfs_buf *l_xbuf; /* extra buffer for log wrapping */ - dev_t l_dev; /* dev_t of log */ - xfs_daddr_t l_logBBstart; /* start block of log */ - int l_logsize; /* size of log in bytes */ - int l_logBBsize; /* size of log in 512 byte chunks */ + struct xfs_mount *l_mp; /* mount point */ + struct xfs_buf *l_xbuf; /* extra buffer for log wrapping */ + dev_t l_dev; /* dev_t of log */ + xfs_daddr_t l_logBBstart; /* start block of log */ + int l_logsize; /* size of log in bytes */ + int l_logBBsize; /* size of log in 512 byte chunks */ int l_roundoff; /* round off error of all iclogs */ - int l_curr_cycle; /* Cycle number of log writes */ - int l_prev_cycle; /* Cycle # b4 last block increment */ - int l_curr_block; /* current logical block of log */ - int l_prev_block; /* previous logical block of log */ + int l_curr_cycle; /* Cycle number of log writes */ + int l_prev_cycle; /* Cycle # b4 last block increment */ + int l_curr_block; /* current logical block of log */ + int l_prev_block; /* previous logical block of log */ int l_iclog_size; /* size of log in bytes */ int l_iclog_size_log;/* log power size of log */ int l_iclog_bufs; /* number of iclog buffers */ @@ -530,8 +530,8 @@ typedef struct log { uint l_flags; uint l_quotaoffs_flag;/* XFS_DQ_*, if QUOTAOFFs found */ struct xfs_buf_cancel **l_buf_cancel_table; - int l_iclog_hsize; /* size of iclog header */ - int l_iclog_heads; /* number of iclog header sectors */ + int l_iclog_hsize; /* size of iclog header */ + int l_iclog_heads; /* number of iclog header sectors */ } xlog_t; diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 18eeda703102..c22ad59dffd3 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,40 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <xfs_log_recover.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_ag.h" +#include "xfs_sb.h" +#include "xfs_trans.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_error.h" +#include "xfs_bmap_btree.h" +#include "xfs_alloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_imap.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_ialloc_btree.h" +#include "xfs_ialloc.h" +#include "xfs_error.h" +#include "xfs_log_priv.h" +#include "xfs_buf_item.h" +#include "xfs_alloc_btree.h" +#include "xfs_log_recover.h" +#include "xfs_extfree_item.h" +#include "xfs_trans_priv.h" +#include "xfs_bit.h" +#include "xfs_quota.h" +#include "xfs_rw.h" STATIC int xlog_find_zeroed(struct log *log, xfs_daddr_t *blk_no); @@ -44,8 +76,8 @@ STATIC void xlog_recover_check_summary(xlog_t *log); STATIC void xlog_recover_check_ail(xfs_mount_t *mp, xfs_log_item_t *lip, int gen); #else -#define xlog_recover_check_summary(log) -#define xlog_recover_check_ail(mp, lip, gen) +#define xlog_recover_check_summary(log) +#define xlog_recover_check_ail(mp, lip, gen) #endif /* DEBUG */ @@ -69,7 +101,7 @@ xlog_put_bp(xfs_buf_t *bp) /* - * nbblks should be uint, but oh well. Just want to catch that 32-bit length. + * nbblks should be uint, but oh well. Just want to catch that 32-bit length. */ int xlog_bread(xlog_t *log, @@ -242,7 +274,7 @@ xlog_recover_iodone( /* * This routine finds (to an approximation) the first block in the physical - * log which contains the given cycle. It uses a binary search algorithm. + * log which contains the given cycle. It uses a binary search algorithm. * Note that the algorithm can not be perfect because the disk will not * necessarily be perfect. */ @@ -299,8 +331,8 @@ xlog_find_verify_cycle( xlog_t *log, xfs_daddr_t i, j; uint cycle; xfs_buf_t *bp; - char *buf = NULL; - int error = 0; + char *buf = NULL; + int error = 0; xfs_daddr_t bufblks; bufblks = 1 << ffs(nbblks); @@ -356,17 +388,17 @@ out: STATIC int xlog_find_verify_log_record(xlog_t *log, - xfs_daddr_t start_blk, - xfs_daddr_t *last_blk, + xfs_daddr_t start_blk, + xfs_daddr_t *last_blk, int extra_bblks) { - xfs_daddr_t i; + xfs_daddr_t i; xfs_buf_t *bp; - char *buf = NULL; - xlog_rec_header_t *head = NULL; - int error = 0; - int smallmem = 0; - int num_blks = *last_blk - start_blk; + char *buf = NULL; + xlog_rec_header_t *head = NULL; + int error = 0; + int smallmem = 0; + int num_blks = *last_blk - start_blk; int xhdrs; ASSERT(start_blk != 0 || *last_blk != start_blk); @@ -422,8 +454,8 @@ xlog_find_verify_log_record(xlog_t *log, /* * We may have found a log record header before we expected one. * last_blk will be the 1st block # with a given cycle #. We may end - * up reading an entire log record. In this case, we don't want to - * reset last_blk. Only when last_blk points in the middle of a log + * up reading an entire log record. In this case, we don't want to + * reset last_blk. Only when last_blk points in the middle of a log * record do we update last_blk. */ if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { @@ -465,12 +497,12 @@ int xlog_find_head(xlog_t *log, xfs_daddr_t *return_head_blk) { - xfs_buf_t *bp; + xfs_buf_t *bp; xfs_daddr_t new_blk, first_blk, start_blk, last_blk, head_blk; - int num_scan_bblks; + int num_scan_bblks; uint first_half_cycle, last_half_cycle; uint stop_on_cycle; - int error, log_bbnum = log->l_logBBsize; + int error, log_bbnum = log->l_logBBsize; /* Is the end of the log device zeroed? */ if ((error = xlog_find_zeroed(log, &first_blk)) == -1) { @@ -508,12 +540,12 @@ xlog_find_head(xlog_t *log, /* * If the 1st half cycle number is equal to the last half cycle number, * then the entire log is stamped with the same cycle number. In this - * case, head_blk can't be set to zero (which makes sense). The below + * case, head_blk can't be set to zero (which makes sense). The below * math doesn't work out properly with head_blk equal to zero. Instead, * we set it to log_bbnum which is an illegal block number, but this * value makes the math correct. If head_blk doesn't changed through * all the tests below, *head_blk is set to zero at the very end rather - * than log_bbnum. In a sense, log_bbnum and zero are the same block + * than log_bbnum. In a sense, log_bbnum and zero are the same block * in a circular file. */ if (first_half_cycle == last_half_cycle) { @@ -521,15 +553,15 @@ xlog_find_head(xlog_t *log, * In this case we believe that the entire log should have cycle * number last_half_cycle. We need to scan backwards from the * end verifying that there are no holes still containing - * last_half_cycle - 1. If we find such a hole, then the start + * last_half_cycle - 1. If we find such a hole, then the start * of that hole will be the new head. The simple case looks like - * x | x ... | x - 1 | x + * x | x ... | x - 1 | x * Another case that fits this picture would be - * x | x + 1 | x ... | x + * x | x + 1 | x ... | x * In this case the head really is somwhere at the end of the * log, as one of the latest writes at the beginning was incomplete. * One more case is - * x | x + 1 | x ... | x - 1 | x + * x | x + 1 | x ... | x - 1 | x * This is really the combination of the above two cases, and the * head has to end up at the start of the x-1 hole at the end of * the log. @@ -547,20 +579,20 @@ xlog_find_head(xlog_t *log, * In this case we want to find the first block with cycle number * matching last_half_cycle. We expect the log to be some * variation on - * x + 1 ... | x ... + * x + 1 ... | x ... * The first block with cycle number x (last_half_cycle) will be - * where the new head belongs. First we do a binary search for + * where the new head belongs. First we do a binary search for * the first occurrence of last_half_cycle. The binary search * may not be totally accurate, so then we scan back from there * looking for occurrences of last_half_cycle before us. If * that backwards scan wraps around the beginning of the log, * then we look for occurrences of last_half_cycle - 1 at the * end of the log. The cases we're looking for look like - * x + 1 ... | x | x + 1 | x ... - * ^ binary search stopped here + * x + 1 ... | x | x + 1 | x ... + * ^ binary search stopped here * or - * x + 1 ... | x ... | x - 1 | x - * <---------> less than scan distance + * x + 1 ... | x ... | x - 1 | x + * <---------> less than scan distance */ stop_on_cycle = last_half_cycle; if ((error = xlog_find_cycle_start(log, bp, first_blk, @@ -569,7 +601,7 @@ xlog_find_head(xlog_t *log, } /* - * Now validate the answer. Scan back some number of maximum possible + * Now validate the answer. Scan back some number of maximum possible * blocks and make sure each one has the expected cycle number. The * maximum is determined by the total possible amount of buffering * in the in-core log. The following number can be made tighter if @@ -590,27 +622,27 @@ xlog_find_head(xlog_t *log, } else { /* need to read 2 parts of log */ /* * We are going to scan backwards in the log in two parts. First - * we scan the physical end of the log. In this part of the log, + * we scan the physical end of the log. In this part of the log, * we are looking for blocks with cycle number last_half_cycle - 1. * If we find one, then we know that the log starts there, as we've * found a hole that didn't get written in going around the end - * of the physical log. The simple case for this is - * x + 1 ... | x ... | x - 1 | x - * <---------> less than scan distance + * of the physical log. The simple case for this is + * x + 1 ... | x ... | x - 1 | x + * <---------> less than scan distance * If all of the blocks at the end of the log have cycle number * last_half_cycle, then we check the blocks at the start of the * log looking for occurrences of last_half_cycle. If we find one, * then our current estimate for the location of the first * occurrence of last_half_cycle is wrong and we move back to the * hole we've found. This case looks like - * x + 1 ... | x | x + 1 | x ... - * ^ binary search stopped here + * x + 1 ... | x | x + 1 | x ... + * ^ binary search stopped here * Another case we need to handle that only occurs in 256k logs is - * x + 1 ... | x ... | x+1 | x ... - * ^ binary search stops here + * x + 1 ... | x ... | x+1 | x ... + * ^ binary search stops here * In a 256k log, the scan at the end of the log will see the x+1 * blocks. We need to skip past those since that is certainly not - * the head of the log. By searching for last_half_cycle-1 we + * the head of the log. By searching for last_half_cycle-1 we * accomplish that. */ start_blk = log_bbnum - num_scan_bblks + head_blk; @@ -645,7 +677,7 @@ bad_blk: */ num_scan_bblks = BTOBB(XLOG_MAX_RECORD_BSIZE); if (head_blk >= num_scan_bblks) { - start_blk = head_blk - num_scan_bblks; /* don't read head_blk */ + start_blk = head_blk - num_scan_bblks; /* don't read head_blk */ /* start ptr at last block ptr before head_blk */ if ((error = xlog_find_verify_log_record(log, @@ -690,7 +722,7 @@ bad_blk: /* * When returning here, we have a good block number. Bad block * means that during a previous crash, we didn't have a clean break - * from cycle number N to cycle number N-1. In this case, we need + * from cycle number N to cycle number N-1. In this case, we need * to find the first block with cycle number N-1. */ return 0; @@ -710,11 +742,11 @@ bp_err: * This will be the block number of the last record to have its * associated buffers synced to disk. Every log record header has * a sync lsn embedded in it. LSNs hold block numbers, so it is easy - * to get a sync block number. The only concern is to figure out which + * to get a sync block number. The only concern is to figure out which * log record header to believe. * * The following algorithm uses the log record header with the largest - * lsn. The entire log record does not need to be valid. We only care + * lsn. The entire log record does not need to be valid. We only care * that the header is valid. * * We could speed up search by using current head_blk buffer, but it is not @@ -820,7 +852,7 @@ xlog_find_tail(xlog_t *log, /* * Look for unmount record. If we find it, then we know there - * was a clean unmount. Since 'i' could be the last block in + * was a clean unmount. Since 'i' could be the last block in * the physical log, we convert to a log block before comparing * to the head_blk. * @@ -909,7 +941,7 @@ exit: * Is the log zeroed at all? * * The last binary search should be changed to perform an X block read - * once X becomes small enough. You can then search linearly through + * once X becomes small enough. You can then search linearly through * the X blocks. This will cut down on the number of reads we need to do. * * If the log is partially zeroed, this routine will pass back the blkno @@ -926,10 +958,10 @@ xlog_find_zeroed(struct log *log, xfs_daddr_t *blk_no) { xfs_buf_t *bp; - uint first_cycle, last_cycle; + uint first_cycle, last_cycle; xfs_daddr_t new_blk, last_blk, start_blk; - xfs_daddr_t num_scan_bblks; - int error, log_bbnum = log->l_logBBsize; + xfs_daddr_t num_scan_bblks; + int error, log_bbnum = log->l_logBBsize; /* check totally zeroed log */ bp = xlog_get_bp(1,log->l_mp); @@ -967,7 +999,7 @@ xlog_find_zeroed(struct log *log, goto bp_err; /* - * Validate the answer. Because there is no way to guarantee that + * Validate the answer. Because there is no way to guarantee that * the entire log is made up of log records which are the same size, * we scan over the defined maximum blocks. At this point, the maximum * is not chosen to mean anything special. XXXmiken @@ -982,8 +1014,8 @@ xlog_find_zeroed(struct log *log, /* * We search for any instances of cycle number 0 that occur before * our current estimate of the head. What we're trying to detect is - * 1 ... | 0 | 1 | 0... - * ^ binary search ends here + * 1 ... | 0 | 1 | 0... + * ^ binary search ends here */ if ((error = xlog_find_verify_cycle(log, start_blk, (int)num_scan_bblks, 0, &new_blk))) @@ -1027,9 +1059,9 @@ xlog_write_log_records( xlog_rec_header_t *recp; int i, j; int end_block = start_block + blocks; - int error = 0; + int error = 0; xfs_buf_t *bp; - char *buf; + char *buf; int bufblks; bufblks = 1 << ffs(blocks); @@ -1160,7 +1192,7 @@ xlog_clear_stale_blocks( if ((head_block + max_distance) <= log->l_logBBsize) { /* * We can stomp all the blocks we need to without - * wrapping around the end of the log. Just do it + * wrapping around the end of the log. Just do it * in a single write. Use the cycle number of the * current cycle minus one so that the log will look like: * n ... | n - 1 ... @@ -1275,7 +1307,7 @@ xlog_recover_add_to_cont_trans(xlog_recover_t *trans, } /* xlog_recover_add_to_cont_trans */ -/* The next region to add is the start of a new region. It could be +/* The next region to add is the start of a new region. It could be * a whole region or it could be the first part of a new region. Because * of this, the assumption here is that the type and size fields of all * format structures fit into the first 32 bits of the structure. @@ -1460,7 +1492,7 @@ xlog_recover_do_buffer_pass1(xlog_t *log, xfs_buf_cancel_t *nextp; xfs_buf_cancel_t *prevp; xfs_buf_cancel_t **bucket; - xfs_buf_log_format_v1_t *obuf_f; + xfs_buf_log_format_v1_t *obuf_f; xfs_daddr_t blkno=0; uint len=0; ushort flags=0; @@ -1511,7 +1543,7 @@ xlog_recover_do_buffer_pass1(xlog_t *log, /* * The hash bucket is not empty, so search for duplicates of our - * record. If we find one them just bump its refcount. If not + * record. If we find one them just bump its refcount. If not * then add us at the end of the list. */ prevp = NULL; @@ -1554,7 +1586,7 @@ xlog_recover_do_buffer_pass2(xlog_t *log, xfs_buf_cancel_t *bcp; xfs_buf_cancel_t *prevp; xfs_buf_cancel_t **bucket; - xfs_buf_log_format_v1_t *obuf_f; + xfs_buf_log_format_v1_t *obuf_f; xfs_daddr_t blkno=0; ushort flags=0; uint len=0; @@ -1665,7 +1697,7 @@ xlog_recover_do_inode_buffer(xfs_mount_t *mp, int inodes_per_buf; xfs_agino_t *logged_nextp; xfs_agino_t *buffer_nextp; - xfs_buf_log_format_v1_t *obuf_f; + xfs_buf_log_format_v1_t *obuf_f; unsigned int *data_map=NULL; unsigned int map_size=0; @@ -1761,7 +1793,7 @@ xlog_recover_do_inode_buffer(xfs_mount_t *mp, } /* xlog_recover_do_inode_buffer */ /* - * Perform a 'normal' buffer recovery. Each logged region of the + * Perform a 'normal' buffer recovery. Each logged region of the * buffer should be copied over the corresponding region in the * given buffer. The bitmap in the buf log format structure indicates * where to place the logged data. @@ -1771,15 +1803,15 @@ STATIC void xlog_recover_do_reg_buffer(xfs_mount_t *mp, xlog_recover_item_t *item, xfs_buf_t *bp, - xfs_buf_log_format_t *buf_f) + xfs_buf_log_format_t *buf_f) { int i; int bit; int nbits; - xfs_buf_log_format_v1_t *obuf_f; + xfs_buf_log_format_v1_t *obuf_f; unsigned int *data_map=NULL; unsigned int map_size=0; - int error; + int error; switch (buf_f->blf_type) { case XFS_LI_BUF: @@ -1794,7 +1826,7 @@ xlog_recover_do_reg_buffer(xfs_mount_t *mp, break; } bit = 0; - i = 1; /* 0 is the buf format structure */ + i = 1; /* 0 is the buf format structure */ while (1) { bit = xfs_next_bit(data_map, map_size, bit); if (bit == -1) @@ -1967,7 +1999,7 @@ xlog_recover_do_dquot_buffer( if (mp->m_qflags == 0) { return; } - + type = 0; if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF) type |= XFS_DQ_USER; @@ -2011,7 +2043,7 @@ xlog_recover_do_buffer_trans(xlog_t *log, int pass) { xfs_buf_log_format_t *buf_f; - xfs_buf_log_format_v1_t *obuf_f; + xfs_buf_log_format_v1_t *obuf_f; xfs_mount_t *mp; xfs_buf_t *bp; int error; @@ -2091,7 +2123,7 @@ xlog_recover_do_buffer_trans(xlog_t *log, return XFS_ERROR(error); /* - * Perform delayed write on the buffer. Asynchronous writes will be + * Perform delayed write on the buffer. Asynchronous writes will be * slower when taking into account all the buffers to be flushed. * * Also make sure that only inode buffers with good sizes stay in @@ -2099,7 +2131,7 @@ xlog_recover_do_buffer_trans(xlog_t *log, * or XFS_INODE_CLUSTER_SIZE bytes, whichever is bigger. The inode * buffers in the log can be a different size if the log was generated * by an older kernel using unclustered inode buffers or a newer kernel - * running with a different inode cluster size. Regardless, if the + * running with a different inode cluster size. Regardless, if the * the inode buffer size isn't MAX(blocksize, XFS_INODE_CLUSTER_SIZE) * for *our* value of XFS_INODE_CLUSTER_SIZE, then we need to keep * the buffer out of the buffer cache so that the buffer won't @@ -2158,7 +2190,7 @@ xlog_recover_do_inode_trans(xlog_t *log, * its cluster is located on disk, and we can't allow * xfs_imap() to figure it out because the inode btrees * are not ready to be used. Therefore do not pass the - * XFS_IMAP_LOOKUP flag to xfs_imap(). This will give + * XFS_IMAP_LOOKUP flag to xfs_imap(). This will give * us only the single block in which the inode lives * rather than its cluster, so we must make sure to * invalidate the buffer when we write it out below. @@ -2308,7 +2340,7 @@ xlog_recover_do_inode_trans(xlog_t *log, } /* - * If we logged any attribute data, recover it. There may or + * If we logged any attribute data, recover it. There may or * may not have been any other non-core data logged in this * transaction. */ @@ -2531,7 +2563,7 @@ xlog_recover_do_efi_trans(xlog_t *log, /* * This routine is called when an efd format structure is found in - * a committed transaction in the log. It's purpose is to cancel + * a committed transaction in the log. It's purpose is to cancel * the corresponding efi if it was still in the log. To do this * it searches the AIL for the efi with an id equal to that in the * efd format structure. If we find it, we remove the efi from the @@ -2672,7 +2704,7 @@ xlog_recover_do_trans(xlog_t *log, * Remember that EFIs, EFDs, and IUNLINKs are handled later. */ STATIC void -xlog_recover_free_trans(xlog_recover_t *trans) +xlog_recover_free_trans(xlog_recover_t *trans) { xlog_recover_item_t *first_item, *item, *free_item; int i; @@ -2725,7 +2757,7 @@ xlog_recover_unmount_trans(xlog_recover_t *trans) /* * There are two valid states of the r_state field. 0 indicates that the - * transaction structure is in a normal state. We have either seen the + * transaction structure is in a normal state. We have either seen the * start of the transaction or the last operation we added was not a partial * operation. If the last operation we added to the transaction was a * partial operation, we need to mark r_state with XLOG_WAS_CONT_TRANS. @@ -2835,7 +2867,7 @@ xlog_recover_process_efi(xfs_mount_t *mp, /* * First check the validity of the extents described by the - * EFI. If any are bad, then assume that all are bad and + * EFI. If any are bad, then assume that all are bad and * just toss the EFI. */ for (i = 0; i < efip->efi_format.efi_nextents; i++) { @@ -2913,7 +2945,7 @@ xlog_recover_check_ail(xfs_mount_t *mp, * * When we start, we know that the EFIs are the only things in * the AIL. As we process them, however, other items are added - * to the AIL. Since everything added to the AIL must come after + * to the AIL. Since everything added to the AIL must come after * everything already in the AIL, we stop processing as soon as * we see something other than an EFI in the AIL. */ @@ -3009,7 +3041,7 @@ xlog_recover_clear_agi_bucket( * inodes will be on the lists in the AGI blocks. What we do * here is scan all the AGIs and fully truncate and free any * inodes found on the lists. Each inode is removed from the - * lists when it has been fully truncated and is freed. The + * lists when it has been fully truncated and is freed. The * freeing of the inode and its removal from the list must be * atomic. */ @@ -3091,7 +3123,7 @@ xlog_recover_process_iunlinks(xlog_t *log) * being sent when the * reference on the inode is * dropped. - */ + */ ip->i_d.di_dmevmask = 0; /* @@ -3114,9 +3146,9 @@ xlog_recover_process_iunlinks(xlog_t *log) * We can't read in the inode * this bucket points to, or * this inode is messed up. Just - * ditch this bucket of inodes. We + * ditch this bucket of inodes. We * will lose some inodes and space, - * but at least we won't hang. Call + * but at least we won't hang. Call * xlog_recover_clear_agi_bucket() * to perform a transaction to clear * the inode pointer in the bucket. @@ -3282,7 +3314,7 @@ xlog_unpack_data(xlog_rec_header_t *rhead, * Read the log from tail to head and process the log records found. * Handle the two cases where the tail and head are in the same cycle * and where the active portion of the log wraps around the end of - * the physical log separately. The pass parameter is passed through + * the physical log separately. The pass parameter is passed through * to the routines called to process the data and is not looked at * here. */ @@ -3306,12 +3338,12 @@ xlog_do_recovery_pass(xlog_t *log, /* * Read the header of the tail block and get the iclog buffer size from - * h_size. Use this to tell how many sectors make up the log header. + * h_size. Use this to tell how many sectors make up the log header. */ if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { /* * When using variable length iclogs, read first sector of iclog - * header and extract the header size from it. Get a new hbp that + * header and extract the header size from it. Get a new hbp that * is the correct size. */ hbp = xlog_get_bp(1, log->l_mp); @@ -3392,7 +3424,7 @@ xlog_do_recovery_pass(xlog_t *log, } } else { /* - * Perform recovery around the end of the physical log. When the head + * Perform recovery around the end of the physical log. When the head * is not on the same cycle number as the tail, we can't do a sequential * recovery as above. */ @@ -3507,12 +3539,12 @@ bread_err1: } /* - * Do the recovery of the log. We actually do this in two phases. + * Do the recovery of the log. We actually do this in two phases. * The two passes are necessary in order to implement the function - * of cancelling a record written into the log. The first pass + * of cancelling a record written into the log. The first pass * determines those things which have been cancelled, and the * second pass replays log items normally except for those which - * have been cancelled. The handling of the replay and cancellations + * have been cancelled. The handling of the replay and cancellations * takes place in the log item type specific routines. * * The table of items which have cancel records in the log is allocated @@ -3699,9 +3731,9 @@ xlog_recover(xlog_t *log, int readonly) /* * In the first part of recovery we replay inodes and buffers and build - * up the list of extent free items which need to be processed. Here + * up the list of extent free items which need to be processed. Here * we process the extent free items and clean up the on disk unlinked - * inode lists. This is separated from the first part of recovery so + * inode lists. This is separated from the first part of recovery so * that the root and real-time bitmap inodes can be read in from disk in * between the two stages. This is necessary so that we can free space * in the real-time portion of the file system. diff --git a/fs/xfs/xfs_log_recover.h b/fs/xfs/xfs_log_recover.h index b3bf72c1c47c..42158b442b55 100644 --- a/fs/xfs/xfs_log_recover.h +++ b/fs/xfs/xfs_log_recover.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,17 +29,17 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_LOG_RECOVER_H__ +#ifndef __XFS_LOG_RECOVER_H__ #define __XFS_LOG_RECOVER_H__ /* * Macros, structures, prototypes for internal log manager use. */ -#define XLOG_RHASH_BITS 4 -#define XLOG_RHASH_SIZE 16 +#define XLOG_RHASH_BITS 4 +#define XLOG_RHASH_SIZE 16 #define XLOG_RHASH_SHIFT 2 -#define XLOG_RHASH(tid) \ +#define XLOG_RHASH(tid) \ ((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1)) #define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK / 2 + 1) @@ -73,9 +73,9 @@ typedef struct xlog_recover { * This is the number of entries in the l_buf_cancel_table used during * recovery. */ -#define XLOG_BC_TABLE_SIZE 64 +#define XLOG_BC_TABLE_SIZE 64 -#define XLOG_RECOVER_PASS1 1 -#define XLOG_RECOVER_PASS2 2 +#define XLOG_RECOVER_PASS1 1 +#define XLOG_RECOVER_PASS2 2 #endif /* __XFS_LOG_RECOVER_H__ */ diff --git a/fs/xfs/xfs_mac.c b/fs/xfs/xfs_mac.c index 5b20891b7bb1..f875993d2489 100644 --- a/fs/xfs/xfs_mac.c +++ b/fs/xfs/xfs_mac.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" static xfs_mac_label_t *mac_low_high_lp; static xfs_mac_label_t *mac_high_low_lp; diff --git a/fs/xfs/xfs_mac.h b/fs/xfs/xfs_mac.h index 8a6179d9e591..8d59aaffeb8e 100644 --- a/fs/xfs/xfs_mac.h +++ b/fs/xfs/xfs_mac.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -40,23 +40,23 @@ * divisions (MINT). This is actually a header for the data structure which * will have an ml_list with more than one element. * - * ------------------------------- - * | ml_msen_type | ml_mint_type | - * ------------------------------- - * | ml_level | ml_grade | - * ------------------------------- - * | ml_catcount | - * ------------------------------- - * | ml_divcount | - * ------------------------------- - * | category 1 | - * | . . . | - * | category N | (where N = ml_catcount) - * ------------------------------- - * | division 1 | - * | . . . | - * | division M | (where M = ml_divcount) - * ------------------------------- + * ------------------------------- + * | ml_msen_type | ml_mint_type | + * ------------------------------- + * | ml_level | ml_grade | + * ------------------------------- + * | ml_catcount | + * ------------------------------- + * | ml_divcount | + * ------------------------------- + * | category 1 | + * | . . . | + * | category N | (where N = ml_catcount) + * ------------------------------- + * | division 1 | + * | . . . | + * | division M | (where M = ml_divcount) + * ------------------------------- */ #define XFS_MAC_MAX_SETS 250 typedef struct xfs_mac_label { @@ -70,18 +70,18 @@ typedef struct xfs_mac_label { __uint16_t ml_list[XFS_MAC_MAX_SETS]; } xfs_mac_label_t; -/* MSEN label type names. Choose an upper case ASCII character. */ +/* MSEN label type names. Choose an upper case ASCII character. */ #define XFS_MSEN_ADMIN_LABEL 'A' /* Admin: low<admin != tcsec<high */ #define XFS_MSEN_EQUAL_LABEL 'E' /* Wildcard - always equal */ #define XFS_MSEN_HIGH_LABEL 'H' /* System High - always dominates */ -#define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */ +#define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */ #define XFS_MSEN_LOW_LABEL 'L' /* System Low - always dominated */ #define XFS_MSEN_MLD_LABEL 'M' /* TCSEC label on a multi-level dir */ #define XFS_MSEN_MLD_LOW_LABEL 'N' /* System Low, multi-level dir */ #define XFS_MSEN_TCSEC_LABEL 'T' /* TCSEC label */ #define XFS_MSEN_UNKNOWN_LABEL 'U' /* unknown label */ -/* MINT label type names. Choose a lower case ASCII character. */ +/* MINT label type names. Choose a lower case ASCII character. */ #define XFS_MINT_BIBA_LABEL 'b' /* Dual of a TCSEC label */ #define XFS_MINT_EQUAL_LABEL 'e' /* Wildcard - always equal */ #define XFS_MINT_HIGH_LABEL 'h' /* High Grade - always dominates */ @@ -110,7 +110,7 @@ extern int xfs_mac_iaccess(struct xfs_inode *, mode_t, cred_t *); #define _MAC_EXISTS xfs_mac_vhaslabel #else -#define _MAC_XFS_IACCESS(i,m,c) (0) +#define _MAC_XFS_IACCESS(i,m,c) (0) #define _MAC_VACCESS(v,c,m) (0) #define _MAC_EXISTS (NULL) #endif diff --git a/fs/xfs/xfs_macros.c b/fs/xfs/xfs_macros.c index a4b66e0ddbc5..8b439a80e588 100644 --- a/fs/xfs/xfs_macros.c +++ b/fs/xfs/xfs_macros.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,10 +30,42 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#define XFS_MACRO_C - -#include <xfs.h> - +#define XFS_MACRO_C + +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_ialloc.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_rw.h" +#include "xfs_log_priv.h" +#include "xfs_da_btree.h" +#include "xfs_attr_leaf.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_bit.h" #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_ISNULLDSTARTBLOCK) int diff --git a/fs/xfs/xfs_macros.h b/fs/xfs/xfs_macros.h index a8f90d20fff4..0a9307514a48 100644 --- a/fs/xfs/xfs_macros.h +++ b/fs/xfs/xfs_macros.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,14 +30,14 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_MACROS_H__ -#define __XFS_MACROS_H__ +#define __XFS_MACROS_H__ /* * Set for debug kernels and simulation * These replacements save space. * Used in xfs_macros.c. */ -#define XFS_WANT_SPACE_C \ +#define XFS_WANT_SPACE_C \ (!defined(_STANDALONE) && defined(DEBUG)) /* @@ -45,60 +45,60 @@ * These replacements do not save space. * Used in xfs_macros.c. */ -#define XFS_WANT_FUNCS_C \ +#define XFS_WANT_FUNCS_C \ (!defined(_STANDALONE) && defined(DEBUG)) /* * Corresponding names used in .h files. */ -#define XFS_WANT_SPACE (XFS_WANT_SPACE_C && !defined(XFS_MACRO_C)) -#define XFS_WANT_FUNCS (XFS_WANT_FUNCS_C && !defined(XFS_MACRO_C)) +#define XFS_WANT_SPACE (XFS_WANT_SPACE_C && !defined(XFS_MACRO_C)) +#define XFS_WANT_FUNCS (XFS_WANT_FUNCS_C && !defined(XFS_MACRO_C)) /* * These are the macros that get turned into functions to save space. */ -#define XFSSO_NULLSTARTBLOCK 1 -#define XFSSO_XFS_AGB_TO_DADDR 1 +#define XFSSO_NULLSTARTBLOCK 1 +#define XFSSO_XFS_AGB_TO_DADDR 1 #define XFSSO_XFS_AGB_TO_FSB 1 -#define XFSSO_XFS_AGINO_TO_INO 1 -#define XFSSO_XFS_ALLOC_BLOCK_MINRECS 1 -#define XFSSO_XFS_ATTR_SF_NEXTENTRY 1 -#define XFSSO_XFS_BMAP_BLOCK_DMAXRECS 1 -#define XFSSO_XFS_BMAP_BLOCK_IMAXRECS 1 -#define XFSSO_XFS_BMAP_BLOCK_IMINRECS 1 -#define XFSSO_XFS_BMAP_INIT 1 -#define XFSSO_XFS_BMAP_PTR_IADDR 1 -#define XFSSO_XFS_BMAP_SANITY_CHECK 1 -#define XFSSO_XFS_BMAPI_AFLAG 1 -#define XFSSO_XFS_CFORK_SIZE 1 -#define XFSSO_XFS_DA_COOKIE_BNO 1 -#define XFSSO_XFS_DA_COOKIE_ENTRY 1 -#define XFSSO_XFS_DADDR_TO_AGBNO 1 -#define XFSSO_XFS_DADDR_TO_FSB 1 -#define XFSSO_XFS_DFORK_PTR 1 -#define XFSSO_XFS_DIR_SF_GET_DIRINO 1 -#define XFSSO_XFS_DIR_SF_NEXTENTRY 1 -#define XFSSO_XFS_DIR_SF_PUT_DIRINO 1 -#define XFSSO_XFS_FILBLKS_MIN 1 -#define XFSSO_XFS_FSB_SANITY_CHECK 1 -#define XFSSO_XFS_FSB_TO_DADDR 1 -#define XFSSO_XFS_FSB_TO_DB 1 -#define XFSSO_XFS_IALLOC_INODES 1 -#define XFSSO_XFS_IFORK_ASIZE 1 -#define XFSSO_XFS_IFORK_DSIZE 1 -#define XFSSO_XFS_IFORK_FORMAT 1 -#define XFSSO_XFS_IFORK_NEXT_SET 1 -#define XFSSO_XFS_IFORK_NEXTENTS 1 -#define XFSSO_XFS_IFORK_PTR 1 -#define XFSSO_XFS_ILOG_FBROOT 1 -#define XFSSO_XFS_ILOG_FEXT 1 -#define XFSSO_XFS_INO_MASK 1 -#define XFSSO_XFS_INO_TO_FSB 1 -#define XFSSO_XFS_INODE_CLEAR_READ_AHEAD 1 -#define XFSSO_XFS_MIN_FREELIST 1 +#define XFSSO_XFS_AGINO_TO_INO 1 +#define XFSSO_XFS_ALLOC_BLOCK_MINRECS 1 +#define XFSSO_XFS_ATTR_SF_NEXTENTRY 1 +#define XFSSO_XFS_BMAP_BLOCK_DMAXRECS 1 +#define XFSSO_XFS_BMAP_BLOCK_IMAXRECS 1 +#define XFSSO_XFS_BMAP_BLOCK_IMINRECS 1 +#define XFSSO_XFS_BMAP_INIT 1 +#define XFSSO_XFS_BMAP_PTR_IADDR 1 +#define XFSSO_XFS_BMAP_SANITY_CHECK 1 +#define XFSSO_XFS_BMAPI_AFLAG 1 +#define XFSSO_XFS_CFORK_SIZE 1 +#define XFSSO_XFS_DA_COOKIE_BNO 1 +#define XFSSO_XFS_DA_COOKIE_ENTRY 1 +#define XFSSO_XFS_DADDR_TO_AGBNO 1 +#define XFSSO_XFS_DADDR_TO_FSB 1 +#define XFSSO_XFS_DFORK_PTR 1 +#define XFSSO_XFS_DIR_SF_GET_DIRINO 1 +#define XFSSO_XFS_DIR_SF_NEXTENTRY 1 +#define XFSSO_XFS_DIR_SF_PUT_DIRINO 1 +#define XFSSO_XFS_FILBLKS_MIN 1 +#define XFSSO_XFS_FSB_SANITY_CHECK 1 +#define XFSSO_XFS_FSB_TO_DADDR 1 +#define XFSSO_XFS_FSB_TO_DB 1 +#define XFSSO_XFS_IALLOC_INODES 1 +#define XFSSO_XFS_IFORK_ASIZE 1 +#define XFSSO_XFS_IFORK_DSIZE 1 +#define XFSSO_XFS_IFORK_FORMAT 1 +#define XFSSO_XFS_IFORK_NEXT_SET 1 +#define XFSSO_XFS_IFORK_NEXTENTS 1 +#define XFSSO_XFS_IFORK_PTR 1 +#define XFSSO_XFS_ILOG_FBROOT 1 +#define XFSSO_XFS_ILOG_FEXT 1 +#define XFSSO_XFS_INO_MASK 1 +#define XFSSO_XFS_INO_TO_FSB 1 +#define XFSSO_XFS_INODE_CLEAR_READ_AHEAD 1 +#define XFSSO_XFS_MIN_FREELIST 1 #define XFSSO_XFS_SB_GOOD_VERSION 1 #define XFSSO_XFS_SB_VERSION_HASNLINK 1 -#define XFSSO_XLOG_GRANT_ADD_SPACE 1 -#define XFSSO_XLOG_GRANT_SUB_SPACE 1 +#define XFSSO_XLOG_GRANT_ADD_SPACE 1 +#define XFSSO_XLOG_GRANT_SUB_SPACE 1 #endif /* __XFS_MACROS_H__ */ diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 22d497b2b898..d78cdbdc856c 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,61 +30,86 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_alloc.h" +#include "xfs_rtalloc.h" +#include "xfs_bmap.h" +#include "xfs_error.h" +#include "xfs_bit.h" +#include "xfs_rw.h" +#include "xfs_quota.h" +#include "xfs_fsops.h" STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t); STATIC int xfs_uuid_mount(xfs_mount_t *); STATIC void xfs_uuid_unmount(xfs_mount_t *mp); -mutex_t xfs_uuidtabmon; /* monitor for uuidtab */ -STATIC int xfs_uuidtab_size; -STATIC uuid_t *xfs_uuidtab; - void xfs_xlatesb(void *, xfs_sb_t *, int, xfs_arch_t, __int64_t); static struct { short offset; - short type; /* 0 = integer - * 1 = binary / string (no translation) - */ + short type; /* 0 = integer + * 1 = binary / string (no translation) + */ } xfs_sb_info[] = { - { offsetof(xfs_sb_t, sb_magicnum), 0 }, - { offsetof(xfs_sb_t, sb_blocksize), 0 }, - { offsetof(xfs_sb_t, sb_dblocks), 0 }, - { offsetof(xfs_sb_t, sb_rblocks), 0 }, - { offsetof(xfs_sb_t, sb_rextents), 0 }, - { offsetof(xfs_sb_t, sb_uuid), 1 }, - { offsetof(xfs_sb_t, sb_logstart), 0 }, - { offsetof(xfs_sb_t, sb_rootino), 0 }, - { offsetof(xfs_sb_t, sb_rbmino), 0 }, - { offsetof(xfs_sb_t, sb_rsumino), 0 }, - { offsetof(xfs_sb_t, sb_rextsize), 0 }, - { offsetof(xfs_sb_t, sb_agblocks), 0 }, - { offsetof(xfs_sb_t, sb_agcount), 0 }, - { offsetof(xfs_sb_t, sb_rbmblocks), 0 }, - { offsetof(xfs_sb_t, sb_logblocks), 0 }, + { offsetof(xfs_sb_t, sb_magicnum), 0 }, + { offsetof(xfs_sb_t, sb_blocksize), 0 }, + { offsetof(xfs_sb_t, sb_dblocks), 0 }, + { offsetof(xfs_sb_t, sb_rblocks), 0 }, + { offsetof(xfs_sb_t, sb_rextents), 0 }, + { offsetof(xfs_sb_t, sb_uuid), 1 }, + { offsetof(xfs_sb_t, sb_logstart), 0 }, + { offsetof(xfs_sb_t, sb_rootino), 0 }, + { offsetof(xfs_sb_t, sb_rbmino), 0 }, + { offsetof(xfs_sb_t, sb_rsumino), 0 }, + { offsetof(xfs_sb_t, sb_rextsize), 0 }, + { offsetof(xfs_sb_t, sb_agblocks), 0 }, + { offsetof(xfs_sb_t, sb_agcount), 0 }, + { offsetof(xfs_sb_t, sb_rbmblocks), 0 }, + { offsetof(xfs_sb_t, sb_logblocks), 0 }, { offsetof(xfs_sb_t, sb_versionnum), 0 }, - { offsetof(xfs_sb_t, sb_sectsize), 0 }, - { offsetof(xfs_sb_t, sb_inodesize), 0 }, - { offsetof(xfs_sb_t, sb_inopblock), 0 }, - { offsetof(xfs_sb_t, sb_fname[0]), 1 }, - { offsetof(xfs_sb_t, sb_blocklog), 0 }, - { offsetof(xfs_sb_t, sb_sectlog), 0 }, - { offsetof(xfs_sb_t, sb_inodelog), 0 }, - { offsetof(xfs_sb_t, sb_inopblog), 0 }, - { offsetof(xfs_sb_t, sb_agblklog), 0 }, - { offsetof(xfs_sb_t, sb_rextslog), 0 }, + { offsetof(xfs_sb_t, sb_sectsize), 0 }, + { offsetof(xfs_sb_t, sb_inodesize), 0 }, + { offsetof(xfs_sb_t, sb_inopblock), 0 }, + { offsetof(xfs_sb_t, sb_fname[0]), 1 }, + { offsetof(xfs_sb_t, sb_blocklog), 0 }, + { offsetof(xfs_sb_t, sb_sectlog), 0 }, + { offsetof(xfs_sb_t, sb_inodelog), 0 }, + { offsetof(xfs_sb_t, sb_inopblog), 0 }, + { offsetof(xfs_sb_t, sb_agblklog), 0 }, + { offsetof(xfs_sb_t, sb_rextslog), 0 }, { offsetof(xfs_sb_t, sb_inprogress), 0 }, - { offsetof(xfs_sb_t, sb_imax_pct), 0 }, - { offsetof(xfs_sb_t, sb_icount), 0 }, - { offsetof(xfs_sb_t, sb_ifree), 0 }, - { offsetof(xfs_sb_t, sb_fdblocks), 0 }, - { offsetof(xfs_sb_t, sb_frextents), 0 }, - { offsetof(xfs_sb_t, sb_uquotino), 0 }, - { offsetof(xfs_sb_t, sb_gquotino), 0 }, - { offsetof(xfs_sb_t, sb_qflags), 0 }, - { offsetof(xfs_sb_t, sb_flags), 0 }, - { offsetof(xfs_sb_t, sb_shared_vn), 0 }, + { offsetof(xfs_sb_t, sb_imax_pct), 0 }, + { offsetof(xfs_sb_t, sb_icount), 0 }, + { offsetof(xfs_sb_t, sb_ifree), 0 }, + { offsetof(xfs_sb_t, sb_fdblocks), 0 }, + { offsetof(xfs_sb_t, sb_frextents), 0 }, + { offsetof(xfs_sb_t, sb_uquotino), 0 }, + { offsetof(xfs_sb_t, sb_gquotino), 0 }, + { offsetof(xfs_sb_t, sb_qflags), 0 }, + { offsetof(xfs_sb_t, sb_flags), 0 }, + { offsetof(xfs_sb_t, sb_shared_vn), 0 }, { offsetof(xfs_sb_t, sb_inoalignmt), 0 }, { offsetof(xfs_sb_t, sb_unit), 0 }, { offsetof(xfs_sb_t, sb_width), 0 }, @@ -345,12 +370,12 @@ xfs_initialize_perag(xfs_mount_t *mp, int agcount) /* * xfs_xlatesb * - * data - on disk version of sb - * sb - a superblock - * dir - conversion direction: <0 - convert sb to buf - * >0 - convert buf to sb - * arch - architecture to read/write from/to buf - * fields - which fields to copy (bitmask) + * data - on disk version of sb + * sb - a superblock + * dir - conversion direction: <0 - convert sb to buf + * >0 - convert buf to sb + * arch - architecture to read/write from/to buf + * fields - which fields to copy (bitmask) */ void xfs_xlatesb( @@ -593,7 +618,7 @@ int xfs_mountfs( vfs_t *vfsp, xfs_mount_t *mp, - dev_t dev, + dev_t dev, int mfsi_flags) { xfs_buf_t *bp; @@ -698,14 +723,14 @@ xfs_mountfs( icount = sbp->sb_dblocks * sbp->sb_imax_pct; do_div(icount, 100); do_div(icount, mp->m_ialloc_blks); - mp->m_maxicount = (icount * mp->m_ialloc_blks) << + mp->m_maxicount = (icount * mp->m_ialloc_blks) << sbp->sb_inopblog; } else mp->m_maxicount = 0; /* * XFS uses the uuid from the superblock as the unique - * identifier for fsid. We can not use the uuid from the volume + * identifier for fsid. We can not use the uuid from the volume * since a single partition filesystem is identical to a single * partition volume/filesystem. */ @@ -1092,7 +1117,7 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) xfs_mount_free(mp, 1); return 0; } - + void xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr) { @@ -1153,7 +1178,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) xfs_ioerror_alert("xfs_unmountfs_writesb", mp, sbp, XFS_BUF_ADDR(sbp)); if (error && mp->m_mk_sharedro) - xfs_fs_cmn_err(CE_ALERT, mp, "Superblock write error detected while unmounting. Filesystem may not be marked shared readonly"); + xfs_fs_cmn_err(CE_ALERT, mp, "Superblock write error detected while unmounting. Filesystem may not be marked shared readonly"); } xfs_buf_relse(sbp); return (error); @@ -1169,7 +1194,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) void xfs_mod_sb(xfs_trans_t *tp, __int64_t fields) { - xfs_buf_t *bp; + xfs_buf_t *bp; int first; int last; xfs_mount_t *mp; @@ -1213,11 +1238,11 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields) */ STATIC int xfs_mod_incore_sb_unlocked(xfs_mount_t *mp, xfs_sb_field_t field, - int delta, int rsvd) + int delta, int rsvd) { int scounter; /* short counter for 32 bit fields */ long long lcounter; /* long counter for 64 bit fields */ - long long res_used, rem; + long long res_used, rem; /* * With the in-core superblock spin lock held, switch @@ -1370,8 +1395,8 @@ xfs_mod_incore_sb_unlocked(xfs_mount_t *mp, xfs_sb_field_t field, /* * xfs_mod_incore_sb() is used to change a field in the in-core - * superblock structure by the specified delta. This modification - * is protected by the SB_LOCK. Just use the xfs_mod_incore_sb_unlocked() + * superblock structure by the specified delta. This modification + * is protected by the SB_LOCK. Just use the xfs_mod_incore_sb_unlocked() * routine to do the work. */ int @@ -1400,7 +1425,7 @@ xfs_mod_incore_sb(xfs_mount_t *mp, xfs_sb_field_t field, int delta, int rsvd) int xfs_mod_incore_sb_batch(xfs_mount_t *mp, xfs_mod_sb_t *msb, uint nmsb, int rsvd) { - unsigned long s; + unsigned long s; int status=0; xfs_mod_sb_t *msbp; @@ -1415,7 +1440,7 @@ xfs_mod_incore_sb_batch(xfs_mount_t *mp, xfs_mod_sb_t *msb, uint nmsb, int rsvd) msbp = &msb[0]; for (msbp = &msbp[0]; msbp < (msb + nmsb); msbp++) { /* - * Apply the delta at index n. If it fails, break + * Apply the delta at index n. If it fails, break * from the loop so we'll fall into the undo loop * below. */ @@ -1428,7 +1453,7 @@ xfs_mod_incore_sb_batch(xfs_mount_t *mp, xfs_mod_sb_t *msb, uint nmsb, int rsvd) /* * If we didn't complete the loop above, then back out - * any changes made to the superblock. If you add code + * any changes made to the superblock. If you add code * between the loop above and here, make sure that you * preserve the value of status. Loop back until * we step below the beginning of the array. Make sure @@ -1457,10 +1482,12 @@ xfs_mod_incore_sb_batch(xfs_mount_t *mp, xfs_mod_sb_t *msb, uint nmsb, int rsvd) * If it can't then we'll return NULL. */ xfs_buf_t * -xfs_getsb(xfs_mount_t *mp, - int flags) +xfs_getsb( + xfs_mount_t *mp, + int flags) { xfs_buf_t *bp; + ASSERT(mp->m_sb_bp != NULL); bp = mp->m_sb_bp; if (flags & XFS_BUF_TRYLOCK) { @@ -1495,67 +1522,36 @@ xfs_freesb( } /* - * See if the uuid is unique among mounted xfs filesystems. - * Mount fails if UUID is nil or a FS with the same UUID is already - * mounted + * See if the UUID is unique among mounted XFS filesystems. + * Mount fails if UUID is nil or a FS with the same UUID is already mounted. */ STATIC int -xfs_uuid_mount(xfs_mount_t *mp) +xfs_uuid_mount( + xfs_mount_t *mp) { - int hole; - int i; - if (uuid_is_nil(&mp->m_sb.sb_uuid)) { - cmn_err(CE_WARN, "XFS: Filesystem %s has nil UUID - can't mount", + cmn_err(CE_WARN, + "XFS: Filesystem %s has nil UUID - can't mount", mp->m_fsname); return -1; } - - mutex_lock(&xfs_uuidtabmon, PVFS); - for (i = 0, hole = -1; i < xfs_uuidtab_size; i++) { - if (uuid_is_nil(&xfs_uuidtab[i])) { - hole = i; - continue; - } - if (uuid_equal(&mp->m_sb.sb_uuid, &xfs_uuidtab[i])) { - cmn_err(CE_WARN, "XFS: Filesystem %s has duplicate UUID - can't mount", - mp->m_fsname); - mutex_unlock(&xfs_uuidtabmon); - return -1; - } - } - if (hole < 0) { - xfs_uuidtab = kmem_realloc(xfs_uuidtab, - (xfs_uuidtab_size + 1) * sizeof(*xfs_uuidtab), - xfs_uuidtab_size * sizeof(*xfs_uuidtab), - KM_SLEEP); - hole = xfs_uuidtab_size++; + if (!uuid_table_insert(&mp->m_sb.sb_uuid)) { + cmn_err(CE_WARN, + "XFS: Filesystem %s has duplicate UUID - can't mount", + mp->m_fsname); + return -1; } - xfs_uuidtab[hole] = mp->m_sb.sb_uuid; - mutex_unlock(&xfs_uuidtabmon); - return 0; } /* - * Remove filesystem from the uuid table. + * Remove filesystem from the UUID table. */ STATIC void -xfs_uuid_unmount(xfs_mount_t *mp) +xfs_uuid_unmount( + xfs_mount_t *mp) { - int i; - - mutex_lock(&xfs_uuidtabmon, PVFS); - for (i = 0; i < xfs_uuidtab_size; i++) { - if (uuid_is_nil(&xfs_uuidtab[i])) - continue; - if (!uuid_equal(&mp->m_sb.sb_uuid, &xfs_uuidtab[i])) - continue; - uuid_create_nil(&xfs_uuidtab[i]); - break; - } - ASSERT(i < xfs_uuidtab_size); - mutex_unlock(&xfs_uuidtabmon); + uuid_table_remove(&mp->m_sb.sb_uuid); } /* @@ -1564,10 +1560,10 @@ xfs_uuid_unmount(xfs_mount_t *mp) */ STATIC void xfs_mount_log_sbunit( - xfs_mount_t *mp, - __int64_t fields) + xfs_mount_t *mp, + __int64_t fields) { - xfs_trans_t *tp; + xfs_trans_t *tp; ASSERT(fields & (XFS_SB_UNIT|XFS_SB_WIDTH|XFS_SB_UUID)); @@ -1578,7 +1574,7 @@ xfs_mount_log_sbunit( return; } xfs_mod_sb(tp, fields); - (void)xfs_trans_commit(tp, 0, NULL); + xfs_trans_commit(tp, 0, NULL); } /* Functions to lock access out of the filesystem for forced @@ -1603,7 +1599,7 @@ xfs_start_freeze( void xfs_finish_freeze( - xfs_mount_t *mp) + xfs_mount_t *mp) { unsigned long s = mutex_spinlock(&mp->m_freeze_lock); @@ -1617,11 +1613,11 @@ xfs_finish_freeze( void xfs_check_frozen( - xfs_mount_t *mp, - bhv_desc_t *bdp, - int level) + xfs_mount_t *mp, + bhv_desc_t *bdp, + int level) { - SPLDECL(s); + unsigned long s; if (mp->m_frozen) { s = mutex_spinlock(&mp->m_freeze_lock); diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index ca274d6e242f..bf39de0fdba6 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_MOUNT_H__ -#define __XFS_MOUNT_H__ +#define __XFS_MOUNT_H__ typedef struct xfs_trans_reservations { @@ -52,7 +52,7 @@ typedef struct xfs_trans_reservations { uint tr_attrset; /* set/create an attribute */ uint tr_attrrm; /* remove an attribute */ uint tr_clearagi; /* clear bad agi unlinked ino bucket */ - uint tr_growrtalloc; /* grow realtime allocations */ + uint tr_growrtalloc; /* grow realtime allocations */ uint tr_growrtzero; /* grow realtime zeroing */ uint tr_growrtfree; /* grow realtime freeing */ } xfs_trans_reservations_t; @@ -79,12 +79,12 @@ struct xfs_iocore; struct xfs_bmbt_irec; struct xfs_bmap_free; -#define SPLDECL(s) unsigned long s -#define AIL_LOCK_T lock_t -#define AIL_LOCKINIT(x,y) spinlock_init(x,y) -#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) -#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock) -#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s) +#define SPLDECL(s) unsigned long s +#define AIL_LOCK_T lock_t +#define AIL_LOCKINIT(x,y) spinlock_init(x,y) +#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) +#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock) +#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s) /* @@ -197,7 +197,7 @@ typedef struct xfs_qmops { /* * Prototypes and functions for I/O core modularization. */ - + typedef int (*xfs_ioinit_t)(struct vfs *, struct xfs_mount_args *, int); typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *, @@ -315,7 +315,7 @@ typedef struct xfs_mount { xfs_buftarg_t *m_logdev_targp;/* ptr to log device */ xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */ #define m_dev m_ddev_targp->pbr_dev - __uint8_t m_dircook_elog; /* log d-cookie entry bits */ + __uint8_t m_dircook_elog; /* log d-cookie entry bits */ __uint8_t m_blkbit_log; /* blocklog + NBBY */ __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ __uint8_t m_agno_log; /* log #ag's */ @@ -325,19 +325,19 @@ typedef struct xfs_mount { uint m_blockmask; /* sb_blocksize-1 */ uint m_blockwsize; /* sb_blocksize in words */ uint m_blockwmask; /* blockwsize-1 */ - uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ - uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ - uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ - uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ - uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ - uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ - uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ + uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ + uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ + uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ + uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ + uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ + uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ + uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ - uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ + uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ struct xfs_perag *m_perag; /* per-ag accounting info */ struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */ sema_t m_growlock; /* growfs mutex */ - int m_fixedfsid[2]; /* unchanged for life of FS */ + int m_fixedfsid[2]; /* unchanged for life of FS */ uint m_dmevmask; /* DMI events for this FS */ uint m_flags; /* global mount flags */ uint m_attroffset; /* inode attribute offset */ @@ -360,7 +360,7 @@ typedef struct xfs_mount { int m_lstripemask; /* log stripe mask */ int m_sinoalign; /* stripe unit inode alignmnt */ int m_attr_magicpct;/* 37% of the blocksize */ - int m_dir_magicpct; /* 37% of the dir blocksize */ + int m_dir_magicpct; /* 37% of the dir blocksize */ __uint8_t m_mk_sharedro; /* mark shared ro on unmount */ __uint8_t m_inode_quiesce;/* call quiesce on new inodes. field governed by m_ilock */ @@ -382,17 +382,17 @@ typedef struct xfs_mount { uint m_frozen; /* FS frozen for shutdown or * snapshot */ sv_t m_wait_unfreeze;/* waiting to unfreeze */ - atomic_t m_active_trans; /* number trans frozen */ + atomic_t m_active_trans; /* number trans frozen */ } xfs_mount_t; /* * Flags for m_flags. */ -#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops +#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops must be synchronous except for space allocations */ #if XFS_BIG_FILESYSTEMS -#define XFS_MOUNT_INO64 0x00000002 +#define XFS_MOUNT_INO64 0x00000002 #endif /* 0x00000004 -- currently unused */ /* 0x00000008 -- currently unused */ @@ -401,12 +401,12 @@ typedef struct xfs_mount { disk errors in metadata */ #define XFS_MOUNT_NOATIME 0x00000020 /* don't modify inode access times on reads */ -#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to +#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to user */ #define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment allocations */ /* 0x00000100 -- currently unused */ - /* 0x00000200 -- currently unused */ + /* 0x00000200 -- currently unused */ #define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */ #define XFS_MOUNT_SHARED 0x00000800 /* shared mount */ #define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */ @@ -417,7 +417,7 @@ typedef struct xfs_mount { * 32 bits in size */ #define XFS_MOUNT_NOLOGFLUSH 0x00010000 -#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) +#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) /* * Default minimum read and write sizes. @@ -431,7 +431,7 @@ typedef struct xfs_mount { /* * Max and min values for UIO and mount-option defined I/O sizes; - * min value can't be less than a page. Currently unused. + * min value can't be less than a page. Currently unused. */ #define XFS_MAX_IO_LOG 16 /* 64K */ #define XFS_MIN_IO_LOG PAGE_SHIFT @@ -440,8 +440,8 @@ typedef struct xfs_mount { * Synchronous read and write sizes. This should be * better for NFSv2 wsync filesystems. */ -#define XFS_WSYNC_READIO_LOG 15 /* 32K */ -#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */ +#define XFS_WSYNC_READIO_LOG 15 /* 32K */ +#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */ #define xfs_force_shutdown(m,f) \ VFS_FORCE_SHUTDOWN((XFS_MTOVFS(m)), f, __FILE__, __LINE__) @@ -473,13 +473,13 @@ typedef struct xfs_mount { */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS) struct vfs *xfs_mtovfs(xfs_mount_t *mp); -#define XFS_MTOVFS(mp) xfs_mtovfs(mp) +#define XFS_MTOVFS(mp) xfs_mtovfs(mp) #else -#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv)) +#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM) xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp); -#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp) +#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp) #else #define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp)) #endif @@ -498,7 +498,7 @@ xfs_mount_t *xfs_vfstom(vfs_t *vfs); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO) xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d); -#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) +#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) #else static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d) @@ -511,7 +511,7 @@ static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO) xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d); -#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d) +#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d) #else static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d) @@ -530,10 +530,10 @@ typedef struct xfs_mod_sb { int msb_delta; /* Change to make to specified field */ } xfs_mod_sb_t; -#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD) -#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock)) -#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock) -#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s)) +#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD) +#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock)) +#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock) +#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s)) extern xfs_mount_t *xfs_mount_init(void); extern void xfs_mod_sb(xfs_trans_t *, __int64_t); @@ -573,7 +573,7 @@ extern struct xfs_dmops xfs_dmcore_xfs; extern struct xfs_qmops xfs_qmcore_xfs; extern struct xfs_ioops xfs_iocore_xfs; -extern int xfs_init(void); +extern int xfs_init(void); extern void xfs_cleanup(void); #endif /* __KERNEL__ */ diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c index 75d1029ceb77..26f1480e9153 100644 --- a/fs/xfs/xfs_qmops.c +++ b/fs/xfs/xfs_qmops.c @@ -29,7 +29,20 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" + +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" + #ifndef CONFIG_XFS_QUOTA STATIC struct xfs_dquot * diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h index 57c2bb304aa3..d7041e5ac237 100644 --- a/fs/xfs/xfs_quota.h +++ b/fs/xfs/xfs_quota.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -149,21 +149,21 @@ typedef struct xfs_qoff_logformat { /* * Disk quotas status in m_qflags, and also sb_qflags. 16 bits. */ -#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ -#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ -#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ -#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */ -#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */ -#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */ -#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ +#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ +#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ +#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ +#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */ +#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */ +#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */ +#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ /* * Incore only flags for quotaoff - these bits get cleared when quota(s) * are in the process of getting turned off. These flags are in m_qflags but * never in sb_qflags. */ -#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */ +#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */ +#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */ /* * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees @@ -189,7 +189,7 @@ typedef struct xfs_qoff_logformat { #define XFS_QMOPT_QUOTAOFF 0x0000080 /* quotas are being turned off */ #define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */ #define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */ -#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */ +#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */ #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */ @@ -222,7 +222,7 @@ typedef struct xfs_qoff_logformat { * flags to xfs_trans_mod_dquot. */ #define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS -#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS +#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS #define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS #define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT #define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index dc6b2b1dd4d4..256363e4cce9 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,33 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_error.h" +#include "xfs_quota.h" +#include "xfs_rw.h" +#include "xfs_utils.h" +#include "xfs_trans_space.h" +#include "xfs_da_btree.h" +#include "xfs_dir_leaf.h" +#include "xfs_dmapi.h" /* @@ -79,8 +105,8 @@ xfs_lock_for_rename( xfs_inode_t *dp2, /* new (target) directory inode */ vname_t *vname1,/* old entry name */ vname_t *vname2,/* new entry name */ - xfs_inode_t **ipp1, /* inode of old entry */ - xfs_inode_t **ipp2, /* inode of new entry, if it + xfs_inode_t **ipp1, /* inode of old entry */ + xfs_inode_t **ipp2, /* inode of new entry, if it already exists, NULL otherwise. */ xfs_inode_t **i_tab,/* array of inode returned, sorted */ int *num_inodes) /* number of inodes in array */ @@ -138,11 +164,11 @@ xfs_lock_for_rename( } /* - * i_tab contains a list of pointers to inodes. We initialize + * i_tab contains a list of pointers to inodes. We initialize * the table here & we'll sort it. We will then use it to * order the acquisition of the inode locks. * - * Note that the table may contain duplicates. e.g., dp1 == dp2. + * Note that the table may contain duplicates. e.g., dp1 == dp2. */ i_tab[0] = dp1; i_tab[1] = dp2; @@ -230,7 +256,7 @@ xfs_rename( int src_is_directory; /* src_name is a directory */ int error; xfs_bmap_free_t free_list; - xfs_fsblock_t first_block; + xfs_fsblock_t first_block; int cancel_flags; int committed; xfs_inode_t *inodes[4]; @@ -570,7 +596,7 @@ xfs_rename( } /* - * Take refs. for vop_link_removed calls below. No need to worry + * Take refs. for vop_link_removed calls below. No need to worry * about directory refs. because the caller holds them. * * Do holds before the xfs_bmap_finish since it might rele them down diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index a1a40d131c1f..524d8b211e8d 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,37 @@ * Free realtime space allocation for XFS. */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_alloc.h" +#include "xfs_bmap.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_fsops.h" +#include "xfs_error.h" +#include "xfs_rw.h" +#include "xfs_inode_item.h" +#include "xfs_trans_space.h" /* @@ -90,10 +120,10 @@ xfs_growfs_rt_alloc( xfs_daddr_t d; /* disk block address */ int error; /* error return value */ xfs_fsblock_t firstblock; /* first block allocated in xaction */ - xfs_bmap_free_t flist; /* list of freed blocks */ + xfs_bmap_free_t flist; /* list of freed blocks */ xfs_fsblock_t fsbno; /* filesystem block for bno */ xfs_inode_t *ip; /* pointer to incore inode */ - xfs_bmbt_irec_t map; /* block map output */ + xfs_bmbt_irec_t map; /* block map output */ int nmap; /* number of block maps */ int resblks; /* space reservation */ xfs_trans_t *tp; /* transaction pointer */ @@ -303,7 +333,7 @@ xfs_rtallocate_extent_block( /* * Allocate an extent of length minlen<=len<=maxlen, starting at block - * bno. If we don't get maxlen then use prod to trim the length, if given. + * bno. If we don't get maxlen then use prod to trim the length, if given. * Returns error; returns starting block in *rtblock. * The lengths are all in rtextents. */ @@ -383,7 +413,7 @@ xfs_rtallocate_extent_exact( /* * Allocate an extent of length minlen<=len<=maxlen, starting as near - * to bno as possible. If we don't get maxlen then use prod to trim + * to bno as possible. If we don't get maxlen then use prod to trim * the length, if given. The lengths are all in rtextents. */ STATIC int /* error */ @@ -671,7 +701,7 @@ xfs_rtallocate_extent_size( /* * Get the summary information for this level/block. */ - error = xfs_rtget_summary(mp, tp, l, i, rbpp, rsb, + error = xfs_rtget_summary(mp, tp, l, i, rbpp, rsb, &sum); if (error) { return error; @@ -682,7 +712,7 @@ xfs_rtallocate_extent_size( if (!sum) continue; /* - * Try the allocation. Make sure the specified + * Try the allocation. Make sure the specified * minlen/maxlen are in the possible range for * this summary level. */ @@ -1891,7 +1921,7 @@ xfs_rtmodify_summary( int xfs_growfs_rt( xfs_mount_t *mp, /* mount point for filesystem */ - xfs_growfs_rt_t *in) /* growfs rt input struct */ + xfs_growfs_rt_t *in) /* growfs rt input struct */ { xfs_rtblock_t bmbno; /* bitmap block number */ xfs_buf_t *bp; /* temporary buffer */ @@ -2101,7 +2131,7 @@ error_exit: /* * Allocate an extent in the realtime subvolume, with the usual allocation - * parameters. The length units are all in realtime extents, as is the + * parameters. The length units are all in realtime extents, as is the * result block number. */ int /* error */ @@ -2111,7 +2141,7 @@ xfs_rtallocate_extent( xfs_extlen_t minlen, /* minimum length to allocate */ xfs_extlen_t maxlen, /* maximum length to allocate */ xfs_extlen_t *len, /* out: actual length allocated */ - xfs_alloctype_t type, /* allocation type XFS_ALLOCTYPE... */ + xfs_alloctype_t type, /* allocation type XFS_ALLOCTYPE... */ int wasdel, /* was a delayed allocation extent */ xfs_extlen_t prod, /* extent product factor */ xfs_rtblock_t *rtblock) /* out: start block allocated */ @@ -2154,7 +2184,7 @@ xfs_rtallocate_extent( switch (type) { case XFS_ALLOCTYPE_ANY_AG: error = xfs_rtallocate_extent_size(mp, tp, minlen, maxlen, len, - &sumbp, &sb, prod, &r); + &sumbp, &sb, prod, &r); break; case XFS_ALLOCTYPE_NEAR_BNO: error = xfs_rtallocate_extent_near(mp, tp, bno, minlen, maxlen, diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h index 19e70410788d..1e0f0a7cca0a 100644 --- a/fs/xfs/xfs_rtalloc.h +++ b/fs/xfs/xfs_rtalloc.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_RTALLOC_H__ -#define __XFS_RTALLOC_H__ +#define __XFS_RTALLOC_H__ struct xfs_mount; struct xfs_trans; @@ -38,49 +38,49 @@ struct xfs_trans; #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) /* Min and max rt extent sizes, specified in bytes */ -#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */ -#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */ -#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4KB */ +#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */ +#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */ +#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4KB */ /* * Constants for bit manipulations. */ -#define XFS_NBBYLOG 3 /* log2(NBBY) */ -#define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */ -#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) -#define XFS_NBWORD (1 << XFS_NBWORDLOG) -#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) +#define XFS_NBBYLOG 3 /* log2(NBBY) */ +#define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */ +#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) +#define XFS_NBWORD (1 << XFS_NBWORDLOG) +#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) -#define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) -#define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) -#define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize) -#define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask) +#define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) +#define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) +#define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize) +#define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask) /* * Summary and bit manipulation macros. */ -#define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) -#define XFS_SUMOFFSTOBLOCK(mp,s) \ +#define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) +#define XFS_SUMOFFSTOBLOCK(mp,s) \ (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) -#define XFS_SUMPTR(mp,bp,so) \ +#define XFS_SUMPTR(mp,bp,so) \ ((xfs_suminfo_t *)((char *)XFS_BUF_PTR(bp) + \ (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) -#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log) -#define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log) -#define XFS_BITTOWORD(mp,bi) \ +#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log) +#define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log) +#define XFS_BITTOWORD(mp,bi) \ ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) -#define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b)) -#define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b)) +#define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b)) +#define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b)) -#define XFS_RTLOBIT(w) xfs_lowbit32(w) -#define XFS_RTHIBIT(w) xfs_highbit32(w) +#define XFS_RTLOBIT(w) xfs_lowbit32(w) +#define XFS_RTHIBIT(w) xfs_highbit32(w) #if XFS_BIG_FILESYSTEMS -#define XFS_RTBLOCKLOG(b) xfs_highbit64(b) +#define XFS_RTBLOCKLOG(b) xfs_highbit64(b) #else -#define XFS_RTBLOCKLOG(b) xfs_highbit32(b) +#define XFS_RTBLOCKLOG(b) xfs_highbit32(b) #endif @@ -93,18 +93,18 @@ struct xfs_trans; /* * Allocate an extent in the realtime subvolume, with the usual allocation - * parameters. The length units are all in realtime extents, as is the + * parameters. The length units are all in realtime extents, as is the * result block number. */ int /* error */ xfs_rtallocate_extent( struct xfs_trans *tp, /* transaction pointer */ xfs_rtblock_t bno, /* starting block number to allocate */ - xfs_extlen_t minlen, /* minimum length to allocate */ - xfs_extlen_t maxlen, /* maximum length to allocate */ + xfs_extlen_t minlen, /* minimum length to allocate */ + xfs_extlen_t maxlen, /* maximum length to allocate */ xfs_extlen_t *len, /* out: actual length allocated */ xfs_alloctype_t type, /* allocation type XFS_ALLOCTYPE... */ - int wasdel, /* was a delayed allocation extent */ + int wasdel, /* was a delayed allocation extent */ xfs_extlen_t prod, /* extent product factor */ xfs_rtblock_t *rtblock); /* out: start block allocated */ @@ -145,7 +145,7 @@ xfs_rtpick_extent( struct xfs_mount *mp, /* file system mount point */ struct xfs_trans *tp, /* transaction pointer */ xfs_extlen_t len, /* allocation length (rtextents) */ - xfs_rtblock_t *pick); /* result rt extent */ + xfs_rtblock_t *pick); /* result rt extent */ /* * Debug code: print out the value of a range in the bitmap. @@ -174,12 +174,12 @@ xfs_growfs_rt( xfs_growfs_rt_t *in); /* user supplied growfs struct */ #else -# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS) -# define xfs_rtfree_extent(t,b,l) (ENOSYS) -# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) -# define xfs_growfs_rt(mp,in) (ENOSYS) -# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) -# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) +# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS) +# define xfs_rtfree_extent(t,b,l) (ENOSYS) +# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) +# define xfs_growfs_rt(mp,in) (ENOSYS) +# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) +# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) #endif /* CONFIG_XFS_RT */ #endif /* __KERNEL__ */ diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c index 7e3f5ccd6c3d..e87157a53427 100644 --- a/fs/xfs/xfs_rw.c +++ b/fs/xfs/xfs_rw.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,39 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_itable.h" +#include "xfs_btree.h" +#include "xfs_alloc.h" +#include "xfs_ialloc.h" +#include "xfs_attr.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_acl.h" +#include "xfs_mac.h" +#include "xfs_attr.h" +#include "xfs_error.h" +#include "xfs_buf_item.h" +#include "xfs_rw.h" /* * This is a subroutine for xfs_write() and other writers (xfs_ioctl) @@ -255,8 +286,8 @@ xfs_read_buf( struct xfs_mount *mp, xfs_buftarg_t *target, xfs_daddr_t blkno, - int len, - uint flags, + int len, + uint flags, xfs_buf_t **bpp) { xfs_buf_t *bp; diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h index a6dfa8eebadb..bcdc6301a782 100644 --- a/fs/xfs/xfs_rw.h +++ b/fs/xfs/xfs_rw.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,8 +29,8 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_RW_H__ -#define __XFS_RW_H__ +#ifndef __XFS_RW_H__ +#define __XFS_RW_H__ struct bhv_desc; struct bmapval; @@ -46,16 +46,16 @@ struct xfs_trans; /* * Maximum count of bmaps used by read and write paths. */ -#define XFS_MAX_RW_NBMAPS 4 +#define XFS_MAX_RW_NBMAPS 4 /* * Counts of readahead buffers to use based on physical memory size. * None of these should be more than XFS_MAX_RW_NBMAPS. */ -#define XFS_RW_NREADAHEAD_16MB 2 -#define XFS_RW_NREADAHEAD_32MB 3 -#define XFS_RW_NREADAHEAD_K32 4 -#define XFS_RW_NREADAHEAD_K64 4 +#define XFS_RW_NREADAHEAD_16MB 2 +#define XFS_RW_NREADAHEAD_32MB 3 +#define XFS_RW_NREADAHEAD_K32 4 +#define XFS_RW_NREADAHEAD_K64 4 /* * Maximum size of a buffer that we\'ll map. Making this @@ -66,8 +66,8 @@ struct xfs_trans; * * This is currently set to 512 KB. */ -#define XFS_MAX_BMAP_LEN_BB 1024 -#define XFS_MAX_BMAP_LEN_BYTES 524288 +#define XFS_MAX_BMAP_LEN_BB 1024 +#define XFS_MAX_BMAP_LEN_BYTES 524288 /* * Convert the given file system block to a disk block. @@ -77,9 +77,9 @@ struct xfs_trans; */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DB) xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb); -#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb) +#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb) #else -#define XFS_FSB_TO_DB(ip,fsb) \ +#define XFS_FSB_TO_DB(ip,fsb) \ (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \ (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \ XFS_FSB_TO_DADDR((ip)->i_mount, (fsb))) @@ -93,34 +93,34 @@ xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb); /* * Defines for the trace mechanisms in xfs_rw.c. */ -#define XFS_RW_KTRACE_SIZE 64 -#define XFS_STRAT_KTRACE_SIZE 64 -#define XFS_STRAT_GTRACE_SIZE 512 +#define XFS_RW_KTRACE_SIZE 64 +#define XFS_STRAT_KTRACE_SIZE 64 +#define XFS_STRAT_GTRACE_SIZE 512 -#define XFS_READ_ENTER 1 -#define XFS_WRITE_ENTER 2 +#define XFS_READ_ENTER 1 +#define XFS_WRITE_ENTER 2 #define XFS_IOMAP_READ_ENTER 3 -#define XFS_IOMAP_WRITE_ENTER 4 -#define XFS_IOMAP_READ_MAP 5 -#define XFS_IOMAP_WRITE_MAP 6 -#define XFS_IOMAP_WRITE_NOSPACE 7 -#define XFS_ITRUNC_START 8 -#define XFS_ITRUNC_FINISH1 9 -#define XFS_ITRUNC_FINISH2 10 -#define XFS_CTRUNC1 11 -#define XFS_CTRUNC2 12 -#define XFS_CTRUNC3 13 -#define XFS_CTRUNC4 14 -#define XFS_CTRUNC5 15 -#define XFS_CTRUNC6 16 -#define XFS_BUNMAPI 17 -#define XFS_INVAL_CACHED 18 -#define XFS_DIORD_ENTER 19 -#define XFS_DIOWR_ENTER 20 +#define XFS_IOMAP_WRITE_ENTER 4 +#define XFS_IOMAP_READ_MAP 5 +#define XFS_IOMAP_WRITE_MAP 6 +#define XFS_IOMAP_WRITE_NOSPACE 7 +#define XFS_ITRUNC_START 8 +#define XFS_ITRUNC_FINISH1 9 +#define XFS_ITRUNC_FINISH2 10 +#define XFS_CTRUNC1 11 +#define XFS_CTRUNC2 12 +#define XFS_CTRUNC3 13 +#define XFS_CTRUNC4 14 +#define XFS_CTRUNC5 15 +#define XFS_CTRUNC6 16 +#define XFS_BUNMAPI 17 +#define XFS_INVAL_CACHED 18 +#define XFS_DIORD_ENTER 19 +#define XFS_DIOWR_ENTER 20 #if defined(XFS_ALL_TRACE) -#define XFS_RW_TRACE -#define XFS_STRAT_TRACE +#define XFS_RW_TRACE +#define XFS_STRAT_TRACE #endif #if !defined(DEBUG) diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h index bc05f8026871..f0dea2a848fb 100644 --- a/fs/xfs/xfs_sb.h +++ b/fs/xfs/xfs_sb.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_SB_H__ -#define __XFS_SB_H__ +#define __XFS_SB_H__ /* * Super block @@ -41,29 +41,29 @@ struct xfs_buf; struct xfs_mount; -#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ -#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */ -#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */ -#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */ -#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */ -#define XFS_SB_VERSION_NUMBITS 0x000f -#define XFS_SB_VERSION_ALLFBITS 0xfff0 -#define XFS_SB_VERSION_SASHFBITS 0xf000 -#define XFS_SB_VERSION_REALFBITS 0x0ff0 -#define XFS_SB_VERSION_ATTRBIT 0x0010 -#define XFS_SB_VERSION_NLINKBIT 0x0020 -#define XFS_SB_VERSION_QUOTABIT 0x0040 -#define XFS_SB_VERSION_ALIGNBIT 0x0080 -#define XFS_SB_VERSION_DALIGNBIT 0x0100 -#define XFS_SB_VERSION_SHAREDBIT 0x0200 +#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ +#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */ +#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */ +#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */ +#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */ +#define XFS_SB_VERSION_NUMBITS 0x000f +#define XFS_SB_VERSION_ALLFBITS 0xfff0 +#define XFS_SB_VERSION_SASHFBITS 0xf000 +#define XFS_SB_VERSION_REALFBITS 0x0ff0 +#define XFS_SB_VERSION_ATTRBIT 0x0010 +#define XFS_SB_VERSION_NLINKBIT 0x0020 +#define XFS_SB_VERSION_QUOTABIT 0x0040 +#define XFS_SB_VERSION_ALIGNBIT 0x0080 +#define XFS_SB_VERSION_DALIGNBIT 0x0100 +#define XFS_SB_VERSION_SHAREDBIT 0x0200 #define XFS_SB_VERSION_LOGV2BIT 0x0400 #define XFS_SB_VERSION_SECTORBIT 0x0800 -#define XFS_SB_VERSION_EXTFLGBIT 0x1000 -#define XFS_SB_VERSION_DIRV2BIT 0x2000 -#define XFS_SB_VERSION_OKSASHFBITS \ +#define XFS_SB_VERSION_EXTFLGBIT 0x1000 +#define XFS_SB_VERSION_DIRV2BIT 0x2000 +#define XFS_SB_VERSION_OKSASHFBITS \ (XFS_SB_VERSION_EXTFLGBIT | \ XFS_SB_VERSION_DIRV2BIT) -#define XFS_SB_VERSION_OKREALFBITS \ +#define XFS_SB_VERSION_OKREALFBITS \ (XFS_SB_VERSION_ATTRBIT | \ XFS_SB_VERSION_NLINKBIT | \ XFS_SB_VERSION_QUOTABIT | \ @@ -72,11 +72,11 @@ struct xfs_mount; XFS_SB_VERSION_SHAREDBIT | \ XFS_SB_VERSION_LOGV2BIT | \ XFS_SB_VERSION_SECTORBIT) -#define XFS_SB_VERSION_OKSASHBITS \ +#define XFS_SB_VERSION_OKSASHBITS \ (XFS_SB_VERSION_NUMBITS | \ XFS_SB_VERSION_REALFBITS | \ XFS_SB_VERSION_OKSASHFBITS) -#define XFS_SB_VERSION_OKREALBITS \ +#define XFS_SB_VERSION_OKREALBITS \ (XFS_SB_VERSION_NUMBITS | \ XFS_SB_VERSION_OKREALFBITS | \ XFS_SB_VERSION_OKSASHFBITS) @@ -123,7 +123,7 @@ typedef struct xfs_sb __uint8_t sb_imax_pct; /* max % of fs for inode space */ /* statistics */ /* - * These fields must remain contiguous. If you really + * These fields must remain contiguous. If you really * want to change their layout, make sure you fix the * code in xfs_trans_apply_sb_deltas(). */ @@ -171,22 +171,22 @@ typedef enum { * Mask values, defined based on the xfs_sb_field_t values. * Only define the ones we're using. */ -#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x) -#define XFS_SB_UUID XFS_SB_MVAL(UUID) -#define XFS_SB_FNAME XFS_SB_MVAL(FNAME) -#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO) -#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO) -#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO) -#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM) +#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x) +#define XFS_SB_UUID XFS_SB_MVAL(UUID) +#define XFS_SB_FNAME XFS_SB_MVAL(FNAME) +#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO) +#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO) +#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO) +#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM) #define XFS_SB_UQUOTINO XFS_SB_MVAL(UQUOTINO) #define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO) #define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS) #define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) #define XFS_SB_UNIT XFS_SB_MVAL(UNIT) #define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) -#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) -#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) -#define XFS_SB_MOD_BITS \ +#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) +#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) +#define XFS_SB_MOD_BITS \ (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH) @@ -205,22 +205,22 @@ typedef enum { #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM) int xfs_sb_version_num(xfs_sb_t *sbp); -#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp) +#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp) #else -#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) +#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION) int xfs_sb_good_version(xfs_sb_t *sbp); -#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) +#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) #else -#define XFS_SB_GOOD_VERSION_INT(sbp) \ +#define XFS_SB_GOOD_VERSION_INT(sbp) \ ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ ((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) #ifdef __KERNEL__ -#define XFS_SB_GOOD_VERSION(sbp) \ +#define XFS_SB_GOOD_VERSION(sbp) \ (XFS_SB_GOOD_VERSION_INT(sbp) && \ (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) )) #else @@ -237,7 +237,7 @@ int xfs_sb_good_version(xfs_sb_t *sbp); #endif /* __KERNEL__ */ #endif -#define XFS_SB_GOOD_SASH_VERSION(sbp) \ +#define XFS_SB_GOOD_SASH_VERSION(sbp) \ ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ ((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ @@ -245,9 +245,9 @@ int xfs_sb_good_version(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW) unsigned xfs_sb_version_tonew(unsigned v); -#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) +#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) #else -#define XFS_SB_VERSION_TONEW(v) \ +#define XFS_SB_VERSION_TONEW(v) \ ((((v) == XFS_SB_VERSION_1) ? \ 0 : \ (((v) == XFS_SB_VERSION_2) ? \ @@ -258,9 +258,9 @@ unsigned xfs_sb_version_tonew(unsigned v); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD) unsigned xfs_sb_version_toold(unsigned v); -#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) +#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) #else -#define XFS_SB_VERSION_TOOLD(v) \ +#define XFS_SB_VERSION_TOOLD(v) \ (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ 0 : \ (((v) & XFS_SB_VERSION_NLINKBIT) ? \ @@ -272,9 +272,9 @@ unsigned xfs_sb_version_toold(unsigned v); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR) int xfs_sb_version_hasattr(xfs_sb_t *sbp); -#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) +#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) #else -#define XFS_SB_VERSION_HASATTR(sbp) \ +#define XFS_SB_VERSION_HASATTR(sbp) \ (((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ @@ -283,9 +283,9 @@ int xfs_sb_version_hasattr(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR) void xfs_sb_version_addattr(xfs_sb_t *sbp); -#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) +#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) #else -#define XFS_SB_VERSION_ADDATTR(sbp) \ +#define XFS_SB_VERSION_ADDATTR(sbp) \ ((sbp)->sb_versionnum = \ (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \ XFS_SB_VERSION_2 : \ @@ -296,9 +296,9 @@ void xfs_sb_version_addattr(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK) int xfs_sb_version_hasnlink(xfs_sb_t *sbp); -#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) +#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) #else -#define XFS_SB_VERSION_HASNLINK(sbp) \ +#define XFS_SB_VERSION_HASNLINK(sbp) \ (((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT))) @@ -306,9 +306,9 @@ int xfs_sb_version_hasnlink(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK) void xfs_sb_version_addnlink(xfs_sb_t *sbp); -#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) +#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) #else -#define XFS_SB_VERSION_ADDNLINK(sbp) \ +#define XFS_SB_VERSION_ADDNLINK(sbp) \ ((sbp)->sb_versionnum = \ ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \ XFS_SB_VERSION_3 : \ @@ -317,18 +317,18 @@ void xfs_sb_version_addnlink(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA) int xfs_sb_version_hasquota(xfs_sb_t *sbp); -#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) +#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) #else -#define XFS_SB_VERSION_HASQUOTA(sbp) \ +#define XFS_SB_VERSION_HASQUOTA(sbp) \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA) void xfs_sb_version_addquota(xfs_sb_t *sbp); -#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) +#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) #else -#define XFS_SB_VERSION_ADDQUOTA(sbp) \ +#define XFS_SB_VERSION_ADDQUOTA(sbp) \ ((sbp)->sb_versionnum = \ (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ @@ -338,18 +338,18 @@ void xfs_sb_version_addquota(xfs_sb_t *sbp); #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN) int xfs_sb_version_hasalign(xfs_sb_t *sbp); -#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) +#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) #else -#define XFS_SB_VERSION_HASALIGN(sbp) \ +#define XFS_SB_VERSION_HASALIGN(sbp) \ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN) void xfs_sb_version_subalign(xfs_sb_t *sbp); -#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) +#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) #else -#define XFS_SB_VERSION_SUBALIGN(sbp) \ +#define XFS_SB_VERSION_SUBALIGN(sbp) \ ((sbp)->sb_versionnum = \ XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT)) #endif @@ -460,29 +460,29 @@ int xfs_sb_version_hassector(xfs_sb_t *sbp); #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK) xfs_agblock_t xfs_sb_block(struct xfs_mount *mp); -#define XFS_SB_BLOCK(mp) xfs_sb_block(mp) +#define XFS_SB_BLOCK(mp) xfs_sb_block(mp) #else -#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) +#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK) xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d); -#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d) +#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d) #else -#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d))) +#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB) xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d); -#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d) +#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d) #else -#define XFS_DADDR_TO_FSB(mp,d) \ +#define XFS_DADDR_TO_FSB(mp,d) \ XFS_AGB_TO_FSB(mp, XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR) xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno); -#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno) +#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno) #else -#define XFS_FSB_TO_DADDR(mp,fsbno) \ +#define XFS_FSB_TO_DADDR(mp,fsbno) \ XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \ XFS_FSB_TO_AGBNO(mp,fsbno)) #endif @@ -511,11 +511,11 @@ xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp); /* * File system block to basic block conversions. */ -#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log) -#define XFS_BB_TO_FSB(mp,bb) \ +#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log) +#define XFS_BB_TO_FSB(mp,bb) \ (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log) -#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log) -#define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1)) +#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log) +#define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1)) /* * File system block to byte conversions. diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index fe1050a8ea95..473868b1f5b3 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,35 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_error.h" +#include "xfs_trans_priv.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_quota.h" +#include "xfs_trans_space.h" STATIC void xfs_trans_apply_sb_deltas(xfs_trans_t *); @@ -134,8 +162,8 @@ _xfs_trans_alloc( /* * This is called to create a new transaction which will share the - * permanent log reservation of the given transaction. The remaining - * unused block and rt extent reservations are also inherited. This + * permanent log reservation of the given transaction. The remaining + * unused block and rt extent reservations are also inherited. This * implies that the original transaction is no longer allowed to allocate * blocks. Locks and log items, however, are no inherited. They must * be added to the new transaction explicitly. @@ -214,7 +242,7 @@ xfs_trans_reserve( /* * Attempt to reserve the needed disk blocks by decrementing - * the number needed from the number available. This will + * the number needed from the number available. This will * fail if the count would go below zero. */ if (blocks > 0) { @@ -255,7 +283,7 @@ xfs_trans_reserve( /* * Attempt to reserve the needed realtime extents by decrementing - * the number needed from the number available. This will + * the number needed from the number available. This will * fail if the count would go below zero. */ if (rtextents > 0) { @@ -345,7 +373,7 @@ xfs_trans_mod_sb( case XFS_TRANS_SB_FDBLOCKS: /* * Track the number of blocks allocated in the - * transaction. Make sure it does not exceed the + * transaction. Make sure it does not exceed the * number reserved. */ if (delta < 0) { @@ -366,7 +394,7 @@ xfs_trans_mod_sb( case XFS_TRANS_SB_FREXTENTS: /* * Track the number of blocks allocated in the - * transaction. Make sure it does not exceed the + * transaction. Make sure it does not exceed the * number reserved. */ if (delta < 0) { @@ -532,7 +560,7 @@ xfs_trans_unreserve_and_mod_sb( rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; /* - * Release any reserved blocks. Any that were allocated + * Release any reserved blocks. Any that were allocated * will be taken back again by fdblocks_delta below. */ if (tp->t_blk_res > 0) { @@ -660,7 +688,7 @@ xfs_trans_commit( int error; int log_flags; int sync; -#define XFS_TRANS_LOGVEC_COUNT 16 +#define XFS_TRANS_LOGVEC_COUNT 16 xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT]; #if defined(XLOG_NOLOG) || defined(DEBUG) static xfs_lsn_t trans_lsn = 1; @@ -816,7 +844,7 @@ shut_us_down: * when the transaction commit really hits the on-disk log). * After this call we cannot reference tp, because the call * can happen at any time and the call will free the transaction - * structure pointed to by tp. The only case where we call + * structure pointed to by tp. The only case where we call * the completion routine (xfs_trans_committed) directly is * if the log is turned off on a debug kernel or we're * running in simulation mode (the log is explicitly turned @@ -887,8 +915,8 @@ shut_us_down: /* * Total up the number of log iovecs needed to commit this - * transaction. The transaction itself needs one for the - * transaction header. Ask each dirty item in turn how many + * transaction. The transaction itself needs one for the + * transaction header. Ask each dirty item in turn how many * it needs to get the total. */ STATIC uint @@ -956,7 +984,7 @@ xfs_trans_uncommit( /* * Fill in the vector with pointers to data to be logged - * by this transaction. The transaction header takes + * by this transaction. The transaction header takes * the first vector, and then each dirty item takes the * number of vectors it indicated it needed in xfs_trans_count_vecs(). * @@ -1044,7 +1072,7 @@ xfs_trans_cancel( flags &= ~XFS_TRANS_ABORT; /* * See if the caller is relying on us to shut down the - * filesystem. This happens in paths where we detect + * filesystem. This happens in paths where we detect * corruption and decide to give up. */ if ((tp->t_flags & XFS_TRANS_DIRTY) && diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 23264a5b9cdc..3cb2e0193b63 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -29,8 +29,8 @@ * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#ifndef __XFS_TRANS_H__ -#define __XFS_TRANS_H__ +#ifndef __XFS_TRANS_H__ +#define __XFS_TRANS_H__ /* * This is the structure written in the log at the head of @@ -48,22 +48,22 @@ typedef struct xfs_trans_header { uint th_num_items; /* num items logged by trans */ } xfs_trans_header_t; -#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */ +#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */ /* * Log item types. */ -#define XFS_LI_5_3_BUF 0x1234 /* v1 bufs, 1-block inode buffers */ -#define XFS_LI_5_3_INODE 0x1235 /* 1-block inode buffers */ -#define XFS_LI_EFI 0x1236 -#define XFS_LI_EFD 0x1237 -#define XFS_LI_IUNLINK 0x1238 -#define XFS_LI_6_1_INODE 0x1239 /* 4K non-aligned inode bufs */ -#define XFS_LI_6_1_BUF 0x123a /* v1, 4K inode buffers */ -#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */ -#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */ -#define XFS_LI_DQUOT 0x123d -#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_5_3_BUF 0x1234 /* v1 bufs, 1-block inode buffers */ +#define XFS_LI_5_3_INODE 0x1235 /* 1-block inode buffers */ +#define XFS_LI_EFI 0x1236 +#define XFS_LI_EFD 0x1237 +#define XFS_LI_IUNLINK 0x1238 +#define XFS_LI_6_1_INODE 0x1239 /* 4K non-aligned inode bufs */ +#define XFS_LI_6_1_BUF 0x123a /* v1, 4K inode buffers */ +#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */ +#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */ +#define XFS_LI_DQUOT 0x123d +#define XFS_LI_QUOTAOFF 0x123e /* * Transaction types. Used to distinguish types of buffers. @@ -84,15 +84,15 @@ typedef struct xfs_trans_header { #define XFS_TRANS_GROWFS 14 #define XFS_TRANS_STRAT_WRITE 15 #define XFS_TRANS_DIOSTRAT 16 -#define XFS_TRANS_WRITE_SYNC 17 -#define XFS_TRANS_WRITEID 18 -#define XFS_TRANS_ADDAFORK 19 -#define XFS_TRANS_ATTRINVAL 20 -#define XFS_TRANS_ATRUNCATE 21 -#define XFS_TRANS_ATTR_SET 22 -#define XFS_TRANS_ATTR_RM 23 -#define XFS_TRANS_ATTR_FLAG 24 -#define XFS_TRANS_CLEAR_AGI_BUCKET 25 +#define XFS_TRANS_WRITE_SYNC 17 +#define XFS_TRANS_WRITEID 18 +#define XFS_TRANS_ADDAFORK 19 +#define XFS_TRANS_ATTRINVAL 20 +#define XFS_TRANS_ATRUNCATE 21 +#define XFS_TRANS_ATTR_SET 22 +#define XFS_TRANS_ATTR_RM 23 +#define XFS_TRANS_ATTR_FLAG 24 +#define XFS_TRANS_CLEAR_AGI_BUCKET 25 #define XFS_TRANS_QM_SBCHANGE 26 /* * Dummy entries since we use the transaction type to index into the @@ -108,10 +108,10 @@ typedef struct xfs_trans_header { #define XFS_TRANS_QM_QUOTAOFF_END 34 #define XFS_TRANS_SB_UNIT 35 #define XFS_TRANS_FSYNC_TS 36 -#define XFS_TRANS_GROWFSRT_ALLOC 37 -#define XFS_TRANS_GROWFSRT_ZERO 38 -#define XFS_TRANS_GROWFSRT_FREE 39 -#define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_GROWFSRT_ALLOC 37 +#define XFS_TRANS_GROWFSRT_ZERO 38 +#define XFS_TRANS_GROWFSRT_FREE 39 +#define XFS_TRANS_SWAPEXT 40 /* new transaction types need to be reflected in xfs_logprint(8) */ @@ -162,7 +162,7 @@ typedef struct xfs_log_item { struct xfs_item_ops *li_ops; /* function list */ } xfs_log_item_t; -#define XFS_LI_IN_AIL 0x1 +#define XFS_LI_IN_AIL 0x1 #define XFS_LI_ABORTED 0x2 typedef struct xfs_item_ops { @@ -196,10 +196,10 @@ typedef struct xfs_item_ops { /* * Return values for the IOP_TRYLOCK() routines. */ -#define XFS_ITEM_SUCCESS 0 -#define XFS_ITEM_PINNED 1 -#define XFS_ITEM_LOCKED 2 -#define XFS_ITEM_FLUSHING 3 +#define XFS_ITEM_SUCCESS 0 +#define XFS_ITEM_PINNED 1 +#define XFS_ITEM_LOCKED 2 +#define XFS_ITEM_FLUSHING 3 #define XFS_ITEM_PUSHBUF 4 #endif /* __KERNEL__ */ @@ -229,7 +229,7 @@ typedef struct xfs_log_item_desc { * in this chunk's array are free. The unused field is the first value * not used since this chunk was allocated. */ -#define XFS_LIC_NUM_SLOTS 15 +#define XFS_LIC_NUM_SLOTS 15 typedef struct xfs_log_item_chunk { struct xfs_log_item_chunk *lic_next; ushort lic_free; @@ -237,77 +237,77 @@ typedef struct xfs_log_item_chunk { xfs_log_item_desc_t lic_descs[XFS_LIC_NUM_SLOTS]; } xfs_log_item_chunk_t; -#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1) -#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1) +#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1) +#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1) /* - * Initialize the given chunk. Set the chunk's free descriptor mask + * Initialize the given chunk. Set the chunk's free descriptor mask * to indicate that all descriptors are free. The caller gets to set - * lic_unused to the right value (0 matches all free). The + * lic_unused to the right value (0 matches all free). The * lic_descs.lid_index values are set up as each desc is allocated. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT) void xfs_lic_init(xfs_log_item_chunk_t *cp); -#define XFS_LIC_INIT(cp) xfs_lic_init(cp) +#define XFS_LIC_INIT(cp) xfs_lic_init(cp) #else -#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) +#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT) void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot); -#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) +#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) #else -#define XFS_LIC_INIT_SLOT(cp,slot) \ +#define XFS_LIC_INIT_SLOT(cp,slot) \ ((cp)->lic_descs[slot].lid_index = (unsigned char)(slot)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY) int xfs_lic_vacancy(xfs_log_item_chunk_t *cp); -#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) +#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) #else -#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK) +#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE) void xfs_lic_all_free(xfs_log_item_chunk_t *cp); -#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) +#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) #else -#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) +#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE) int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp); -#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) +#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) #else -#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\ +#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\ XFS_LIC_FREEMASK) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE) int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot); -#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) +#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) #else -#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot))) +#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM) void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot); -#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) +#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) #else -#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot))) +#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE) void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot); -#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) +#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) #else -#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot)) +#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT) xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot); -#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) +#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) #else -#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot])) +#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot])) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT) int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); -#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) +#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) #else -#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index)) +#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index)) #endif /* * Calculate the address of a chunk given a descriptor pointer: @@ -318,9 +318,9 @@ int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK) xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp); -#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) +#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) #else -#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \ +#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \ (((xfs_caddr_t)((dp) - (dp)->lid_index)) -\ (xfs_caddr_t)(((xfs_log_item_chunk_t*) \ 0)->lic_descs))) @@ -346,14 +346,14 @@ typedef struct xfs_log_busy_chunk { xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS]; } xfs_log_busy_chunk_t; -#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1) -#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1) +#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1) +#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1) -#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK) -#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot))) -#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)])) -#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK) -#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot))) +#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK) +#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot))) +#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)])) +#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK) +#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot))) /* * This is the type of function which can be given to xfs_trans_callback() @@ -373,21 +373,21 @@ typedef struct xfs_trans { unsigned int t_log_res; /* amt of log space resvd */ unsigned int t_log_count; /* count for perm log res */ unsigned int t_blk_res; /* # of blocks resvd */ - unsigned int t_blk_res_used; /* # of resvd blocks used */ + unsigned int t_blk_res_used; /* # of resvd blocks used */ unsigned int t_rtx_res; /* # of rt extents resvd */ - unsigned int t_rtx_res_used; /* # of resvd rt extents used */ + unsigned int t_rtx_res_used; /* # of resvd rt extents used */ xfs_log_ticket_t t_ticket; /* log mgr ticket */ sema_t t_sema; /* sema for commit completion */ xfs_lsn_t t_lsn; /* log seq num of start of * transaction. */ - xfs_lsn_t t_commit_lsn; /* log seq num of end of + xfs_lsn_t t_commit_lsn; /* log seq num of end of * transaction. */ struct xfs_mount *t_mountp; /* ptr to fs mount struct */ - struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */ + struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */ xfs_trans_callback_t t_callback; /* transaction callback */ void *t_callarg; /* callback arg */ unsigned int t_flags; /* misc flags */ - long t_icount_delta; /* superblock icount change */ + long t_icount_delta; /* superblock icount change */ long t_ifree_delta; /* superblock ifree change */ long t_fdblocks_delta; /* superblock fdblocks chg */ long t_res_fdblocks_delta; /* on-disk only chg */ @@ -414,42 +414,42 @@ typedef struct xfs_trans { #endif /* __KERNEL__ */ -#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ +#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ /* * Values for t_flags. */ -#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */ -#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ -#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ -#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */ +#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */ +#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ +#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ +#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */ #define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */ -#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ +#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ /* * Values for call flags parameter. */ -#define XFS_TRANS_NOSLEEP 0x1 -#define XFS_TRANS_WAIT 0x2 -#define XFS_TRANS_RELEASE_LOG_RES 0x4 -#define XFS_TRANS_ABORT 0x8 +#define XFS_TRANS_NOSLEEP 0x1 +#define XFS_TRANS_WAIT 0x2 +#define XFS_TRANS_RELEASE_LOG_RES 0x4 +#define XFS_TRANS_ABORT 0x8 /* * Field values for xfs_trans_mod_sb. */ -#define XFS_TRANS_SB_ICOUNT 0x00000001 -#define XFS_TRANS_SB_IFREE 0x00000002 -#define XFS_TRANS_SB_FDBLOCKS 0x00000004 -#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 -#define XFS_TRANS_SB_FREXTENTS 0x00000010 -#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 -#define XFS_TRANS_SB_DBLOCKS 0x00000040 -#define XFS_TRANS_SB_AGCOUNT 0x00000080 -#define XFS_TRANS_SB_IMAXPCT 0x00000100 -#define XFS_TRANS_SB_REXTSIZE 0x00000200 -#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 -#define XFS_TRANS_SB_RBLOCKS 0x00000800 -#define XFS_TRANS_SB_REXTENTS 0x00001000 -#define XFS_TRANS_SB_REXTSLOG 0x00002000 +#define XFS_TRANS_SB_ICOUNT 0x00000001 +#define XFS_TRANS_SB_IFREE 0x00000002 +#define XFS_TRANS_SB_FDBLOCKS 0x00000004 +#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 +#define XFS_TRANS_SB_FREXTENTS 0x00000010 +#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 +#define XFS_TRANS_SB_DBLOCKS 0x00000040 +#define XFS_TRANS_SB_AGCOUNT 0x00000080 +#define XFS_TRANS_SB_IMAXPCT 0x00000100 +#define XFS_TRANS_SB_REXTSIZE 0x00000200 +#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 +#define XFS_TRANS_SB_RBLOCKS 0x00000800 +#define XFS_TRANS_SB_REXTENTS 0x00001000 +#define XFS_TRANS_SB_REXTSLOG 0x00002000 /* @@ -475,9 +475,9 @@ typedef struct xfs_trans { * involved in freeing or allocating an extent. * 2 trees * (2 blocks/level * max depth - 1) * block size */ -#define XFS_ALLOCFREE_LOG_RES(mp,nx) \ +#define XFS_ALLOCFREE_LOG_RES(mp,nx) \ ((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1))) -#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \ +#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \ ((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1))) /* @@ -487,10 +487,10 @@ typedef struct xfs_trans { * v2 directory blocks can be fragmented below the dirblksize down to the fsb * size, so account for that in the DAENTER macros. */ -#define XFS_DIROP_LOG_RES(mp) \ +#define XFS_DIROP_LOG_RES(mp) \ (XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \ (XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1))) -#define XFS_DIROP_LOG_COUNT(mp) \ +#define XFS_DIROP_LOG_COUNT(mp) \ (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) @@ -522,7 +522,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 2) + \ (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) -#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) +#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) /* * In truncating a file we free up to two extents at once. We can modify: @@ -535,7 +535,7 @@ typedef struct xfs_trans { * worst case split in allocation btrees per extent assuming 4 extents: * 4 exts * 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \ +#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \ @@ -546,7 +546,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 4) + \ (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)))))) -#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) +#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate) /* * In renaming a files we can modify: @@ -560,7 +560,7 @@ typedef struct xfs_trans { * the superblock for the free block count: sector size * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_RENAME_LOG_RES(mp) \ +#define XFS_CALC_RENAME_LOG_RES(mp) \ (MAX( \ ((4 * (mp)->m_sb.sb_inodesize) + \ (2 * XFS_DIROP_LOG_RES(mp)) + \ @@ -571,7 +571,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 3) + \ (128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3)))))) -#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) +#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) /* * For creating a link to an inode: @@ -585,7 +585,7 @@ typedef struct xfs_trans { * the superblock for the free block count: sector size * the allocation btrees: 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_LINK_LOG_RES(mp) \ +#define XFS_CALC_LINK_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_inodesize + \ @@ -597,7 +597,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 1) + \ (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) -#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) +#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) /* * For removing a directory entry we can modify: @@ -611,7 +611,7 @@ typedef struct xfs_trans { * the superblock for the free block count: sector size * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_REMOVE_LOG_RES(mp) \ +#define XFS_CALC_REMOVE_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_inodesize + \ @@ -623,7 +623,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 2) + \ (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) -#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) +#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) /* * For symlink we can modify: @@ -639,7 +639,7 @@ typedef struct xfs_trans { * the inode btree: max depth * blocksize * the allocation btrees: 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_SYMLINK_LOG_RES(mp) \ +#define XFS_CALC_SYMLINK_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_inodesize + \ @@ -654,7 +654,7 @@ typedef struct xfs_trans { (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \ XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) -#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) +#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) /* * For create we can modify: @@ -671,7 +671,7 @@ typedef struct xfs_trans { * the inode btree: max depth * blocksize * the allocation btrees: 2 trees * (max depth - 1) * block size */ -#define XFS_CALC_CREATE_LOG_RES(mp) \ +#define XFS_CALC_CREATE_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_inodesize + \ @@ -686,14 +686,14 @@ typedef struct xfs_trans { (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \ XFS_ALLOCFREE_LOG_COUNT(mp, 1)))))) -#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) +#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) /* * Making a new directory is the same as creating a new file. */ -#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp) +#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp) -#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) +#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) /* * In freeing an inode we can modify: @@ -703,7 +703,7 @@ typedef struct xfs_trans { * the inode btree entry: block size * the on disk inode before ours in the agi hash list: inode cluster size */ -#define XFS_CALC_IFREE_LOG_RES(mp) \ +#define XFS_CALC_IFREE_LOG_RES(mp) \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_sectsize + \ (mp)->m_sb.sb_sectsize + \ @@ -711,16 +711,16 @@ typedef struct xfs_trans { MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \ (128 * 5)) -#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) +#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) /* * When only changing the inode we log the inode and possibly the superblock * We also add a bit of slop for the transaction stuff. */ -#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \ +#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_sectsize + 512) -#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) +#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) /* * Growing the data section of the filesystem. @@ -728,12 +728,12 @@ typedef struct xfs_trans { * agi and agf * allocation btrees */ -#define XFS_CALC_GROWDATA_LOG_RES(mp) \ +#define XFS_CALC_GROWDATA_LOG_RES(mp) \ ((mp)->m_sb.sb_sectsize * 3 + \ XFS_ALLOCFREE_LOG_RES(mp, 1) + \ (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) -#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) +#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata) /* * Growing the rt section of the filesystem. @@ -745,7 +745,7 @@ typedef struct xfs_trans { * bitmap/summary inode: inode size * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize */ -#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \ +#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \ (2 * (mp)->m_sb.sb_sectsize + \ XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \ (mp)->m_sb.sb_inodesize + \ @@ -754,17 +754,17 @@ typedef struct xfs_trans { (3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + \ XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) -#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) +#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc) /* * Growing the rt section of the filesystem. * In the second set of transactions (ZERO) we zero the new metadata blocks. * one bitmap/summary block: blocksize */ -#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \ +#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \ ((mp)->m_sb.sb_blocksize + 128) -#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) +#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero) /* * Growing the rt section of the filesystem. @@ -776,38 +776,38 @@ typedef struct xfs_trans { * one bitmap block: blocksize * summary blocks: new summary size */ -#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \ +#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \ ((mp)->m_sb.sb_sectsize + \ 2 * (mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_blocksize + \ (mp)->m_rsumsize + \ (128 * 5)) -#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) +#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree) /* * Logging the inode modification timestamp on a synchronous write. * inode */ -#define XFS_CALC_SWRITE_LOG_RES(mp) \ +#define XFS_CALC_SWRITE_LOG_RES(mp) \ ((mp)->m_sb.sb_inodesize + 128) -#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) +#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) /* * Logging the inode timestamps on an fsync -- same as SWRITE * as long as SWRITE logs the entire inode core */ -#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) +#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) /* * Logging the inode mode bits when writing a setuid/setgid file * inode */ -#define XFS_CALC_WRITEID_LOG_RES(mp) \ +#define XFS_CALC_WRITEID_LOG_RES(mp) \ ((mp)->m_sb.sb_inodesize + 128) -#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) +#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) /* * Converting the inode from non-attributed to attributed. @@ -817,7 +817,7 @@ typedef struct xfs_trans { * bmap blocks for the new directory block * allocation btrees */ -#define XFS_CALC_ADDAFORK_LOG_RES(mp) \ +#define XFS_CALC_ADDAFORK_LOG_RES(mp) \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_sectsize * 2 + \ (mp)->m_dirblksize + \ @@ -829,7 +829,7 @@ typedef struct xfs_trans { XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + \ XFS_ALLOCFREE_LOG_COUNT(mp, 1)))) -#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) +#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) /* * Removing the attribute fork of a file @@ -842,7 +842,7 @@ typedef struct xfs_trans { * worst case split in allocation btrees per extent assuming 4 extents: * 4 exts * 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \ +#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \ @@ -853,7 +853,7 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 4) + \ (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)))))) -#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) +#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) /* * Setting an attribute. @@ -865,13 +865,13 @@ typedef struct xfs_trans { * Since attribute transaction space is dependent on the size of the attribute, * the calculation is done partially at mount time and partially at runtime. */ -#define XFS_CALC_ATTRSET_LOG_RES(mp) \ +#define XFS_CALC_ATTRSET_LOG_RES(mp) \ ((mp)->m_sb.sb_inodesize + \ (mp)->m_sb.sb_sectsize + \ XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \ (128 * (2 + XFS_DA_NODE_MAXDEPTH))) -#define XFS_ATTRSET_LOG_RES(mp, ext) \ +#define XFS_ATTRSET_LOG_RES(mp, ext) \ ((mp)->m_reservations.tr_attrset + \ (ext * (mp)->m_sb.sb_sectsize) + \ (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \ @@ -888,7 +888,7 @@ typedef struct xfs_trans { * the superblock for the free block count: sector size * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size */ -#define XFS_CALC_ATTRRM_LOG_RES(mp) \ +#define XFS_CALC_ATTRRM_LOG_RES(mp) \ (MAX( \ ((mp)->m_sb.sb_inodesize + \ XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \ @@ -900,69 +900,69 @@ typedef struct xfs_trans { XFS_ALLOCFREE_LOG_RES(mp, 2) + \ (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))))) -#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) +#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) /* * Clearing a bad agino number in an agi hash bucket. */ -#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \ +#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \ ((mp)->m_sb.sb_sectsize + 128) -#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) +#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) /* * Various log count values. */ -#define XFS_DEFAULT_LOG_COUNT 1 -#define XFS_DEFAULT_PERM_LOG_COUNT 2 -#define XFS_ITRUNCATE_LOG_COUNT 2 -#define XFS_CREATE_LOG_COUNT 2 -#define XFS_MKDIR_LOG_COUNT 3 -#define XFS_SYMLINK_LOG_COUNT 3 -#define XFS_REMOVE_LOG_COUNT 2 -#define XFS_LINK_LOG_COUNT 2 -#define XFS_RENAME_LOG_COUNT 2 -#define XFS_WRITE_LOG_COUNT 2 -#define XFS_ADDAFORK_LOG_COUNT 2 -#define XFS_ATTRINVAL_LOG_COUNT 1 -#define XFS_ATTRSET_LOG_COUNT 3 -#define XFS_ATTRRM_LOG_COUNT 3 +#define XFS_DEFAULT_LOG_COUNT 1 +#define XFS_DEFAULT_PERM_LOG_COUNT 2 +#define XFS_ITRUNCATE_LOG_COUNT 2 +#define XFS_CREATE_LOG_COUNT 2 +#define XFS_MKDIR_LOG_COUNT 3 +#define XFS_SYMLINK_LOG_COUNT 3 +#define XFS_REMOVE_LOG_COUNT 2 +#define XFS_LINK_LOG_COUNT 2 +#define XFS_RENAME_LOG_COUNT 2 +#define XFS_WRITE_LOG_COUNT 2 +#define XFS_ADDAFORK_LOG_COUNT 2 +#define XFS_ATTRINVAL_LOG_COUNT 1 +#define XFS_ATTRSET_LOG_COUNT 3 +#define XFS_ATTRRM_LOG_COUNT 3 /* * Here we centralize the specification of XFS meta-data buffer * reference count values. This determine how hard the buffer * cache tries to hold onto the buffer. */ -#define XFS_AGF_REF 4 -#define XFS_AGI_REF 4 -#define XFS_AGFL_REF 3 -#define XFS_INO_BTREE_REF 3 -#define XFS_ALLOC_BTREE_REF 2 -#define XFS_BMAP_BTREE_REF 2 -#define XFS_DIR_BTREE_REF 2 -#define XFS_ATTR_BTREE_REF 1 -#define XFS_INO_REF 1 -#define XFS_DQUOT_REF 1 +#define XFS_AGF_REF 4 +#define XFS_AGI_REF 4 +#define XFS_AGFL_REF 3 +#define XFS_INO_BTREE_REF 3 +#define XFS_ALLOC_BTREE_REF 2 +#define XFS_BMAP_BTREE_REF 2 +#define XFS_DIR_BTREE_REF 2 +#define XFS_ATTR_BTREE_REF 1 +#define XFS_INO_REF 1 +#define XFS_DQUOT_REF 1 #ifdef __KERNEL__ /* * XFS transaction mechanism exported interfaces that are * actually macros. */ -#define xfs_trans_get_log_res(tp) ((tp)->t_log_res) -#define xfs_trans_get_log_count(tp) ((tp)->t_log_count) -#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res) -#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC) +#define xfs_trans_get_log_res(tp) ((tp)->t_log_res) +#define xfs_trans_get_log_count(tp) ((tp)->t_log_count) +#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res) +#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC) #ifdef DEBUG -#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (long)d) -#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (long)d) -#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (long)d) +#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (long)d) +#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (long)d) +#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (long)d) #else -#define xfs_trans_agblocks_delta(tp, d) -#define xfs_trans_agflist_delta(tp, d) -#define xfs_trans_agbtree_delta(tp, d) +#define xfs_trans_agblocks_delta(tp, d) +#define xfs_trans_agflist_delta(tp, d) +#define xfs_trans_agbtree_delta(tp, d) #endif /* @@ -1000,13 +1000,13 @@ void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *); void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); -struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); +struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); void xfs_efi_release(struct xfs_efi_log_item *, uint); void xfs_trans_log_efi_extent(xfs_trans_t *, struct xfs_efi_log_item *, xfs_fsblock_t, xfs_extlen_t); -struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *, +struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *, struct xfs_efi_log_item *, uint); void xfs_trans_log_efd_extent(xfs_trans_t *, diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index ebae51cd352e..f5f2c449ff49 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,19 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_log.h" +#include "xfs_trans_priv.h" +#include "xfs_error.h" STATIC void xfs_ail_insert(xfs_ail_entry_t *, xfs_log_item_t *); STATIC xfs_log_item_t * xfs_ail_delete(xfs_ail_entry_t *, xfs_log_item_t *); @@ -40,7 +52,7 @@ STATIC xfs_log_item_t * xfs_ail_next(xfs_ail_entry_t *, xfs_log_item_t *); #ifdef XFSDEBUG STATIC void xfs_ail_check(xfs_ail_entry_t *); #else -#define xfs_ail_check(a) +#define xfs_ail_check(a) #endif /* XFSDEBUG */ @@ -95,7 +107,7 @@ xfs_trans_push_ail( int flush_log; SPLDECL(s); -#define XFS_TRANS_PUSH_AIL_RESTARTS 10 +#define XFS_TRANS_PUSH_AIL_RESTARTS 10 AIL_LOCK(mp,s); lip = xfs_trans_first_ail(mp, &gen); @@ -111,7 +123,7 @@ xfs_trans_push_ail( /* * While the item we are looking at is below the given threshold - * try to flush it out. Make sure to limit the number of times + * try to flush it out. Make sure to limit the number of times * we allow xfs_trans_next_ail() to restart scanning from the * beginning of the list. We'd like not to stop until we've at least * tried to push on everything in the AIL with an LSN less than @@ -127,7 +139,7 @@ xfs_trans_push_ail( * If we can lock the item without sleeping, unlock * the AIL lock and flush the item. Then re-grab the * AIL lock so we can look for the next item on the - * AIL. Since we unlock the AIL while we flush the + * AIL. Since we unlock the AIL while we flush the * item, the next routine may start over again at the * the beginning of the list if anything has changed. * That is what the generation count is for. @@ -262,17 +274,17 @@ xfs_trans_unlocked_item( /* * Update the position of the item in the AIL with the new - * lsn. If it is not yet in the AIL, add it. Otherwise, move + * lsn. If it is not yet in the AIL, add it. Otherwise, move * it to its new position by removing it and re-adding it. * - * Wakeup anyone with an lsn less than the item's lsn. If the item + * Wakeup anyone with an lsn less than the item's lsn. If the item * we move in the AIL is the minimum one, update the tail lsn in the * log manager. * * Increment the AIL's generation count to indicate that the tree * has changed. * - * This function must be called with the AIL lock held. The lock + * This function must be called with the AIL lock held. The lock * is dropped before returning, so the caller must pass in the * cookie returned by AIL_LOCK. */ @@ -314,7 +326,7 @@ xfs_trans_update_ail( } /* xfs_trans_update_ail */ /* - * Delete the given item from the AIL. It must already be in + * Delete the given item from the AIL. It must already be in * the AIL. * * Wakeup anyone with an lsn less than item's lsn. If the item @@ -325,7 +337,7 @@ xfs_trans_update_ail( * bump the AIL's generation count to indicate that the tree * has changed. * - * This function must be called with the AIL lock held. The lock + * This function must be called with the AIL lock held. The lock * is dropped before returning, so the caller must pass in the * cookie returned by AIL_LOCK. */ @@ -456,7 +468,7 @@ xfs_trans_ail_init( */ STATIC void xfs_ail_insert( - xfs_ail_entry_t *base, + xfs_ail_entry_t *base, xfs_log_item_t *lip) /* ARGSUSED */ { @@ -490,12 +502,12 @@ xfs_ail_insert( } /* - * Delete the given item from the AIL. Return a pointer to the item. + * Delete the given item from the AIL. Return a pointer to the item. */ /*ARGSUSED*/ STATIC xfs_log_item_t * xfs_ail_delete( - xfs_ail_entry_t *base, + xfs_ail_entry_t *base, xfs_log_item_t *lip) /* ARGSUSED */ { @@ -514,7 +526,7 @@ xfs_ail_delete( */ STATIC xfs_log_item_t * xfs_ail_min( - xfs_ail_entry_t *base) + xfs_ail_entry_t *base) /* ARGSUSED */ { register xfs_log_item_t *forw = base->ail_forw; @@ -531,7 +543,7 @@ xfs_ail_min( */ STATIC xfs_log_item_t * xfs_ail_next( - xfs_ail_entry_t *base, + xfs_ail_entry_t *base, xfs_log_item_t *lip) /* ARGSUSED */ { @@ -583,6 +595,3 @@ xfs_ail_check( ASSERT(base->ail_back == prev_lip); } #endif /* XFSDEBUG */ - - - diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 0be1285cbc42..afa015938dc1 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,21 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_buf_item.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_error.h" +#include "xfs_rw.h" STATIC xfs_buf_t *xfs_trans_buf_item_match(xfs_trans_t *, xfs_buftarg_t *, @@ -41,7 +55,7 @@ STATIC xfs_buf_t *xfs_trans_buf_item_match_all(xfs_trans_t *, xfs_buftarg_t *, /* * Get and lock the buffer for the caller if it is not already - * locked within the given transaction. If it is already locked + * locked within the given transaction. If it is already locked * within the transaction, just increment its lock recursion count * and return a pointer to it. * @@ -258,7 +272,7 @@ int xfs_error_mod = 33; /* * Get and lock the buffer for the caller if it is not already - * locked within the given transaction. If it has not yet been + * locked within the given transaction. If it has not yet been * read in, read it from disk. If it is already locked * within the transaction and already read in, just increment its * lock recursion count and return a pointer to it. @@ -489,7 +503,7 @@ shutdown_abort: * xfs_trans_... buffer allocation routines if the buffer has not * been modified within this transaction. If the buffer is modified * within this transaction, do decrement the recursion count but do - * not release the buffer even if the count goes to 0. If the buffer is not + * not release the buffer even if the count goes to 0. If the buffer is not * modified within the transaction, decrement the recursion count and * release the buffer if the recursion count goes to 0. * @@ -566,7 +580,7 @@ xfs_trans_brelse(xfs_trans_t *tp, /* * If the buffer has been invalidated, then we can't release * it until the transaction commits to disk unless it is re-dirtied - * as part of this transaction. This prevents us from pulling + * as part of this transaction. This prevents us from pulling * the item from the AIL before we should. */ if (bip->bli_flags & XFS_BLI_STALE) { @@ -701,7 +715,7 @@ xfs_trans_bhold(xfs_trans_t *tp, /* * This function is used to indicate that the buffer should not be - * unlocked until the transaction is committed to disk. Since we + * unlocked until the transaction is committed to disk. Since we * are going to keep the lock held, make the transaction synchronous * so that the lock is not held too long. * @@ -807,7 +821,7 @@ xfs_trans_log_buf(xfs_trans_t *tp, * This called to invalidate a buffer that is being used within * a transaction. Typically this is because the blocks in the * buffer are being freed, so we need to prevent it from being - * written out when we're done. Allowing it to be written again + * written out when we're done. Allowing it to be written again * might overwrite data in the free blocks if they are reallocated * to a file. * @@ -857,7 +871,7 @@ xfs_trans_binval( /* * Clear the dirty bit in the buffer and set the STALE flag - * in the buf log item. The STALE flag will be used in + * in the buf log item. The STALE flag will be used in * xfs_buf_item_unpin() to determine if it should clean up * when the last reference to the buf item is given up. * We set the XFS_BLI_CANCEL flag in the buf log format structure @@ -1018,7 +1032,7 @@ xfs_trans_buf_item_match( (XFS_BUF_ADDR(bp) == blkno) && (XFS_BUF_COUNT(bp) == len)) { /* - * We found it. Break out and + * We found it. Break out and * return the pointer to the buffer. */ break; @@ -1075,7 +1089,7 @@ xfs_trans_buf_item_match_all( (XFS_BUF_ADDR(bp) == blkno) && (XFS_BUF_COUNT(bp) == len)) { /* - * We found it. Break out and + * We found it. Break out and * return the pointer to the buffer. */ return bp; diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c index 7ac26a45ccb6..93259a15f983 100644 --- a/fs/xfs/xfs_trans_extfree.c +++ b/fs/xfs/xfs_trans_extfree.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,18 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_extfree_item.h" /* * This routine is called to allocate an "extent free intention" @@ -117,7 +128,7 @@ xfs_trans_get_efd(xfs_trans_t *tp, /* * This routine is called to indicate that the described - * extent is to be logged as having been freed. It should + * extent is to be logged as having been freed. It should * be called once for each extent freed. */ void @@ -143,8 +154,3 @@ xfs_trans_log_efd_extent(xfs_trans_t *tp, extp->ext_len = ext_len; efdp->efd_next_extent++; } - - - - - diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c index 0df7fc3075cf..7e7c45766c04 100644 --- a/fs/xfs/xfs_trans_inode.c +++ b/fs/xfs/xfs_trans_inode.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,21 +30,43 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_trans_priv.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" #ifdef XFS_TRANS_DEBUG STATIC void xfs_trans_inode_broot_debug( xfs_inode_t *ip); #else -#define xfs_trans_inode_broot_debug(ip) +#define xfs_trans_inode_broot_debug(ip) #endif /* * Get and lock the inode for the caller if it is not already - * locked within the given transaction. If it is already locked + * locked within the given transaction. If it is already locked * within the transaction, just increment its lock recursion count * and return a pointer to it. * @@ -52,8 +74,8 @@ xfs_trans_inode_broot_debug( * opposed to the io lock, must be taken exclusively. This ensures * that the inode can be involved in only 1 transaction at a time. * Lock recursion is handled on the io lock, but only for lock modes - * of equal or lesser strength. That is, you can recur on the io lock - * held EXCL with a SHARED request but not vice versa. Also, if + * of equal or lesser strength. That is, you can recur on the io lock + * held EXCL with a SHARED request but not vice versa. Also, if * the inode is already a part of the transaction then you cannot * go from not holding the io lock to having it EXCL or SHARED. * @@ -221,7 +243,7 @@ xfs_trans_iput( /* * If the release is just for a recursive lock on the inode lock, - * then decrement the count and return. We can assert that + * then decrement the count and return. We can assert that * the caller is dropping an EXCL lock on the inode, because * inode must be locked EXCL within transactions. */ @@ -268,7 +290,7 @@ xfs_trans_iput( /* * Add the locked inode to the transaction. * The inode must be locked, and it cannot be associated with any - * transaction. The caller must specify the locks already held + * transaction. The caller must specify the locks already held * on the inode. */ void diff --git a/fs/xfs/xfs_trans_item.c b/fs/xfs/xfs_trans_item.c index a0ddb32a5b5a..56062796a81d 100644 --- a/fs/xfs/xfs_trans_item.c +++ b/fs/xfs/xfs_trans_item.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,8 +30,12 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> - +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *, int, int, xfs_lsn_t); @@ -140,7 +144,7 @@ xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip) * to the given slot. */ void -xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp) +xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp) { uint slot; xfs_log_item_chunk_t *licp; @@ -158,7 +162,7 @@ xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp) * the chunk. First pull it from the chunk list and then * free it back to the heap. We didn't bother with a doubly * linked list here because the lists should be very short - * and this is not a performance path. It's better to save + * and this is not a performance path. It's better to save * the memory of the extra pointer. * * Also decrement the transaction structure's count of free items @@ -180,14 +184,14 @@ xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp) * This is called to find the descriptor corresponding to the given * log item. It returns a pointer to the descriptor. * The log item MUST have a corresponding descriptor in the given - * transaction. This routine does not return NULL, it panics. + * transaction. This routine does not return NULL, it panics. * * The descriptor pointer is kept in the log item's li_desc field. * Just return it. */ /*ARGSUSED*/ xfs_log_item_desc_t * -xfs_trans_find_item(xfs_trans_t *tp, xfs_log_item_t *lip) +xfs_trans_find_item(xfs_trans_t *tp, xfs_log_item_t *lip) { ASSERT(lip->li_desc != NULL); @@ -450,7 +454,7 @@ xfs_trans_unlock_chunk( /* * This is called to add the given busy item to the transaction's - * list of busy items. It must find a free busy item descriptor + * list of busy items. It must find a free busy item descriptor * or allocate a new one and add the item to that descriptor. * The function returns a pointer to busy descriptor used to point * to the new busy entry. The log busy entry will now point to its new diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index 08c8b16667b8..d4dae7d06afc 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_TRANS_PRIV_H__ -#define __XFS_TRANS_PRIV_H__ +#define __XFS_TRANS_PRIV_H__ struct xfs_log_item; struct xfs_log_item_desc; diff --git a/fs/xfs/xfs_trans_space.h b/fs/xfs/xfs_trans_space.h index 1dec9dc10ef9..e91d173f4ed3 100644 --- a/fs/xfs/xfs_trans_space.h +++ b/fs/xfs/xfs_trans_space.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -35,71 +35,71 @@ /* * Components of space reservations. */ -#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \ +#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \ (((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0])) -#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1) +#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1) #define XFS_NEXTENTADD_SPACE_RES(mp,b,w)\ (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \ XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \ XFS_EXTENTADD_SPACE_RES(mp,w)) -#define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1) -#define XFS_DAENTER_DBS(mp,w) \ +#define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1) +#define XFS_DAENTER_DBS(mp,w) \ (XFS_DA_NODE_MAXDEPTH + \ ((XFS_DIR_IS_V2(mp) && (w) == XFS_DATA_FORK) ? 2 : 0)) -#define XFS_DAENTER_BLOCKS(mp,w) \ +#define XFS_DAENTER_BLOCKS(mp,w) \ (XFS_DAENTER_1B(mp,w) * XFS_DAENTER_DBS(mp,w)) -#define XFS_DAENTER_BMAP1B(mp,w) \ +#define XFS_DAENTER_BMAP1B(mp,w) \ XFS_NEXTENTADD_SPACE_RES(mp, XFS_DAENTER_1B(mp, w), w) -#define XFS_DAENTER_BMAPS(mp,w) \ +#define XFS_DAENTER_BMAPS(mp,w) \ (XFS_DAENTER_DBS(mp,w) * XFS_DAENTER_BMAP1B(mp,w)) -#define XFS_DAENTER_SPACE_RES(mp,w) \ +#define XFS_DAENTER_SPACE_RES(mp,w) \ (XFS_DAENTER_BLOCKS(mp,w) + XFS_DAENTER_BMAPS(mp,w)) -#define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w) -#define XFS_DIRENTER_MAX_SPLIT(mp,nl) \ +#define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w) +#define XFS_DIRENTER_MAX_SPLIT(mp,nl) \ (((mp)->m_sb.sb_blocksize == 512 && \ XFS_DIR_IS_V1(mp) && \ (nl) >= XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN) ? 2 : 1) -#define XFS_DIRENTER_SPACE_RES(mp,nl) \ +#define XFS_DIRENTER_SPACE_RES(mp,nl) \ (XFS_DAENTER_SPACE_RES(mp, XFS_DATA_FORK) * \ XFS_DIRENTER_MAX_SPLIT(mp,nl)) -#define XFS_DIRREMOVE_SPACE_RES(mp) \ +#define XFS_DIRREMOVE_SPACE_RES(mp) \ XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK) -#define XFS_IALLOC_SPACE_RES(mp) \ +#define XFS_IALLOC_SPACE_RES(mp) \ (XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp)-1) /* * Space reservation values for various transactions. */ -#define XFS_ADDAFORK_SPACE_RES(mp) \ +#define XFS_ADDAFORK_SPACE_RES(mp) \ ((mp)->m_dirblkfsbs + \ (XFS_DIR_IS_V1(mp) ? 0 : XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK))) -#define XFS_ATTRRM_SPACE_RES(mp) \ +#define XFS_ATTRRM_SPACE_RES(mp) \ XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK) /* This macro is not used - see inline code in xfs_attr_set */ -#define XFS_ATTRSET_SPACE_RES(mp, v) \ +#define XFS_ATTRSET_SPACE_RES(mp, v) \ (XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK) + XFS_B_TO_FSB(mp, v)) -#define XFS_CREATE_SPACE_RES(mp,nl) \ +#define XFS_CREATE_SPACE_RES(mp,nl) \ (XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl)) -#define XFS_DIOSTRAT_SPACE_RES(mp, v) \ +#define XFS_DIOSTRAT_SPACE_RES(mp, v) \ (XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + (v)) -#define XFS_GROWFS_SPACE_RES(mp) \ +#define XFS_GROWFS_SPACE_RES(mp) \ (2 * XFS_AG_MAXLEVELS(mp)) -#define XFS_GROWFSRT_SPACE_RES(mp,b) \ +#define XFS_GROWFSRT_SPACE_RES(mp,b) \ ((b) + XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK)) -#define XFS_LINK_SPACE_RES(mp,nl) \ +#define XFS_LINK_SPACE_RES(mp,nl) \ XFS_DIRENTER_SPACE_RES(mp,nl) -#define XFS_MKDIR_SPACE_RES(mp,nl) \ +#define XFS_MKDIR_SPACE_RES(mp,nl) \ (XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl)) -#define XFS_QM_DQALLOC_SPACE_RES(mp) \ +#define XFS_QM_DQALLOC_SPACE_RES(mp) \ (XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + \ XFS_DQUOT_CLUSTER_SIZE_FSB) -#define XFS_QM_QINOCREATE_SPACE_RES(mp) \ +#define XFS_QM_QINOCREATE_SPACE_RES(mp) \ XFS_IALLOC_SPACE_RES(mp) -#define XFS_REMOVE_SPACE_RES(mp) \ +#define XFS_REMOVE_SPACE_RES(mp) \ XFS_DIRREMOVE_SPACE_RES(mp) -#define XFS_RENAME_SPACE_RES(mp,nl) \ +#define XFS_RENAME_SPACE_RES(mp,nl) \ (XFS_DIRREMOVE_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl)) -#define XFS_SYMLINK_SPACE_RES(mp,nl,b) \ +#define XFS_SYMLINK_SPACE_RES(mp,nl,b) \ (XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl) + (b)) #endif /* __XFS_TRANS_SPACE_H__ */ diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h index 6070b4dd3334..bdb7ca141927 100644 --- a/fs/xfs/xfs_types.h +++ b/fs/xfs/xfs_types.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ #ifndef __XFS_TYPES_H__ -#define __XFS_TYPES_H__ +#define __XFS_TYPES_H__ #ifdef __KERNEL__ @@ -95,21 +95,21 @@ typedef __uint64_t __psunsigned_t; #endif typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */ -typedef __uint32_t xfs_extlen_t; /* extent length in blocks */ -typedef __uint32_t xfs_agnumber_t; /* allocation group number */ +typedef __uint32_t xfs_extlen_t; /* extent length in blocks */ +typedef __uint32_t xfs_agnumber_t; /* allocation group number */ typedef __int32_t xfs_extnum_t; /* # of extents in a file */ typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */ -typedef __int64_t xfs_fsize_t; /* bytes in a file */ +typedef __int64_t xfs_fsize_t; /* bytes in a file */ typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ -typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */ -typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */ +typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */ +typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */ -typedef __int64_t xfs_lsn_t; /* log sequence number */ -typedef __int32_t xfs_tid_t; /* transaction identifier */ +typedef __int64_t xfs_lsn_t; /* log sequence number */ +typedef __int32_t xfs_tid_t; /* transaction identifier */ -typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ -typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ +typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ +typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */ @@ -119,23 +119,23 @@ typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */ */ typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ -typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ -typedef __uint64_t xfs_dfiloff_t; /* block number in a file */ -typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */ +typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ +typedef __uint64_t xfs_dfiloff_t; /* block number in a file */ +typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */ /* * Memory based types are conditional. */ #if XFS_BIG_FILESYSTEMS -typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ -typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ +typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ +typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ -typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ +typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ #else -typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ -typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ +typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ +typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */ -typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ +typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ #endif typedef __uint64_t xfs_fileoff_t; /* block number in a file */ typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ @@ -146,28 +146,28 @@ typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */ /* * Null values for the types. */ -#define NULLDFSBNO ((xfs_dfsbno_t)-1) -#define NULLDRFSBNO ((xfs_drfsbno_t)-1) -#define NULLDRTBNO ((xfs_drtbno_t)-1) -#define NULLDFILOFF ((xfs_dfiloff_t)-1) +#define NULLDFSBNO ((xfs_dfsbno_t)-1) +#define NULLDRFSBNO ((xfs_drfsbno_t)-1) +#define NULLDRTBNO ((xfs_drtbno_t)-1) +#define NULLDFILOFF ((xfs_dfiloff_t)-1) -#define NULLFSBLOCK ((xfs_fsblock_t)-1) -#define NULLRFSBLOCK ((xfs_rfsblock_t)-1) -#define NULLRTBLOCK ((xfs_rtblock_t)-1) -#define NULLFILEOFF ((xfs_fileoff_t)-1) +#define NULLFSBLOCK ((xfs_fsblock_t)-1) +#define NULLRFSBLOCK ((xfs_rfsblock_t)-1) +#define NULLRTBLOCK ((xfs_rtblock_t)-1) +#define NULLFILEOFF ((xfs_fileoff_t)-1) -#define NULLAGBLOCK ((xfs_agblock_t)-1) -#define NULLAGNUMBER ((xfs_agnumber_t)-1) -#define NULLEXTNUM ((xfs_extnum_t)-1) +#define NULLAGBLOCK ((xfs_agblock_t)-1) +#define NULLAGNUMBER ((xfs_agnumber_t)-1) +#define NULLEXTNUM ((xfs_extnum_t)-1) #define NULLCOMMITLSN ((xfs_lsn_t)-1) /* * Max values for extlen, extnum, aextnum. */ -#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ -#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ -#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ +#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ +#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ +#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ /* * MAXNAMELEN is the length (including the terminating null) of diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index c4d552a134e3..4c4bd6bc208a 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,30 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_error.h" +#include "xfs_quota.h" +#include "xfs_rw.h" +#include "xfs_itable.h" +#include "xfs_utils.h" /* * xfs_get_dir_entry is used to get a reference to an inode given @@ -191,7 +214,7 @@ xfs_dir_ialloc( /* * Normally, xfs_trans_commit releases all the locks. * We call bhold to hang on to the ialloc_context across - * the commit. Holding this buffer prevents any other + * the commit. Holding this buffer prevents any other * processes from doing any allocations in this * allocation group. */ @@ -371,9 +394,9 @@ xfs_bumplink( (ip->i_d.di_nlink > XFS_MAXLINK_1)) { /* * The inode has increased its number of links beyond - * what can fit in an old format inode. It now needs + * what can fit in an old format inode. It now needs * to be converted to a version 2 inode with a 32 bit - * link count. If this is the first inode in the file + * link count. If this is the first inode in the file * system to do this, then we need to bump the superblock * version number as well. */ @@ -385,7 +408,7 @@ xfs_bumplink( } /* - * Try to truncate the given file to 0 length. Currently called + * Try to truncate the given file to 0 length. Currently called * only out of xfs_remove when it has to truncate a file to free * up space for the remove to proceed. */ @@ -428,7 +451,7 @@ xfs_truncate_file( } /* - * Follow the normal truncate locking protocol. Since we + * Follow the normal truncate locking protocol. Since we * hold the inode in the transaction, we know that it's number * of references will stay constant. */ diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h index 5df93e3414f6..e1ed6a588000 100644 --- a/fs/xfs/xfs_utils.h +++ b/fs/xfs/xfs_utils.h @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -34,7 +34,7 @@ #define IRELE(ip) VN_RELE(XFS_ITOV(ip)) #define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) -#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ +#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ (inst_t *)__return_address) extern int xfs_rename (bhv_desc_t *, vname_t *, vnode_t *, vname_t *, cred_t *); diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index ab854d5e1a7c..c296fbc9cd9e 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c @@ -13,7 +13,7 @@ * * 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 + * 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. @@ -32,7 +32,44 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_alloc_btree.h" +#include "xfs_btree.h" +#include "xfs_alloc.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_ag.h" +#include "xfs_error.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_rw.h" +#include "xfs_buf_item.h" +#include "xfs_extfree_item.h" +#include "xfs_quota.h" +#include "xfs_dmapi.h" +#include "xfs_dir2_trace.h" +#include "xfs_acl.h" +#include "xfs_attr.h" +#include "xfs_clnt.h" +#include "xfs_log_priv.h" STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); @@ -49,23 +86,21 @@ xfs_init(void) extern kmem_zone_t *xfs_efd_zone; extern kmem_zone_t *xfs_efi_zone; extern kmem_zone_t *xfs_dabuf_zone; - extern mutex_t xfs_uuidtabmon; #ifdef DEBUG_NOT - extern ktrace_t *xfs_alloc_trace_buf; - extern ktrace_t *xfs_bmap_trace_buf; - extern ktrace_t *xfs_bmbt_trace_buf; - extern ktrace_t *xfs_dir_trace_buf; - extern ktrace_t *xfs_attr_trace_buf; - extern ktrace_t *xfs_dir2_trace_buf; + extern ktrace_t *xfs_alloc_trace_buf; + extern ktrace_t *xfs_bmap_trace_buf; + extern ktrace_t *xfs_bmbt_trace_buf; + extern ktrace_t *xfs_dir_trace_buf; + extern ktrace_t *xfs_attr_trace_buf; + extern ktrace_t *xfs_dir2_trace_buf; #endif /* DEBUG */ #ifdef XFS_DABUF_DEBUG - extern lock_t xfs_dabuf_global_lock; + extern lock_t xfs_dabuf_global_lock; #endif #ifdef XFS_DABUF_DEBUG spinlock_init(&xfs_dabuf_global_lock, "xfsda"); #endif - mutex_init(&xfs_uuidtabmon, MUTEX_DEFAULT, "xfs_uuidtab"); /* * Initialize all of the zone allocators we use. @@ -180,7 +215,7 @@ xfs_cleanup(void) /* * xfs_start_flags - * + * * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock has _not_ yet been read in. */ @@ -205,7 +240,7 @@ xfs_start_flags( if (ap->logbufs != 0 && ap->logbufs != -1 && (ap->logbufs < XLOG_NUM_ICLOGS || ap->logbufs > XLOG_MAX_ICLOGS)) { - cmn_err(CE_WARN, + cmn_err(CE_WARN, "XFS: invalid logbufs value: %d [not %d-%d]", ap->logbufs, XLOG_NUM_ICLOGS, XLOG_MAX_ICLOGS); return XFS_ERROR(EINVAL); @@ -564,6 +599,46 @@ out: return XFS_ERROR(error); } +STATIC int +xfs_mntupdate( + bhv_desc_t *bdp, + int *flags, + struct xfs_mount_args *args) +{ + struct vfs *vfsp = bhvtovfs(bdp); + xfs_mount_t *mp = XFS_BHVTOM(bdp); + int pincount, error; + + if (args->flags & XFSMNT_NOATIME) + mp->m_flags |= XFS_MOUNT_NOATIME; + else + mp->m_flags &= ~XFS_MOUNT_NOATIME; + + if (!(vfsp->vfs_flag & VFS_RDONLY)) { + VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); + } + + if (*flags & MS_RDONLY) { + pagebuf_delwri_flush(mp->m_ddev_targp, 0, NULL); + xfs_finish_reclaim_all(mp); + + do { + VFS_SYNC(vfsp, SYNC_ATTR|SYNC_WAIT, NULL, error); + pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, + &pincount); + } while (pincount); + + /* Ok now write out an unmount record */ + xfs_log_unmount_write(mp); + xfs_unmountfs_writesb(mp); + vfsp->vfs_flag |= VFS_RDONLY; + } else { + vfsp->vfs_flag &= ~VFS_RDONLY; + } + + return 0; +} + /* * xfs_unmount_flush implements a set of flush operation on special * inodes, which are needed as a separate set of operations so that @@ -573,7 +648,7 @@ int xfs_unmount_flush( xfs_mount_t *mp, /* Mount structure we are getting rid of. */ - int relocation) /* Called from vfs relocation. */ + int relocation) /* Called from vfs relocation. */ { xfs_inode_t *rip = mp->m_rootip; xfs_inode_t *rbmip; @@ -651,8 +726,8 @@ fscorrupt_out2: * xfs_root extracts the root vnode from a vfs. * * vfsp -- the vfs struct for the desired file system - * vpp -- address of the caller's vnode pointer which should be - * set to the desired fs root vnode + * vpp -- address of the caller's vnode pointer which should be + * set to the desired fs root vnode */ STATIC int xfs_root( @@ -733,24 +808,24 @@ xfs_statvfs( * vfs_sync() so that items at the tail of the log are always moving out. * * Flags: - * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want + * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want * to sleep if we can help it. All we really need * to do is ensure that the log is synced at least * periodically. We also push the inodes and * superblock if we can lock them without sleeping * and they are not pinned. - * SYNC_ATTR - We need to flush the inodes. If SYNC_BDFLUSH is not + * SYNC_ATTR - We need to flush the inodes. If SYNC_BDFLUSH is not * set, then we really want to lock each inode and flush * it. - * SYNC_WAIT - All the flushes that take place in this call should + * SYNC_WAIT - All the flushes that take place in this call should * be synchronous. - * SYNC_DELWRI - This tells us to push dirty pages associated with - * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to + * SYNC_DELWRI - This tells us to push dirty pages associated with + * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to * determine if they should be flushed sync, async, or * delwri. - * SYNC_CLOSE - This flag is passed when the system is being + * SYNC_CLOSE - This flag is passed when the system is being * unmounted. We should sync and invalidate everthing. - * SYNC_FSDATA - This indicates that the caller would like to make + * SYNC_FSDATA - This indicates that the caller would like to make * sure the superblock is safe on disk. We can ensure * this by simply makeing sure the log gets flushed * if SYNC_BDFLUSH is set, and by actually writing it @@ -774,23 +849,23 @@ xfs_sync( * xfs sync routine for internal use * * This routine supports all of the flags defined for the generic VFS_SYNC - * interface as explained above under xys_sync. In the interests of not + * interface as explained above under xys_sync. In the interests of not * changing interfaces within the 6.5 family, additional internallly- * required functions are specified within a separate xflags parameter, * only available by calling this routine. * * xflags: - * XFS_XSYNC_RELOC - Sync for relocation. Don't try to get behavior - * locks as this will cause you to hang. Not all - * combinations of flags are necessarily supported - * when this is specified. + * XFS_XSYNC_RELOC - Sync for relocation. Don't try to get behavior + * locks as this will cause you to hang. Not all + * combinations of flags are necessarily supported + * when this is specified. */ int xfs_syncsub( xfs_mount_t *mp, int flags, - int xflags, - int *bypassed) + int xflags, + int *bypassed) { xfs_inode_t *ip = NULL; xfs_inode_t *ip_next; @@ -824,7 +899,7 @@ xfs_syncsub( * must be locked when this is called. After the call the list will no * longer be locked. */ -#define IPOINTER_INSERT(ip, mp) { \ +#define IPOINTER_INSERT(ip, mp) { \ ASSERT(ipointer_in == B_FALSE); \ ipointer->ip_mnext = ip->i_mnext; \ ipointer->ip_mprev = ip; \ @@ -841,7 +916,7 @@ xfs_syncsub( * the whole list. If we are the current head of the list then move the head * past us. */ -#define IPOINTER_REMOVE(ip, mp) { \ +#define IPOINTER_REMOVE(ip, mp) { \ ASSERT(ipointer_in == B_TRUE); \ if (ipointer->ip_mnext != (xfs_inode_t *)ipointer) { \ ip = ipointer->ip_mnext; \ @@ -975,7 +1050,7 @@ xfs_syncsub( * then we can skip inodes for which it looks like * there is nothing to do. Since we don't have the * inode locked this is racey, but these are periodic - * calls so it doesn't matter. For the others we want + * calls so it doesn't matter. For the others we want * to know for sure, so we at least try to lock them. */ if (flags & SYNC_BDFLUSH) { @@ -1002,7 +1077,7 @@ xfs_syncsub( * lock in xfs_ireclaim() after the inode is pulled from * the mount list will sleep until we release it here. * This keeps the vnode from being freed while we reference - * it. It is also cheaper and simpler than actually doing + * it. It is also cheaper and simpler than actually doing * a vn_get() for every inode we touch here. */ if (xfs_ilock_nowait(ip, lock_flags) == 0) { @@ -1066,7 +1141,7 @@ xfs_syncsub( * * We don't set the VREMAPPING bit in the vnode * here, because we don't hold the vnode lock - * exclusively. It doesn't really matter, though, + * exclusively. It doesn't really matter, though, * because we only come here when we're shutting * down anyway. */ @@ -1281,7 +1356,7 @@ xfs_syncsub( /* * If we had to take a reference on the vnode * above, then wait until after we've unlocked - * the inode to release the reference. This is + * the inode to release the reference. This is * because we can be already holding the inode * lock when VN_RELE() calls xfs_inactive(). * @@ -1496,12 +1571,246 @@ xfs_vget( } +#define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */ +#define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */ +#define MNTOPT_LOGDEV "logdev" /* log device */ +#define MNTOPT_RTDEV "rtdev" /* realtime I/O device */ +#define MNTOPT_BIOSIZE "biosize" /* log2 of preferred buffered io size */ +#define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */ +#define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */ +#define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */ +#define MNTOPT_SUNIT "sunit" /* data volume stripe unit */ +#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */ +#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */ +#define MNTOPT_MTPT "mtpt" /* filesystem mount point */ +#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ +#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */ +#define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */ + + +int +xfs_parseargs( + struct bhv_desc *bhv, + char *options, + struct xfs_mount_args *args, + int update) +{ + struct vfs *vfsp = bhvtovfs(bhv); + char *this_char, *value, *eov; + int dsunit, dswidth, vol_dsunit, vol_dswidth; + int iosize; + + if (!options) + return 0; + + iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0; + + while ((this_char = strsep(&options, ",")) != NULL) { + if (!*this_char) + continue; + if ((value = strchr(this_char, '=')) != NULL) + *value++ = 0; + + if (!strcmp(this_char, MNTOPT_LOGBUFS)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_LOGBUFS); + return -EINVAL; + } + args->logbufs = simple_strtoul(value, &eov, 10); + } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { + int last, in_kilobytes = 0; + + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_LOGBSIZE); + return -EINVAL; + } + last = strlen(value) - 1; + if (value[last] == 'K' || value[last] == 'k') { + in_kilobytes = 1; + value[last] = '\0'; + } + args->logbufsize = simple_strtoul(value, &eov, 10); + if (in_kilobytes) + args->logbufsize <<= 10; + } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_LOGDEV); + return -EINVAL; + } + strncpy(args->logname, value, MAXNAMELEN); + } else if (!strcmp(this_char, MNTOPT_MTPT)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_MTPT); + return -EINVAL; + } + strncpy(args->mtpt, value, MAXNAMELEN); + } else if (!strcmp(this_char, MNTOPT_RTDEV)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_RTDEV); + return -EINVAL; + } + strncpy(args->rtname, value, MAXNAMELEN); + } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_BIOSIZE); + return -EINVAL; + } + iosize = simple_strtoul(value, &eov, 10); + args->flags |= XFSMNT_IOSIZE; + args->iosizelog = (uint8_t) iosize; + } else if (!strcmp(this_char, MNTOPT_WSYNC)) { + args->flags |= XFSMNT_WSYNC; + } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) { + args->flags |= XFSMNT_OSYNCISOSYNC; + } else if (!strcmp(this_char, MNTOPT_NORECOVERY)) { + args->flags |= XFSMNT_NORECOVERY; + } else if (!strcmp(this_char, MNTOPT_INO64)) { + args->flags |= XFSMNT_INO64; +#ifndef XFS_BIG_FILESYSTEMS + printk("XFS: %s option not allowed on this system\n", + MNTOPT_INO64); + return -EINVAL; +#endif + } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { + args->flags |= XFSMNT_NOALIGN; + } else if (!strcmp(this_char, MNTOPT_SUNIT)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_SUNIT); + return -EINVAL; + } + dsunit = simple_strtoul(value, &eov, 10); + } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { + if (!value || !*value) { + printk("XFS: %s option requires an argument\n", + MNTOPT_SWIDTH); + return -EINVAL; + } + dswidth = simple_strtoul(value, &eov, 10); + } else if (!strcmp(this_char, MNTOPT_NOUUID)) { + args->flags |= XFSMNT_NOUUID; + } else if (!strcmp(this_char, MNTOPT_NOLOGFLUSH)) { + args->flags |= XFSMNT_NOLOGFLUSH; + } else if (!strcmp(this_char, "osyncisdsync")) { + /* no-op, this is now the default */ +printk("XFS: osyncisdsync is now the default, option is deprecated.\n"); + } else if (!strcmp(this_char, "irixsgid")) { +printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n"); + } else { + printk("XFS: unknown mount option [%s].\n", this_char); + return -EINVAL; + } + } + + if (args->flags & XFSMNT_NORECOVERY) { + if ((vfsp->vfs_flag & VFS_RDONLY) == 0) { + printk("XFS: no-recovery mounts must be read-only.\n"); + return -EINVAL; + } + } + + if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) { + printk( + "XFS: sunit and swidth options incompatible with the noalign option\n"); + return -EINVAL; + } + + if ((dsunit && !dswidth) || (!dsunit && dswidth)) { + printk("XFS: sunit and swidth must be specified together\n"); + return -EINVAL; + } + + if (dsunit && (dswidth % dsunit != 0)) { + printk( + "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)\n", + dswidth, dsunit); + return -EINVAL; + } + + if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { + if (dsunit) { + args->sunit = dsunit; + args->flags |= XFSMNT_RETERR; + } else { + args->sunit = vol_dsunit; + } + dswidth ? (args->swidth = dswidth) : + (args->swidth = vol_dswidth); + } else { + args->sunit = args->swidth = 0; + } + + return 0; +} + +int +xfs_showargs( + struct bhv_desc *bhv, + struct seq_file *m) +{ + static struct proc_xfs_info { + int flag; + char *str; + } xfs_info[] = { + /* the few simple ones we can get from the mount struct */ + { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN }, + { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, + { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC }, + { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, + { 0, NULL } + }; + struct proc_xfs_info *xfs_infop; + struct xfs_mount *mp = XFS_BHVTOM(bhv); + char b[BDEVNAME_SIZE]; + + for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { + if (mp->m_flags & xfs_infop->flag) + seq_puts(m, xfs_infop->str); + } + + if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) + seq_printf(m, "," MNTOPT_BIOSIZE "=%d", mp->m_writeio_log); + + if (mp->m_logbufs > 0) + seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs); + + if (mp->m_logbsize > 0) + seq_printf(m, "," MNTOPT_LOGBSIZE "=%d", mp->m_logbsize); + + if (mp->m_ddev_targp->pbr_dev != mp->m_logdev_targp->pbr_dev) + seq_printf(m, "," MNTOPT_LOGDEV "=%s", + bdevname(mp->m_logdev_targp->pbr_bdev, b)); + + if (mp->m_rtdev_targp && + mp->m_ddev_targp->pbr_dev != mp->m_rtdev_targp->pbr_dev) + seq_printf(m, "," MNTOPT_RTDEV "=%s", + bdevname(mp->m_rtdev_targp->pbr_bdev, b)); + + if (mp->m_dalign > 0) + seq_printf(m, "," MNTOPT_SUNIT "=%d", + (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); + + if (mp->m_swidth > 0) + seq_printf(m, "," MNTOPT_SWIDTH "=%d", + (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); + + return 0; +} + + vfsops_t xfs_vfsops = { BHV_IDENTITY_INIT(VFS_BHV_XFS,VFS_POSITION_XFS), .vfs_parseargs = xfs_parseargs, .vfs_showargs = xfs_showargs, .vfs_mount = xfs_mount, .vfs_unmount = xfs_unmount, + .vfs_mntupdate = xfs_mntupdate, .vfs_root = xfs_root, .vfs_statvfs = xfs_statvfs, .vfs_sync = xfs_sync, diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 1ad2d54f7027..4ce175a7c5eb 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,7 +30,45 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> +#include "xfs.h" +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_itable.h" +#include "xfs_btree.h" +#include "xfs_ialloc.h" +#include "xfs_alloc.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode_item.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_rw.h" +#include "xfs_error.h" +#include "xfs_bit.h" +#include "xfs_rtalloc.h" +#include "xfs_quota.h" +#include "xfs_utils.h" +#include "xfs_trans_space.h" +#include "xfs_dir_leaf.h" +#include "xfs_dmapi.h" +#include "xfs_mac.h" +#include "xfs_log_priv.h" /* @@ -46,7 +84,7 @@ extern int xfs_ioctl(bhv_desc_t *, struct inode *, struct file *, /* * For xfs, we check that the file isn't too big to be opened by this kernel. - * No other open action is required for regular files. Devices are handled + * No other open action is required for regular files. Devices are handled * through the specfs file system, pipes through fifofs. Device and * fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively, * when a new vnode is first looked up or created. @@ -227,7 +265,9 @@ xfs_getattr( ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? XFS_XFLAG_REALTIME : 0) | ((ip->i_d.di_flags & XFS_DIFLAG_PREALLOC) ? - XFS_XFLAG_PREALLOC : 0); + XFS_XFLAG_PREALLOC : 0) | + (XFS_IFORK_Q(ip) ? + XFS_XFLAG_HASATTR : 0); vap->va_extsize = ip->i_d.di_extsize << mp->m_sb.sb_blocklog; vap->va_nextents = (ip->i_df.if_flags & XFS_IFEXTENTS) ? @@ -607,10 +647,10 @@ xfs_setattr( } /* - * Now we can make the changes. Before we join the inode + * Now we can make the changes. Before we join the inode * to the transaction, if XFS_AT_SIZE is set then take care of * the part of the truncation that must be done without the - * inode lock. This needs to be done before joining the inode + * inode lock. This needs to be done before joining the inode * to the transaction, because the inode cannot be unlocked * once it is a part of the transaction. */ @@ -917,14 +957,14 @@ xfs_readlink( uio_t *uiop, cred_t *credp) { - xfs_inode_t *ip; + xfs_inode_t *ip; int count; xfs_off_t offset; int pathlen; vnode_t *vp; int error = 0; xfs_mount_t *mp; - int nmaps; + int nmaps; xfs_bmbt_irec_t mval[SYMLINK_MAPS]; xfs_daddr_t d; int byte_cnt; @@ -970,7 +1010,7 @@ xfs_readlink( } else { /* - * Symlink not inline. Call bmap to get it in. + * Symlink not inline. Call bmap to get it in. */ nmaps = SYMLINK_MAPS; @@ -1051,7 +1091,7 @@ xfs_fsync( syncall = error = error2 = 0; - if (stop == -1) { + if (stop == -1) { ASSERT(start >= 0); if (start == 0) syncall = 1; @@ -1097,9 +1137,9 @@ xfs_fsync( * because it has to change some field in the inode core * (typically nextents or nblocks). That assumption * implies that any transactions against an inode will - * catch any non-transactional updates. If inode-altering + * catch any non-transactional updates. If inode-altering * transactions exist that violate this assumption, the - * code breaks. Right now, it figures that if the involved + * code breaks. Right now, it figures that if the involved * update_* field is clear and the inode is unpinned, the * inode is clean. Either it's been flushed or it's been * committed and the commit has hit the disk unpinning the inode. @@ -1177,7 +1217,7 @@ xfs_fsync( #if 0 /* - * This is a utility routine for xfs_inactive. It is called when a + * This is a utility routine for xfs_inactive. It is called when a * transaction attempting to free up the disk space for a file encounters * an error. It cancels the old transaction and starts up a new one * to be used to free up the inode. It also sets the inode size and extent @@ -1239,11 +1279,11 @@ xfs_inactive_free_eofblocks( xfs_fileoff_t last_fsb; xfs_filblks_t map_len; int nimaps; - xfs_bmbt_irec_t imap; + xfs_bmbt_irec_t imap; /* * Figure out if there are any blocks beyond the end - * of the file. If not, then there is nothing to do. + * of the file. If not, then there is nothing to do. */ end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_d.di_size)); last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAX_FILE_OFFSET); @@ -1335,10 +1375,10 @@ xfs_inactive_symlink_rmt( int done; int error; xfs_fsblock_t first_block; - xfs_bmap_free_t free_list; + xfs_bmap_free_t free_list; int i; xfs_mount_t *mp; - xfs_bmbt_irec_t mval[SYMLINK_MAPS]; + xfs_bmbt_irec_t mval[SYMLINK_MAPS]; int nmaps; xfs_trans_t *ntp; int size; @@ -1350,7 +1390,7 @@ xfs_inactive_symlink_rmt( /* * We're freeing a symlink that has some * blocks allocated to it. Free the - * blocks here. We know that we've got + * blocks here. We know that we've got * either 1 or 2 extents and that we can * free them all in one bunmapi call. */ @@ -1788,7 +1828,7 @@ xfs_inactive( if (error) { /* * If we fail to free the inode, shut down. The cancel - * might do that, we need to make sure. Otherwise the + * might do that, we need to make sure. Otherwise the * inode might be lost for a long time or forever. */ if (!XFS_FORCED_SHUTDOWN(mp)) { @@ -1859,7 +1899,7 @@ xfs_lookup( } -#define XFS_CREATE_NEW_MAXTRIES 10000 +#define XFS_CREATE_NEW_MAXTRIES 10000 /* * xfs_create (create a new file). @@ -1875,11 +1915,11 @@ xfs_create( char *name = VNAME(dentry); vnode_t *dir_vp; xfs_inode_t *dp, *ip; - vnode_t *vp=NULL; + vnode_t *vp=NULL; xfs_trans_t *tp; - xfs_mount_t *mp; + xfs_mount_t *mp; xfs_dev_t rdev; - int error; + int error; xfs_bmap_free_t free_list; xfs_fsblock_t first_block; boolean_t dp_joined_to_trans; @@ -1940,7 +1980,7 @@ xfs_create( resblks = XFS_CREATE_SPACE_RES(mp, namelen); /* * Initially assume that the file does not exist and - * reserve the resources for that case. If that is not + * reserve the resources for that case. If that is not * the case we'll drop the one we have and get a more * appropriate transaction later. */ @@ -2340,10 +2380,10 @@ again: } #ifdef DEBUG -#define REMOVE_DEBUG_TRACE(x) {remove_which_error_return = (x);} +#define REMOVE_DEBUG_TRACE(x) {remove_which_error_return = (x);} int remove_which_error_return = 0; #else /* ! DEBUG */ -#define REMOVE_DEBUG_TRACE(x) +#define REMOVE_DEBUG_TRACE(x) #endif /* ! DEBUG */ @@ -2359,12 +2399,12 @@ xfs_remove( { vnode_t *dir_vp; char *name = VNAME(dentry); - xfs_inode_t *dp, *ip; - xfs_trans_t *tp = NULL; + xfs_inode_t *dp, *ip; + xfs_trans_t *tp = NULL; xfs_mount_t *mp; - int error = 0; - xfs_bmap_free_t free_list; - xfs_fsblock_t first_block; + int error = 0; + xfs_bmap_free_t free_list; + xfs_fsblock_t first_block; int cancel_flags; int committed; int dm_di_mode = 0; @@ -2567,7 +2607,7 @@ xfs_remove( error_rele: /* * In this case make sure to not release the inode until after - * the current transaction is aborted. Releasing it beforehand + * the current transaction is aborted. Releasing it beforehand * can cause us to go to xfs_inactive and start a recursive * transaction which can easily deadlock with the current one. */ @@ -2597,8 +2637,8 @@ xfs_link( xfs_mount_t *mp; xfs_inode_t *ips[2]; int error; - xfs_bmap_free_t free_list; - xfs_fsblock_t first_block; + xfs_bmap_free_t free_list; + xfs_fsblock_t first_block; int cancel_flags; int committed; vnode_t *target_dir_vp; @@ -2765,7 +2805,7 @@ xfs_mkdir( cred_t *credp) { char *dir_name = VNAME(dentry); - xfs_inode_t *dp; + xfs_inode_t *dp; xfs_inode_t *cdp; /* inode of created dir */ vnode_t *cvp; /* vnode of created dir */ xfs_trans_t *tp; @@ -2774,8 +2814,8 @@ xfs_mkdir( int cancel_flags; int error; int committed; - xfs_bmap_free_t free_list; - xfs_fsblock_t first_block; + xfs_bmap_free_t free_list; + xfs_fsblock_t first_block; vnode_t *dir_vp; boolean_t dp_joined_to_trans; boolean_t created = B_FALSE; @@ -2869,7 +2909,7 @@ xfs_mkdir( * create the directory inode. */ rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; - error = xfs_dir_ialloc(&tp, dp, + error = xfs_dir_ialloc(&tp, dp, MAKEIMODE(vap->va_type,vap->va_mode), 2, rdev, credp, prid, resblks > 0, &cdp, NULL); @@ -2998,13 +3038,13 @@ xfs_rmdir( cred_t *credp) { char *name = VNAME(dentry); - xfs_inode_t *dp; - xfs_inode_t *cdp; /* child directory */ - xfs_trans_t *tp; + xfs_inode_t *dp; + xfs_inode_t *cdp; /* child directory */ + xfs_trans_t *tp; xfs_mount_t *mp; - int error; - xfs_bmap_free_t free_list; - xfs_fsblock_t first_block; + int error; + xfs_bmap_free_t free_list; + xfs_fsblock_t first_block; int cancel_flags; int committed; vnode_t *dir_vp; @@ -3038,7 +3078,7 @@ xfs_rmdir( /* * We need to get a reference to cdp before we get our log - * reservation. The reason for this is that we cannot call + * reservation. The reason for this is that we cannot call * xfs_iget for an inode for which we do not have a reference * once we've acquired a log reservation. This is because the * inode we are trying to get might be in xfs_inactive going @@ -3112,7 +3152,7 @@ xfs_rmdir( if (dp != cdp) { /* * Only increment the parent directory vnode count if - * we didn't bump it in looking up cdp. The only time + * we didn't bump it in looking up cdp. The only time * we don't bump it is when we're looking up ".". */ VN_HOLD(dir_vp); @@ -3335,9 +3375,9 @@ xfs_symlink( * Check component lengths of the target path name. */ pathlen = strlen(target_path); - if (pathlen >= MAXPATHLEN) /* total string too long */ + if (pathlen >= MAXPATHLEN) /* total string too long */ return XFS_ERROR(ENAMETOOLONG); - if (pathlen >= MAXNAMELEN) { /* is any component too long? */ + if (pathlen >= MAXNAMELEN) { /* is any component too long? */ int len, total; char *path; @@ -3663,7 +3703,7 @@ xfs_rwunlock( bhv_desc_t *bdp, vrwlock_t locktype) { - xfs_inode_t *ip; + xfs_inode_t *ip; vnode_t *vp; vp = BHV_TO_VNODE(bdp); @@ -3707,7 +3747,7 @@ xfs_inode_flush( if (flags & FLUSH_LOG) { xfs_inode_log_item_t *iip = ip->i_itemp; - + if (iip && iip->ili_last_lsn) { xlog_t *log = mp->m_log; xfs_lsn_t sync_lsn; @@ -3782,7 +3822,7 @@ xfs_set_dmattrs ( u_int16_t state, cred_t *credp) { - xfs_inode_t *ip; + xfs_inode_t *ip; xfs_trans_t *tp; xfs_mount_t *mp; int error; @@ -3806,7 +3846,7 @@ xfs_set_dmattrs ( xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); ip->i_iocore.io_dmevmask = ip->i_d.di_dmevmask = evmask; - ip->i_iocore.io_dmstate = ip->i_d.di_dmstate = state; + ip->i_iocore.io_dmstate = ip->i_d.di_dmstate = state; xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); IHOLD(ip); @@ -3990,21 +4030,21 @@ xfs_finish_reclaim_all(xfs_mount_t *mp) ip = ip->i_mnext; continue; } - + /* * It's up to our caller to purge the root * and quota vnodes later. */ vp = XFS_ITOV_NULL(ip); - + if (!vp) { - XFS_MOUNT_IUNLOCK(mp); + XFS_MOUNT_IUNLOCK(mp); xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC); purged = 1; break; } } while (ip != mp->m_inodes); - + done = !purged; } @@ -4014,7 +4054,7 @@ xfs_finish_reclaim_all(xfs_mount_t *mp) /* * xfs_alloc_file_space() - * This routine allocates disk space for the given file. + * This routine allocates disk space for the given file. * * If alloc_type == 0, this request is for an ALLOCSP type * request which will change the file size. In this case, no @@ -4027,8 +4067,8 @@ xfs_finish_reclaim_all(xfs_mount_t *mp) * length. * * RETURNS: - * 0 on success - * errno on error + * 0 on success + * errno on error * */ int @@ -4087,14 +4127,14 @@ xfs_alloc_file_space( imapp = &imaps[0]; reccount = 1; xfs_bmapi_flags = XFS_BMAPI_WRITE | (alloc_type ? XFS_BMAPI_PREALLOC : 0); - startoffset_fsb = XFS_B_TO_FSBT(mp, offset); + startoffset_fsb = XFS_B_TO_FSBT(mp, offset); allocatesize_fsb = XFS_B_TO_FSB(mp, count); /* Generate a DMAPI event if needed. */ if (alloc_type != 0 && offset < ip->i_d.di_size && (attr_flags&ATTR_DMI) == 0 && DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { - xfs_off_t end_dmi_offset; + xfs_off_t end_dmi_offset; end_dmi_offset = offset+len; if (end_dmi_offset > ip->i_d.di_size) @@ -4297,14 +4337,14 @@ xfs_zero_remaining_bytes( /* * xfs_free_file_space() - * This routine frees disk space for the given file. + * This routine frees disk space for the given file. * * This routine is only called by xfs_change_file_space * for an UNRESVSP type call. * * RETURNS: - * 0 on success - * errno on error + * 0 on success + * errno on error * */ STATIC int @@ -4343,7 +4383,7 @@ xfs_free_file_space( if (len <= 0) /* if nothing being freed */ return error; rt = (ip->i_d.di_flags & XFS_DIFLAG_REALTIME); - startoffset_fsb = XFS_B_TO_FSB(mp, offset); + startoffset_fsb = XFS_B_TO_FSB(mp, offset); end_dmi_offset = offset + len; endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); @@ -4495,13 +4535,13 @@ xfs_free_file_space( /* * xfs_change_file_space() - * This routine allocates or frees disk space for the given file. - * The user specified parameters are checked for alignment and size - * limitations. + * This routine allocates or frees disk space for the given file. + * The user specified parameters are checked for alignment and size + * limitations. * * RETURNS: - * 0 on success - * errno on error + * 0 on success + * errno on error * */ int diff --git a/fs/xfs/xfsidbg.c b/fs/xfs/xfsidbg.c index b519b40626d7..13edfe86d4c9 100644 --- a/fs/xfs/xfsidbg.c +++ b/fs/xfs/xfsidbg.c @@ -11,7 +11,7 @@ * * 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 + * 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. @@ -30,9 +30,7 @@ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ -#include <xfs.h> -#include <xfs_log_recover.h> -#include "quota/xfs_qm.h" +#include "xfs.h" #include "pagebuf/page_buf_internal.h" #include <linux/ctype.h> @@ -41,7 +39,49 @@ #include <linux/mm.h> #include <linux/init.h> -MODULE_AUTHOR("SGI <sgi.com>"); +#include "xfs_macros.h" +#include "xfs_types.h" +#include "xfs_inum.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_dir.h" +#include "xfs_dir2.h" +#include "xfs_dmapi.h" +#include "xfs_mount.h" +#include "xfs_alloc.h" +#include "xfs_ag.h" +#include "xfs_alloc_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_btree.h" +#include "xfs_buf_item.h" +#include "xfs_extfree_item.h" +#include "xfs_inode_item.h" +#include "xfs_attr_sf.h" +#include "xfs_dir_sf.h" +#include "xfs_dir2_sf.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_bmap.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_leaf.h" +#include "xfs_dir_leaf.h" +#include "xfs_dir2_data.h" +#include "xfs_dir2_leaf.h" +#include "xfs_dir2_block.h" +#include "xfs_dir2_node.h" +#include "xfs_dir2_trace.h" +#include "xfs_log_priv.h" +#include "xfs_log_recover.h" +#include "xfs_rw.h" +#include "xfs_bit.h" +#include "xfs_quota.h" +#include "xfs_log_recover.h" +#include "quota/xfs_qm.h" + +MODULE_AUTHOR("Silicon Graphics, Inc."); MODULE_DESCRIPTION("Additional kdb commands for debugging XFS"); MODULE_LICENSE("GPL"); @@ -1398,9 +1438,9 @@ static void printvnode(vnode_t *vp) #ifdef CONFIG_XFS_VNODE_TRACING kdb_printf(" v_trace 0x%p\n", vp->v_trace); #endif /* CONFIG_XFS_VNODE_TRACING */ - + kdb_printf(" v_vfsp 0x%p v_number %Lx\n", - vp->v_vfsp, vp->v_number); + vp->v_vfsp, vp->v_number); } @@ -1645,7 +1685,7 @@ static void printinode(struct inode *ip) ip->i_size); kdb_printf( - " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n", + " i_mode = 0x%x i_nlink = %d i_rdev = 0x%x i_state = 0x%lx\n", ip->i_mode, ip->i_nlink, kdev_t_to_nr(ip->i_rdev), ip->i_state); @@ -1732,11 +1772,9 @@ static char *pb_flag_vals[] = { /* 0 */ "READ", "WRITE", "MAPPED", "PARTIAL", "ASYNC", /* 5 */ "NONE", "DELWRI", "FREED", "SYNC", "MAPPABLE", /* 10 */ "STALE", "FS_MANAGED", "INVALID12", "LOCK", "TRYLOCK", -/* 15 */ "FILE_ALLOCATE", "DONT_BLOCK", "DIRECT", "INVALID18", "LOCKABLE", -/* 20 */ "PRIVATE_BH", "ALL_PAGES_MAPPED", "ADDR_ALLOCATED", "MEM_ALLOCATED", - "FORCEIO", -/* 25 */ "FLUSH", "READ_AHEAD", "INVALID27", "INVALID28", "INVALID29", -/* 30 */ "INVALID30", "INVALID31", +/* 15 */ "DONT_BLOCK", "LOCKABLE", "PRIVATE_BH", "ALL_PAGES_MAPPED", + "ADDR_ALLOCATED", +/* 20 */ "MEM_ALLOCATED", "FORCEIO", "FLUSH", "READ_AHEAD", NULL }; static char *pbm_flag_vals[] = { @@ -1756,7 +1794,7 @@ static char *map_flags(unsigned long flags, char *mapping[]) for (index = 0; flags && mapping[index]; flags >>= 1, index++) { if (flags & 1) { if ((offset + strlen(mapping[index]) + 1) >= 80) { - strcat(buffer, "\n "); + strcat(buffer, "\n "); offset = 12; } else if (offset > 12) { strcat(buffer, " "); @@ -1865,9 +1903,9 @@ typedef struct { /* 0x20 */ struct iovec **io_iovec; /* iovec list indexed by iovec_index */ - loff_t io_iovec_offset; /* offset into current iovec. */ + loff_t io_iovec_offset; /* offset into current iovec. */ int io_iovec_index; /* current iovec being processed */ - unsigned int io_sshift; /* sector bit shift */ + unsigned int io_sshift; /* sector bit shift */ loff_t io_i_size; /* size of the file */ } pb_io_desc_t; @@ -1910,7 +1948,7 @@ static int kdbm_pbmap(int argc, const char **argv, const char **envp, struct pt_regs *regs) { - page_buf_bmap_t pbm; + page_buf_bmap_t pbm; unsigned long addr; long offset=0; int nextarg; @@ -1943,7 +1981,7 @@ kdbm_pbmap(int argc, const char **argv, const char **envp, # endif #include "pagebuf/page_buf_trace.h" -#define EV_SIZE (sizeof(event_names)/sizeof(char *)) +#define EV_SIZE (sizeof(event_names)/sizeof(char *)) void pb_trace_core( @@ -1954,7 +1992,7 @@ pb_trace_core( { extern struct pagebuf_trace_buf pb_trace; int i, total, end; - pagebuf_trace_t *trace; + pagebuf_trace_t *trace; char *event; char value[10]; @@ -2013,9 +2051,9 @@ pb_trace_core( trace->misc); kdb_symbol_print((unsigned int)trace->ra, NULL, KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE); - kdb_printf(" offset 0x%Lx size 0x%x task 0x%p\n", + kdb_printf(" offset 0x%Lx size 0x%x task 0x%p\n", trace->offset, trace->size, trace->task); - kdb_printf(" flags: %s\n", + kdb_printf(" flags: %s\n", pb_flags(trace->flags)); } } @@ -2101,7 +2139,7 @@ static struct xif { { "vn", kdbm_vn, "<vnode>", "Dump inode/vnode/trace"}, { "vnode", kdbm_vnode, "<vnode>", "Dump vnode"}, #ifdef CONFIG_XFS_VNODE_TRACING - { "vntrace", kdbm_vntrace, "<vntrace>", "Dump vnode Trace"}, + { "vntrace", kdbm_vntrace, "<vntrace>", "Dump vnode Trace"}, { "vntraceaddr", kdbm_vntraceaddr, "<vntrace>", "Dump vnode Trace by Address"}, #endif /* CONFIG_XFS_VNODE_TRACING */ { "xagf", kdbm_xfs_xagf, "<agf>", @@ -2116,21 +2154,21 @@ static struct xif { { "xalmtrc", kdbm_xfs_xalmtrace, "<xfs_mount_t>", "Dump XFS alloc mount-point trace" }, #endif - { "xattrcx", kdbm_xfs_xattrcontext, "<xfs_attr_list_context_t>", + { "xattrcx", kdbm_xfs_xattrcontext, "<xfs_attr_list_context_t>", "Dump XFS attr_list context struct"}, - { "xattrlf", kdbm_xfs_xattrleaf, "<xfs_attr_leafblock_t>", + { "xattrlf", kdbm_xfs_xattrleaf, "<xfs_attr_leafblock_t>", "Dump XFS attribute leaf block"}, - { "xattrsf", kdbm_xfs_xattrsf, "<xfs_attr_shortform_t>", + { "xattrsf", kdbm_xfs_xattrsf, "<xfs_attr_shortform_t>", "Dump XFS attribute shortform"}, { "xbirec", kdbm_xfs_xbirec, "<xfs_bmbt_irec_t", "Dump XFS bmap incore record"}, - { "xbmalla", kdbm_xfs_xbmalla, "<xfs_bmalloca_t>", + { "xbmalla", kdbm_xfs_xbmalla, "<xfs_bmalloca_t>", "Dump XFS bmalloc args structure"}, { "xbrec", kdbm_xfs_xbrec, "<xfs_bmbt_rec_64_t", "Dump XFS bmap record"}, { "xbroot", kdbm_xfs_xbroot, "<xfs_inode_t>", "Dump XFS bmap btree root (data)"}, - { "xbroota", kdbm_xfs_xbroota, "<xfs_inode_t>", + { "xbroota", kdbm_xfs_xbroota, "<xfs_inode_t>", "Dump XFS bmap btree root (attr)"}, { "xbtcur", kdbm_xfs_xbtcur, "<xfs_btree_cur_t>", "Dump XFS btree cursor"}, @@ -2138,17 +2176,17 @@ static struct xif { "Dump XFS data from a buffer"}, { "xchash", kdbm_xfs_xchash, "<xfs_mount_t>", "Dump XFS cluster hash"}, - { "xchlist", kdbm_xfs_xchashlist, "<xfs_chashlist_t>", + { "xchlist", kdbm_xfs_xchashlist, "<xfs_chashlist_t>", "Dump XFS cluster hash list"}, - { "xd2free", kdbm_xfs_xdir2free, "<xfs_dir2_free_t>", + { "xd2free", kdbm_xfs_xdir2free, "<xfs_dir2_free_t>", "Dump XFS directory v2 freemap"}, - { "xdaargs", kdbm_xfs_xdaargs, "<xfs_da_args_t>", + { "xdaargs", kdbm_xfs_xdaargs, "<xfs_da_args_t>", "Dump XFS dir/attr args structure"}, { "xdabuf", kdbm_xfs_xdabuf, "<xfs_dabuf_t>", "Dump XFS dir/attr buf structure"}, - { "xdanode", kdbm_xfs_xdanode, "<xfs_da_intnode_t>", + { "xdanode", kdbm_xfs_xdanode, "<xfs_da_intnode_t>", "Dump XFS dir/attr node block"}, - { "xdastat", kdbm_xfs_xdastate, "<xfs_da_state_t>", + { "xdastat", kdbm_xfs_xdastate, "<xfs_da_state_t>", "Dump XFS dir/attr state_blk struct"}, { "xdelay", kdbm_xfs_delayed_blocks, "<xfs_mount_t>", "Dump delayed block totals"}, @@ -2156,17 +2194,17 @@ static struct xif { "Dump XFS directory leaf block"}, { "xdirsf", kdbm_xfs_xdirsf, "<xfs_dir_shortform_t>", "Dump XFS directory shortform"}, - { "xdir2sf", kdbm_xfs_xdir2sf, "<xfs_dir2_sf_t>", + { "xdir2sf", kdbm_xfs_xdir2sf, "<xfs_dir2_sf_t>", "Dump XFS directory v2 shortform"}, - { "xdiskdq", kdbm_xfs_xqm_diskdq, "<xfs_disk_dquot_t>", + { "xdiskdq", kdbm_xfs_xqm_diskdq, "<xfs_disk_dquot_t>", "Dump XFS ondisk dquot (quota) struct"}, { "xdqatt", kdbm_xfs_xqm_dqattached_inos, "<xfs_mount_t>", "All incore inodes with dquots"}, - { "xdqinfo", kdbm_xfs_xqm_tpdqinfo, "<xfs_trans_t>", + { "xdqinfo", kdbm_xfs_xqm_tpdqinfo, "<xfs_trans_t>", "Dump dqinfo structure of a trans"}, { "xdquot", kdbm_xfs_xqm_dquot, "<xfs_dquot_t>", "Dump XFS dquot (quota) structure"}, - { "xexlist", kdbm_xfs_xexlist, "<xfs_inode_t>", + { "xexlist", kdbm_xfs_xexlist, "<xfs_inode_t>", "Dump XFS bmap extents in inode"}, { "xflist", kdbm_xfs_xflist, "<xfs_bmap_free_t>", "Dump XFS to-be-freed extent list"}, @@ -2178,13 +2216,13 @@ static struct xif { "Dump XFS in-core log"}, { "xihash", kdbm_xfs_xihash, "<xfs_mount_t>", "Dump XFS inode hash statistics"}, - { "xinodes", kdbm_xfs_xinodes, "<xfs_mount_t>", + { "xinodes", kdbm_xfs_xinodes, "<xfs_mount_t>", "Dump XFS inodes per mount"}, { "xquiesce",kdbm_xfs_xinodes_quiesce, "<xfs_mount_t>", "Dump non-quiesced XFS inodes per mount"}, - { "xl_rcit", kdbm_xfs_xlog_ritem, "<xlog_recover_item_t>", + { "xl_rcit", kdbm_xfs_xlog_ritem, "<xlog_recover_item_t>", "Dump XFS recovery item"}, - { "xl_rctr", kdbm_xfs_xlog_rtrans, "<xlog_recover_t>", + { "xl_rctr", kdbm_xfs_xlog_rtrans, "<xlog_recover_t>", "Dump XFS recovery transaction"}, { "xl_rctr2",kdbm_xfs_xlog_rtrans_entire, "<xlog_recover_t>", "Dump entire recovery transaction"}, @@ -2194,24 +2232,24 @@ static struct xif { "Dump XFS log"}, { "xlogcb", kdbm_xfs_xiclogcb, "<xlog_in_core_t>", "Dump XFS in-core log callbacks"}, - { "xlogitm", kdbm_xfs_xlogitem, "<xfs_log_item_t>", + { "xlogitm", kdbm_xfs_xlogitem, "<xfs_log_item_t>", "Dump XFS log item structure"}, { "xmount", kdbm_xfs_xmount, "<xfs_mount_t>", "Dump XFS mount structure"}, { "xnode", kdbm_xfs_xnode, "<xfs_inode_t>", "Dump XFS inode"}, - { "xiocore", kdbm_xfs_xcore, "<xfs_iocore_t>", + { "xiocore", kdbm_xfs_xcore, "<xfs_iocore_t>", "Dump XFS iocore"}, { "xperag", kdbm_xfs_xperag, "<xfs_mount_t>", "Dump XFS per-allocation group data"}, - { "xqinfo", kdbm_xfs_xqm_qinfo, "<xfs_mount_t>", + { "xqinfo", kdbm_xfs_xqm_qinfo, "<xfs_mount_t>", "Dump mount->m_quotainfo structure"}, #ifdef CONFIG_XFS_QUOTA { "xqm", kdbm_xfs_xqm, "", "Dump XFS quota manager structure"}, - { "xqmfree", kdbm_xfs_xqm_freelist, "", + { "xqmfree", kdbm_xfs_xqm_freelist, "", "Dump XFS global freelist of dquots"}, - { "xqmhtab", kdbm_xfs_xqm_htab, "", + { "xqmhtab", kdbm_xfs_xqm_htab, "", "Dump XFS hashtable of dquots"}, #endif /* CONFIG_XFS_QUOTA */ { "xqmplist",kdbm_xfs_xqm_mplist, "<xfs_mount_t>", @@ -2319,7 +2357,7 @@ static void xfs_xnode_fork(char *name, xfs_ifork_t *f); */ static int xfs_alloc_trace_entry(ktrace_entry_t *ktep) -{ +{ static char *modagf_flags[] = { "magicnum", "versionnum", @@ -2348,10 +2386,10 @@ xfs_alloc_trace_entry(ktrace_entry_t *ktep) "agno %d agbno %d minlen %d maxlen %d mod %d prod %d minleft %d\n", (__psunsigned_t)ktep->val[4], (__psunsigned_t)ktep->val[5], - (__psunsigned_t)ktep->val[6], - (__psunsigned_t)ktep->val[7], + (__psunsigned_t)ktep->val[6], + (__psunsigned_t)ktep->val[7], (__psunsigned_t)ktep->val[8], - (__psunsigned_t)ktep->val[9], + (__psunsigned_t)ktep->val[9], (__psunsigned_t)ktep->val[10]); kdb_printf("total %d alignment %d len %d type %s otype %s\n", (__psunsigned_t)ktep->val[11], @@ -2535,7 +2573,7 @@ xfs_btbmap(xfs_bmbt_block_t *bt, int bsz) xfs_bmbt_disk_get_all((xfs_bmbt_rec_t *)r, &irec); kdb_printf("rec %d startoff %Ld startblock %Lx blockcount %Ld flag %d\n", i, irec.br_startoff, - (__uint64_t)irec.br_startblock, + (__uint64_t)irec.br_startblock, irec.br_blockcount, irec.br_state); } } else { @@ -2616,7 +2654,7 @@ xfs_buf_item_print(xfs_buf_log_item_t *blip, int summary) kdb_printf("buf 0x%p blkno 0x%Lx ", blip->bli_buf, blip->bli_format.blf_blkno); printflags(blip->bli_flags, bli_flags, "flags:"); - kdb_printf("\n "); + kdb_printf("\n "); xfsidbg_xbuf_real(blip->bli_buf, 1); return; } @@ -2685,7 +2723,7 @@ xfs_efd_item_print(xfs_efd_log_item_t *efdp, int summary) kdb_printf("efd extents:\n"); ep = &(efdp->efd_format.efd_extents[0]); for (i = 0; i < efdp->efd_next_extent; i++, ep++) { - kdb_printf(" block %Lx len %d\n", + kdb_printf(" block %Lx len %d\n", ep->ext_start, ep->ext_len); } } @@ -2720,7 +2758,7 @@ xfs_efi_item_print(xfs_efi_log_item_t *efip, int summary) kdb_printf("efi extents:\n"); ep = &(efip->efi_format.efi_extents[0]); for (i = 0; i < efip->efi_next_extent; i++, ep++) { - kdb_printf(" block %Lx len %d\n", + kdb_printf(" block %Lx len %d\n", ep->ext_start, ep->ext_len); } } @@ -2843,9 +2881,9 @@ static char * xfs_fmtuuid(uuid_t *uu) { static char rval[40]; - char *o = rval; - char *i = (unsigned char*)uu; - int b; + char *o = rval; + char *i = (unsigned char*)uu; + int b; for (b=0;b<16;b++) { o+=sprintf(o, "%02x", *i++); @@ -3271,7 +3309,7 @@ xfsidbg_xattrleaf(xfs_attr_leafblock_t *leaf) k = ~(XFS_ATTR_LOCAL | XFS_ATTR_ROOT | XFS_ATTR_INCOMPLETE); if ((e->flags & k) != 0) kdb_printf("0x%x", e->flags & k); - kdb_printf(">\n name \""); + kdb_printf(">\n name \""); if (e->flags & XFS_ATTR_LOCAL) { l = XFS_ATTR_LEAF_NAME_LOCAL(leaf, j); for (k = 0; k < l->namelen; k++) @@ -3367,7 +3405,7 @@ xfsidbg_xbrec(xfs_bmbt_rec_64_t *r) xfs_bmbt_get_all((xfs_bmbt_rec_t *)r, &irec); kdb_printf("startoff %Ld startblock %Lx blockcount %Ld flag %d\n", - irec.br_startoff, (__uint64_t)irec.br_startblock, + irec.br_startoff, (__uint64_t)irec.br_startblock, irec.br_blockcount, irec.br_state); } @@ -3574,7 +3612,7 @@ xfsidbg_xbuf_real(xfs_buf_t *bp, int summary) xfsidbg_xsb(sb, 1); } } else if ((dqb = d)->d_magic == XFS_DQUOT_MAGIC) { -#define XFSIDBG_DQTYPESTR(d) \ +#define XFSIDBG_DQTYPESTR(d) \ ((INT_GET((d)->d_flags, ARCH_CONVERT) & XFS_DQ_USER) ? "USR" : \ ((INT_GET((d)->d_flags, ARCH_CONVERT) & XFS_DQ_GROUP) ? "GRP" : "???")) kdb_printf("Quota blk starting ID [%d], type %s at 0x%p\n", @@ -4027,7 +4065,7 @@ xfsidbg_xiclog(xlog_in_core_t *iclog) kdb_printf("xlog_in_core/header at 0x%p/0x%p\n", iclog, iclog->hic_data); - kdb_printf("magicno: %x cycle: %d version: %d lsn: 0x%Lx\n", + kdb_printf("magicno: %x cycle: %d version: %d lsn: 0x%Lx\n", INT_GET(iclog->ic_header.h_magicno, ARCH_CONVERT), INT_GET(iclog->ic_header.h_cycle, ARCH_CONVERT), INT_GET(iclog->ic_header.h_version, ARCH_CONVERT), INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT)); kdb_printf("tail_lsn: 0x%Lx len: %d prev_block: %d num_ops: %d\n", @@ -4035,13 +4073,13 @@ xfsidbg_xiclog(xlog_in_core_t *iclog) INT_GET(iclog->ic_header.h_prev_block, ARCH_CONVERT), INT_GET(iclog->ic_header.h_num_logops, ARCH_CONVERT)); kdb_printf("cycle_data: "); for (i=0; i<(iclog->ic_size>>BBSHIFT); i++) { - kdb_printf("%x ", INT_GET(iclog->ic_header.h_cycle_data[i], ARCH_CONVERT)); + kdb_printf("%x ", INT_GET(iclog->ic_header.h_cycle_data[i], ARCH_CONVERT)); } kdb_printf("\n"); kdb_printf("size: %d\n", INT_GET(iclog->ic_header.h_size, ARCH_CONVERT)); kdb_printf("\n"); kdb_printf("--------------------------------------------------\n"); - kdb_printf("data: 0x%p &forcesema: 0x%p next: 0x%p bp: 0x%p\n", + kdb_printf("data: 0x%p &forcesema: 0x%p next: 0x%p bp: 0x%p\n", iclog->ic_datap, &iclog->ic_forcesema, iclog->ic_next, iclog->ic_bp); kdb_printf("log: 0x%p callb: 0x%p callb_tail: 0x%p roundoff: %d\n", @@ -4217,7 +4255,7 @@ xfsidbg_xlog(xlog_t *log) kdb_printf("&icloglock: 0x%p tail_lsn: %s last_sync_lsn: %s \n", &log->l_icloglock, xfs_fmtlsn(&log->l_tail_lsn), xfs_fmtlsn(&log->l_last_sync_lsn)); - kdb_printf("mp: 0x%p xbuf: 0x%p roundoff: %d l_covered_state: %s \n", + kdb_printf("mp: 0x%p xbuf: 0x%p roundoff: %d l_covered_state: %s \n", log->l_mp, log->l_xbuf, log->l_roundoff, xfsidbg_get_cstate(log->l_covered_state)); kdb_printf("flags: "); @@ -4235,7 +4273,7 @@ xfsidbg_xlog(xlog_t *log) log->l_iclog_hsize, log->l_iclog_heads); kdb_printf("&grant_lock: 0x%p resHeadQ: 0x%p wrHeadQ: 0x%p\n", &log->l_grant_lock, log->l_reserve_headq, log->l_write_headq); - kdb_printf("GResCycle: %d GResBytes: %d GWrCycle: %d GWrBytes: %d\n", + kdb_printf("GResCycle: %d GResBytes: %d GWrCycle: %d GWrBytes: %d\n", log->l_grant_reserve_cycle, log->l_grant_reserve_bytes, log->l_grant_write_cycle, log->l_grant_write_bytes); rbytes = log->l_grant_reserve_bytes + log->l_roundoff; @@ -4397,9 +4435,9 @@ xfsidbg_xlog_tic(xlog_ticket_t *tic) }; kdb_printf("xlog_ticket at 0x%p\n", tic); - kdb_printf("next: 0x%p prev: 0x%p tid: 0x%x \n", + kdb_printf("next: 0x%p prev: 0x%p tid: 0x%x \n", tic->t_next, tic->t_prev, tic->t_tid); - kdb_printf("curr_res: %d unit_res: %d ocnt: %d cnt: %d\n", + kdb_printf("curr_res: %d unit_res: %d ocnt: %d cnt: %d\n", tic->t_curr_res, tic->t_unit_res, (int)tic->t_ocnt, (int)tic->t_cnt); kdb_printf("clientid: %c \n", tic->t_clientid); @@ -4497,7 +4535,7 @@ xfsidbg_xaildump(xfs_mount_t *mp) "6-1-buf", /* 7 */ "inode", /* 8 */ "buf", /* 9 */ - "dquot", /* 10 */ + "dquot", /* 10 */ 0 }; static char *li_flags[] = { @@ -4517,7 +4555,7 @@ xfsidbg_xaildump(xfs_mount_t *mp) kdb_printf("[%d] type %s ", count, lid_type[lip->li_type - XFS_LI_5_3_BUF + 1]); printflags((uint)(lip->li_flags), li_flags, "flags:"); - kdb_printf(" lsn %s\n ", xfs_fmtlsn(&(lip->li_lsn))); + kdb_printf(" lsn %s\n ", xfs_fmtlsn(&(lip->li_lsn))); switch (lip->li_type) { case XFS_LI_BUF: xfs_buf_item_print((xfs_buf_log_item_t *)lip, 1); @@ -4559,7 +4597,7 @@ xfsidbg_xmount(xfs_mount_t *mp) static char *xmount_flags[] = { "WSYNC", /* 0x0001 */ "INO64", /* 0x0002 */ - "RQCHK", /* 0x0004 */ + "RQCHK", /* 0x0004 */ "FSCLEAN", /* 0x0008 */ "FSSHUTDN", /* 0x0010 */ "NOATIME", /* 0x0020 */ @@ -4812,7 +4850,7 @@ xfsidbg_xnode(xfs_inode_t *ip) static void xfsidbg_xcore(xfs_iocore_t *io) { - kdb_printf("io_obj 0x%p io_flags 0x%x io_mount 0x%p\n", + kdb_printf("io_obj 0x%p io_flags 0x%x io_mount 0x%p\n", io->io_obj, io->io_flags, io->io_mount); kdb_printf("new_size %Lx\n", io->io_new_size); } @@ -4889,7 +4927,7 @@ xfsidbg_xperag(xfs_mount_t *mp) pag->pagf_flcount, pag->pagf_freeblks, pag->pagf_longest, pag->pagf_metadata); if (pag->pagi_init) - kdb_printf(" i_freecount %d i_inodeok %d\n", + kdb_printf(" i_freecount %d i_inodeok %d\n", pag->pagi_freecount, pag->pagi_inodeok); if (pag->pagf_init) { for (busy = 0; busy < XFS_PAGB_NUM_SLOTS; busy++) { @@ -4979,7 +5017,7 @@ xfsidbg_xqm_dquot(xfs_dquot_t *dqp) printflags(dqp->dq_flags, qflags, "flags:"); kdb_printf("\nblkno 0x%llx\tboffset 0x%x\n", (unsigned long long) dqp->q_blkno, (int) dqp->q_bufoffset); - kdb_printf("qlock 0x%p flock 0x%p (%s) pincount 0x%x\n", + kdb_printf("qlock 0x%p flock 0x%p (%s) pincount 0x%x\n", &dqp->q_qlock, &dqp->q_flock, (valusema(&dqp->q_flock) <= 0) ? "LCK" : "UNLKD", @@ -4999,7 +5037,7 @@ xfsidbg_xqm_dquot(xfs_dquot_t *dqp) kdb_printf( \ "\t%d. [0x%p] \"%d (%s)\"\t blks = %d, inos = %d refs = %d\n", \ ++i, dqp, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ - DQFLAGTO_TYPESTR(dqp), \ + DQFLAGTO_TYPESTR(dqp), \ (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ (int) dqp->q_nrefs); }\ @@ -5007,7 +5045,7 @@ xfsidbg_xqm_dquot(xfs_dquot_t *dqp) } static void -xfsidbg_xqm_dqattached_inos(xfs_mount_t *mp) +xfsidbg_xqm_dqattached_inos(xfs_mount_t *mp) { xfs_inode_t *ip; int n = 0; @@ -5235,9 +5273,9 @@ xfsidbg_xtp(xfs_trans_t *tp) static char *xtp_flags[] = { "dirty", /* 0x1 */ "sb_dirty", /* 0x2 */ - "perm_log_res", /* 0x4 */ - "sync", /* 0x08 */ - "dq_dirty", /* 0x10 */ + "perm_log_res", /* 0x4 */ + "sync", /* 0x08 */ + "dq_dirty", /* 0x10 */ 0 }; static char *lid_flags[] = { @@ -5281,14 +5319,14 @@ xfsidbg_xtp(xfs_trans_t *tp) case XFS_TRANS_QM_SETQLIM: kdb_printf("QM_SETQLIM"); break; case XFS_TRANS_QM_DQCLUSTER: kdb_printf("QM_DQCLUSTER"); break; case XFS_TRANS_QM_QINOCREATE: kdb_printf("QM_QINOCREATE"); break; - case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break; + case XFS_TRANS_QM_QUOTAOFF_END: kdb_printf("QM_QOFF_END"); break; case XFS_TRANS_SB_UNIT: kdb_printf("SB_UNIT"); break; case XFS_TRANS_FSYNC_TS: kdb_printf("FSYNC_TS"); break; case XFS_TRANS_GROWFSRT_ALLOC: kdb_printf("GROWFSRT_ALLOC"); break; case XFS_TRANS_GROWFSRT_ZERO: kdb_printf("GROWFSRT_ZERO"); break; case XFS_TRANS_GROWFSRT_FREE: kdb_printf("GROWFSRT_FREE"); break; - default: kdb_printf("0x%x", tp->t_type); break; + default: kdb_printf("0x%x", tp->t_type); break; } kdb_printf(" mount 0x%p\n", tp->t_mountp); kdb_printf("flags "); |
