Commit b60aa701 authored by Christoph Hellwig's avatar Christoph Hellwig

Merge

parents d9cfe75a 81d3a621
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# Further, this software is distributed without any warranty that it is # Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement # 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 # otherwise, applies only to this software file. Patent licenses, if
# any, provided herein do not apply to combinations of this program with # any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever. # other software, or any other product whatsoever.
......
...@@ -30,7 +30,27 @@ ...@@ -30,7 +30,27 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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> #include <linux/mpage.h>
STATIC void convert_page(struct inode *, struct page *, STATIC void convert_page(struct inode *, struct page *,
...@@ -50,8 +70,6 @@ linvfs_unwritten_done( ...@@ -50,8 +70,6 @@ linvfs_unwritten_done(
pagebuf_ioerror(pb, -EIO); pagebuf_ioerror(pb, -EIO);
if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
pagebuf_iodone(pb, 1, 1); pagebuf_iodone(pb, 1, 1);
pb->pb_flags &= ~_PBF_LOCKABLE;
pagebuf_rele(pb);
} }
end_buffer_async_write(bh, uptodate); end_buffer_async_write(bh, uptodate);
} }
...@@ -61,28 +79,21 @@ linvfs_unwritten_done( ...@@ -61,28 +79,21 @@ linvfs_unwritten_done(
* to written extents. * to written extents.
*/ */
STATIC void STATIC void
xfs_unwritten_conv( linvfs_unwritten_conv(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
bhv_desc_t *bdp = XFS_BUF_FSPRIVATE(bp, bhv_desc_t *); vnode_t *vp = XFS_BUF_FSPRIVATE(bp, vnode_t *);
xfs_mount_t *mp; int error;
xfs_inode_t *ip;
ip = XFS_BHVTOI(bdp); if (atomic_read(&bp->pb_hold) < 1)
mp = ip->i_mount; BUG();
if (XFS_TEST_ERROR(XFS_BUF_GETERROR(bp), mp, VOP_BMAP(vp, XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp),
XFS_ERRTAG_STRATCMPL_IOERR, BMAP_UNWRITTEN, NULL, NULL, error);
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));
XFS_BUF_SET_FSPRIVATE(bp, NULL); XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp); XFS_BUF_CLR_IODONE_FUNC(bp);
XFS_BUF_UNDATAIO(bp); XFS_BUF_UNDATAIO(bp);
xfs_biodone(bp); pagebuf_iodone(bp, 0, 0);
} }
STATIC int STATIC int
...@@ -96,20 +107,20 @@ map_blocks( ...@@ -96,20 +107,20 @@ map_blocks(
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
int error, nmaps = 1; int error, nmaps = 1;
if (((flags & (PBF_DIRECT|PBF_SYNC)) == PBF_DIRECT) && if (((flags & (BMAP_DIRECT|BMAP_SYNC)) == BMAP_DIRECT) &&
(offset >= inode->i_size)) (offset >= inode->i_size))
count = max_t(ssize_t, count, XFS_WRITE_IO_LOG); count = max_t(ssize_t, count, XFS_WRITE_IO_LOG);
retry: retry:
VOP_BMAP(vp, offset, count, flags, pbmapp, &nmaps, error); VOP_BMAP(vp, offset, count, flags, pbmapp, &nmaps, error);
if (error == EAGAIN) if ((error == EAGAIN) || (error == EIO))
return -error; return -error;
if (unlikely((flags & (PBF_WRITE|PBF_DIRECT)) == if (unlikely((flags & (BMAP_WRITE|BMAP_DIRECT)) ==
(PBF_WRITE|PBF_DIRECT) && nmaps && (BMAP_WRITE|BMAP_DIRECT) && nmaps &&
(pbmapp->pbm_flags & PBMF_DELAY))) { (pbmapp->pbm_flags & PBMF_DELAY))) {
flags = PBF_FILE_ALLOCATE; flags = BMAP_ALLOCATE;
goto retry; goto retry;
} }
if (flags & (PBF_WRITE|PBF_FILE_ALLOCATE)) { if (flags & (BMAP_WRITE|BMAP_ALLOCATE)) {
VMODIFY(vp); VMODIFY(vp);
} }
return -error; return -error;
...@@ -371,7 +382,7 @@ map_unwritten( ...@@ -371,7 +382,7 @@ map_unwritten(
offset += p_offset; offset += p_offset;
pb = pagebuf_lookup(mp->pbm_target, pb = pagebuf_lookup(mp->pbm_target,
mp->pbm_offset, mp->pbm_bsize, _PBF_LOCKABLE); mp->pbm_offset, mp->pbm_bsize, 0);
if (!pb) if (!pb)
return -ENOMEM; return -ENOMEM;
...@@ -390,7 +401,6 @@ map_unwritten( ...@@ -390,7 +401,6 @@ map_unwritten(
tmp = match_offset_to_mapping(start_page, mp, p_offset); tmp = match_offset_to_mapping(start_page, mp, p_offset);
if (!tmp) if (!tmp)
break; break;
BUG_ON(!(tmp->pbm_flags & PBMF_UNWRITTEN));
map_buffer_at_offset(start_page, bh, p_offset, block_bits, mp); map_buffer_at_offset(start_page, bh, p_offset, block_bits, mp);
set_buffer_unwritten_io(bh); set_buffer_unwritten_io(bh);
bh->b_private = pb; bh->b_private = pb;
...@@ -398,6 +408,12 @@ map_unwritten( ...@@ -398,6 +408,12 @@ map_unwritten(
nblocks++; nblocks++;
} while ((bh = bh->b_this_page) != head); } 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); atomic_add(nblocks, &pb->pb_io_remaining);
/* If we reached the end of the page, map forwards in any /* If we reached the end of the page, map forwards in any
...@@ -436,15 +452,14 @@ map_unwritten( ...@@ -436,15 +452,14 @@ map_unwritten(
size <<= block_bits; /* convert fsb's to byte range */ size <<= block_bits; /* convert fsb's to byte range */
XFS_BUF_DATAIO(pb); XFS_BUF_DATAIO(pb);
XFS_BUF_ASYNC(pb);
XFS_BUF_SET_SIZE(pb, size); XFS_BUF_SET_SIZE(pb, size);
XFS_BUF_SET_OFFSET(pb, offset); XFS_BUF_SET_OFFSET(pb, offset);
XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode)->v_fbhv); XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
XFS_BUF_SET_IODONE_FUNC(pb, xfs_unwritten_conv); XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_conv);
if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
pagebuf_iodone(pb, 1, 1); pagebuf_iodone(pb, 1, 1);
pb->pb_flags &= ~_PBF_LOCKABLE;
pagebuf_rele(pb);
} }
return 0; return 0;
...@@ -546,6 +561,7 @@ convert_page( ...@@ -546,6 +561,7 @@ convert_page(
} else { } else {
set_buffer_dirty(bh); set_buffer_dirty(bh);
unlock_buffer(bh); unlock_buffer(bh);
mark_buffer_dirty(bh);
} }
} while (i++, (bh = bh->b_this_page) != head); } while (i++, (bh = bh->b_this_page) != head);
...@@ -583,7 +599,7 @@ cluster_write( ...@@ -583,7 +599,7 @@ cluster_write(
/* /*
* Calling this without startio set means we are being asked to make a dirty * 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 * 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 * When called with startio set it is important that we write the WHOLE
* page if possible. * page if possible.
...@@ -611,7 +627,7 @@ page_state_convert( ...@@ -611,7 +627,7 @@ page_state_convert(
unsigned long p_offset = 0, end_index; unsigned long p_offset = 0, end_index;
loff_t offset, end_offset; loff_t offset, end_offset;
int len, err, i, cnt = 0, uptodate = 1; int len, err, i, cnt = 0, uptodate = 1;
int flags = startio ? 0 : PBF_TRYLOCK; int flags = startio ? 0 : BMAP_TRYLOCK;
int page_dirty = 1; int page_dirty = 1;
...@@ -649,7 +665,7 @@ page_state_convert( ...@@ -649,7 +665,7 @@ page_state_convert(
if (buffer_unwritten(bh)) { if (buffer_unwritten(bh)) {
if (!mp) { if (!mp) {
err = map_blocks(inode, offset, len, &map, err = map_blocks(inode, offset, len, &map,
PBF_FILE_UNWRITTEN); BMAP_READ|BMAP_IGNSTATE);
if (err) { if (err) {
goto error; goto error;
} }
...@@ -671,6 +687,7 @@ page_state_convert( ...@@ -671,6 +687,7 @@ page_state_convert(
} else { } else {
set_buffer_dirty(bh); set_buffer_dirty(bh);
unlock_buffer(bh); unlock_buffer(bh);
mark_buffer_dirty(bh);
} }
page_dirty = 0; page_dirty = 0;
} }
...@@ -681,7 +698,7 @@ page_state_convert( ...@@ -681,7 +698,7 @@ page_state_convert(
} else if (buffer_delay(bh)) { } else if (buffer_delay(bh)) {
if (!mp) { if (!mp) {
err = map_blocks(inode, offset, len, &map, err = map_blocks(inode, offset, len, &map,
PBF_FILE_ALLOCATE | flags); BMAP_ALLOCATE | flags);
if (err) { if (err) {
goto error; goto error;
} }
...@@ -696,6 +713,7 @@ page_state_convert( ...@@ -696,6 +713,7 @@ page_state_convert(
} else { } else {
set_buffer_dirty(bh); set_buffer_dirty(bh);
unlock_buffer(bh); unlock_buffer(bh);
mark_buffer_dirty(bh);
} }
page_dirty = 0; page_dirty = 0;
} }
...@@ -714,8 +732,8 @@ page_state_convert( ...@@ -714,8 +732,8 @@ page_state_convert(
size = probe_unmapped_cluster( size = probe_unmapped_cluster(
inode, page, bh, head); inode, page, bh, head);
err = map_blocks(inode, offset, err = map_blocks(inode, offset,
size, &map, size, &map,
PBF_WRITE | PBF_DIRECT); BMAP_WRITE | BMAP_MMAP);
if (err) { if (err) {
goto error; goto error;
} }
...@@ -731,6 +749,7 @@ page_state_convert( ...@@ -731,6 +749,7 @@ page_state_convert(
} else { } else {
set_buffer_dirty(bh); set_buffer_dirty(bh);
unlock_buffer(bh); unlock_buffer(bh);
mark_buffer_dirty(bh);
} }
page_dirty = 0; page_dirty = 0;
} }
...@@ -754,13 +773,11 @@ page_state_convert( ...@@ -754,13 +773,11 @@ page_state_convert(
if (uptodate) if (uptodate)
SetPageUptodate(page); SetPageUptodate(page);
if (startio) { if (startio)
submit_page(page, bh_arr, cnt); submit_page(page, bh_arr, cnt);
}
if (mp) { if (mp)
cluster_write(inode, page->index + 1, mp, startio, unmapped); cluster_write(inode, page->index + 1, mp, startio, unmapped);
}
return page_dirty; return page_dirty;
...@@ -791,7 +808,7 @@ linvfs_get_block_core( ...@@ -791,7 +808,7 @@ linvfs_get_block_core(
struct buffer_head *bh_result, struct buffer_head *bh_result,
int create, int create,
int direct, int direct,
page_buf_flags_t flags) bmapi_flags_t flags)
{ {
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
page_buf_bmap_t pbmap; page_buf_bmap_t pbmap;
...@@ -811,7 +828,7 @@ linvfs_get_block_core( ...@@ -811,7 +828,7 @@ linvfs_get_block_core(
size = 1 << inode->i_blkbits; size = 1 << inode->i_blkbits;
VOP_BMAP(vp, offset, size, VOP_BMAP(vp, offset, size,
create ? flags : PBF_READ, &pbmap, &retpbbm, error); create ? flags : BMAP_READ, &pbmap, &retpbbm, error);
if (error) if (error)
return -error; return -error;
...@@ -881,7 +898,7 @@ linvfs_get_block( ...@@ -881,7 +898,7 @@ linvfs_get_block(
int create) int create)
{ {
return linvfs_get_block_core(inode, iblock, 0, bh_result, return linvfs_get_block_core(inode, iblock, 0, bh_result,
create, 0, PBF_WRITE); create, 0, BMAP_WRITE);
} }
STATIC int STATIC int
...@@ -892,7 +909,7 @@ linvfs_get_block_sync( ...@@ -892,7 +909,7 @@ linvfs_get_block_sync(
int create) int create)
{ {
return linvfs_get_block_core(inode, iblock, 0, bh_result, return linvfs_get_block_core(inode, iblock, 0, bh_result,
create, 0, PBF_SYNC|PBF_WRITE); create, 0, BMAP_SYNC|BMAP_WRITE);
} }
STATIC int STATIC int
...@@ -904,7 +921,7 @@ linvfs_get_blocks_direct( ...@@ -904,7 +921,7 @@ linvfs_get_blocks_direct(
int create) int create)
{ {
return linvfs_get_block_core(inode, iblock, max_blocks, bh_result, 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 STATIC int
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
* *
*/ */
#include <xfs.h> #include "xfs.h"
/* /*
* Source file used to associate/disassociate behaviors with virtualized * Source file used to associate/disassociate behaviors with virtualized
...@@ -94,7 +94,7 @@ bhv_insert(bhv_head_t *bhp, bhv_desc_t *bdp) ...@@ -94,7 +94,7 @@ bhv_insert(bhv_head_t *bhp, bhv_desc_t *bdp)
prev->bd_next = bdp; prev->bd_next = bdp;
} }
return 0; return 0;
} }
/* /*
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
* Header file used to associate behaviors with virtualized objects. * Header file used to associate behaviors with virtualized objects.
* *
* A virtualized object is an internal, virtualized representation of * A virtualized object is an internal, virtualized representation of
* OS entities such as persistent files, processes, or sockets. Examples * OS entities such as persistent files, processes, or sockets. Examples
* of virtualized objects include vnodes, vprocs, and vsockets. Often * of virtualized objects include vnodes, vprocs, and vsockets. Often
* a virtualized object is referred to simply as an "object." * a virtualized object is referred to simply as an "object."
* *
* A behavior is essentially an implementation layer associated with * A behavior is essentially an implementation layer associated with
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
* active object * active object
* *
*/ */
struct bhv_head_lock; struct bhv_head_lock;
/* /*
...@@ -179,10 +179,10 @@ extern void bhv_insert_initial(bhv_head_t *, bhv_desc_t *); ...@@ -179,10 +179,10 @@ extern void bhv_insert_initial(bhv_head_t *, bhv_desc_t *);
if ((bhp)->bh_first == (bdp)) { \ if ((bhp)->bh_first == (bdp)) { \
/* \ /* \
* Remove from front of chain. \ * Remove from front of chain. \
* Atomic wrt oip's. \ * Atomic wrt oip's. \
*/ \ */ \
(bhp)->bh_first = (bdp)->bd_next; \ (bhp)->bh_first = (bdp)->bd_next; \
} else { \ } else { \
/* remove from non-front of chain */ \ /* remove from non-front of chain */ \
bhv_remove_not_first(bhp, bdp); \ bhv_remove_not_first(bhp, bdp); \
} \ } \
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -47,4 +47,4 @@ static __inline int capable_cred(cred_t *cr, int cid) ...@@ -47,4 +47,4 @@ static __inline int capable_cred(cred_t *cr, int cid)
return (cr == sys_cred) ? 1 : capable(cid); return (cr == sys_cred) ? 1 : capable(cid);
} }
#endif /* __XFS_CRED_H__ */ #endif /* __XFS_CRED_H__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,28 @@ ...@@ -30,7 +30,28 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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/dcache.h>
#include <linux/mman.h> /* for PROT_WRITE */ #include <linux/mman.h> /* for PROT_WRITE */
...@@ -209,7 +230,7 @@ linvfs_fsync( ...@@ -209,7 +230,7 @@ linvfs_fsync(
* We need to build a uio, cred, ... * 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 STATIC int
linvfs_readdir( linvfs_readdir(
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
/* /*
* Stub for no-op vnode operations that return error status. * Stub for no-op vnode operations that return error status.
...@@ -122,4 +122,3 @@ fs_flush_pages( ...@@ -122,4 +122,3 @@ fs_flush_pages(
return 0; return 0;
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef __XFS_SUBR_H__ #ifndef __XFS_SUBR_H__
#define __XFS_SUBR_H__ #define __XFS_SUBR_H__
/* /*
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
* somewhere else in IRIX. * 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. * System memory size - used to scale certain data structures in XFS.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* somewhere else in IRIX. * 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 unsigned long xfs_physmem;
extern struct cred *sys_cred; extern struct cred *sys_cred;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,9 +30,43 @@ ...@@ -30,9 +30,43 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
#include <xfs_fsops.h>
#include <xfs_dfrag.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/dcache.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/namei.h> #include <linux/namei.h>
...@@ -168,7 +202,7 @@ xfs_find_handle( ...@@ -168,7 +202,7 @@ xfs_find_handle(
STATIC int STATIC int
xfs_vget_fsop_handlereq( xfs_vget_fsop_handlereq(
xfs_mount_t *mp, xfs_mount_t *mp,
struct inode *parinode, /* parent inode pointer */ struct inode *parinode, /* parent inode pointer */
int cap, /* capability level for op */ int cap, /* capability level for op */
unsigned long arg, /* userspace data pointer */ unsigned long arg, /* userspace data pointer */
unsigned long size, /* size of expected struct */ unsigned long size, /* size of expected struct */
...@@ -362,10 +396,10 @@ xfs_readlink_by_handle( ...@@ -362,10 +396,10 @@ xfs_readlink_by_handle(
aiov.iov_base = hreq.ohandle; aiov.iov_base = hreq.ohandle;
auio.uio_iov = &aiov; auio.uio_iov = &aiov;
auio.uio_iovcnt = 1; auio.uio_iovcnt = 1;
auio.uio_fmode = FINVIS; auio.uio_fmode = FINVIS;
auio.uio_offset = 0; auio.uio_offset = 0;
auio.uio_segflg = UIO_USERSPACE; auio.uio_segflg = UIO_USERSPACE;
auio.uio_resid = olen; auio.uio_resid = olen;
VOP_READLINK(vp, &auio, NULL, error); VOP_READLINK(vp, &auio, NULL, error);
...@@ -578,7 +612,7 @@ xfs_ioctl( ...@@ -578,7 +612,7 @@ xfs_ioctl(
case XFS_IOC_FREESP64: case XFS_IOC_FREESP64:
case XFS_IOC_RESVSP64: case XFS_IOC_RESVSP64:
case XFS_IOC_UNRESVSP64: case XFS_IOC_UNRESVSP64:
/* /*
* Only allow the sys admin to reserve space unless * Only allow the sys admin to reserve space unless
* unwritten extents are enabled. * unwritten extents are enabled.
*/ */
...@@ -986,7 +1020,7 @@ xfs_ioc_xattr( ...@@ -986,7 +1020,7 @@ xfs_ioc_xattr(
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
return 0; return 0;
} }
default: default:
return -ENOTTY; return -ENOTTY;
......
...@@ -30,7 +30,43 @@ ...@@ -30,7 +30,43 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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) \ #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \
<< mp->m_writeio_log) << mp->m_writeio_log)
...@@ -97,7 +133,7 @@ xfs_iomap( ...@@ -97,7 +133,7 @@ xfs_iomap(
{ {
xfs_mount_t *mp = io->io_mount; xfs_mount_t *mp = io->io_mount;
xfs_fileoff_t offset_fsb, end_fsb; xfs_fileoff_t offset_fsb, end_fsb;
int error; int error = 0;
int lockmode = 0; int lockmode = 0;
xfs_bmbt_irec_t imap; xfs_bmbt_irec_t imap;
int nimaps = 1; int nimaps = 1;
...@@ -107,32 +143,31 @@ xfs_iomap( ...@@ -107,32 +143,31 @@ xfs_iomap(
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
switch (flags & switch (flags &
(PBF_READ|PBF_WRITE|PBF_FILE_ALLOCATE|PBF_FILE_UNWRITTEN)) { (BMAP_READ|BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) {
case PBF_READ: case BMAP_READ:
lockmode = XFS_LCK_MAP_SHARED(mp, io); lockmode = XFS_LCK_MAP_SHARED(mp, io);
bmap_flags = XFS_BMAPI_ENTIRE; bmap_flags = XFS_BMAPI_ENTIRE;
if (flags & BMAP_IGNSTATE)
bmap_flags |= XFS_BMAPI_IGSTATE;
break; break;
case PBF_WRITE: case PBF_WRITE:
lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
bmap_flags = 0; bmap_flags = 0;
XFS_ILOCK(mp, io, lockmode); XFS_ILOCK(mp, io, lockmode);
break; break;
case PBF_FILE_ALLOCATE: case BMAP_ALLOCATE:
lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD; lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD;
bmap_flags = XFS_BMAPI_ENTIRE; bmap_flags = XFS_BMAPI_ENTIRE;
/* Attempt non-blocking lock */ /* Attempt non-blocking lock */
if (flags & PBF_TRYLOCK) { if (flags & BMAP_TRYLOCK) {
if (!XFS_ILOCK_NOWAIT(mp, io, lockmode)) if (!XFS_ILOCK_NOWAIT(mp, io, lockmode))
return XFS_ERROR(EAGAIN); return XFS_ERROR(EAGAIN);
} else { } else {
XFS_ILOCK(mp, io, lockmode); XFS_ILOCK(mp, io, lockmode);
} }
break; break;
case PBF_FILE_UNWRITTEN: case BMAP_UNWRITTEN:
lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; goto phase2;
bmap_flags = XFS_BMAPI_ENTIRE|XFS_BMAPI_IGSTATE;
XFS_ILOCK(mp, io, lockmode);
break;
default: default:
BUG(); BUG();
} }
...@@ -148,13 +183,14 @@ xfs_iomap( ...@@ -148,13 +183,14 @@ xfs_iomap(
if (error) if (error)
goto out; goto out;
switch (flags & (PBF_WRITE|PBF_FILE_ALLOCATE)) { phase2:
case PBF_WRITE: switch (flags & (BMAP_WRITE|BMAP_ALLOCATE|BMAP_UNWRITTEN)) {
case BMAP_WRITE:
/* If we found an extent, return it */ /* If we found an extent, return it */
if (nimaps && (imap.br_startblock != HOLESTARTBLOCK)) if (nimaps && (imap.br_startblock != HOLESTARTBLOCK))
break; break;
if (flags & PBF_DIRECT) { if (flags & (BMAP_DIRECT|BMAP_MMAP)) {
error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset, error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset,
count, flags, &imap, &nimaps, nimaps); count, flags, &imap, &nimaps, nimaps);
} else { } else {
...@@ -162,7 +198,7 @@ xfs_iomap( ...@@ -162,7 +198,7 @@ xfs_iomap(
flags, &imap, &nimaps); flags, &imap, &nimaps);
} }
break; break;
case PBF_FILE_ALLOCATE: case BMAP_ALLOCATE:
/* If we found an extent, return it */ /* If we found an extent, return it */
XFS_IUNLOCK(mp, io, lockmode); XFS_IUNLOCK(mp, io, lockmode);
lockmode = 0; lockmode = 0;
...@@ -172,12 +208,17 @@ xfs_iomap( ...@@ -172,12 +208,17 @@ xfs_iomap(
error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps);
break; break;
case BMAP_UNWRITTEN:
lockmode = 0;
error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count);
nimaps = 0;
break;
} }
if (nimaps) { if (nimaps) {
*npbmaps = _xfs_imap_to_bmap(io, offset, &imap, *npbmaps = _xfs_imap_to_bmap(io, offset, &imap,
pbmapp, nimaps, *npbmaps); pbmapp, nimaps, *npbmaps);
} else { } else if (npbmaps) {
*npbmaps = 0; *npbmaps = 0;
} }
...@@ -203,13 +244,13 @@ xfs_flush_space( ...@@ -203,13 +244,13 @@ xfs_flush_space(
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
*fsynced = 1; *fsynced = 1;
} else { } else {
*ioflags |= PBF_SYNC; *ioflags |= BMAP_SYNC;
*fsynced = 2; *fsynced = 2;
} }
return 0; return 0;
case 1: case 1:
*fsynced = 2; *fsynced = 2;
*ioflags |= PBF_SYNC; *ioflags |= BMAP_SYNC;
return 0; return 0;
case 2: case 2:
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
...@@ -228,7 +269,7 @@ xfs_iomap_write_direct( ...@@ -228,7 +269,7 @@ xfs_iomap_write_direct(
xfs_inode_t *ip, xfs_inode_t *ip,
loff_t offset, loff_t offset,
size_t count, size_t count,
int ioflag, int flags,
xfs_bmbt_irec_t *ret_imap, xfs_bmbt_irec_t *ret_imap,
int *nmaps, int *nmaps,
int found) int found)
...@@ -265,7 +306,7 @@ xfs_iomap_write_direct( ...@@ -265,7 +306,7 @@ xfs_iomap_write_direct(
maps = min(XFS_WRITE_IMAPS, *nmaps); maps = min(XFS_WRITE_IMAPS, *nmaps);
nimaps = maps; nimaps = maps;
isize = ip->i_d.di_size; isize = ip->i_d.di_size;
aeof = (offset + count) > isize; aeof = (offset + count) > isize;
if (io->io_new_size > isize) if (io->io_new_size > isize)
...@@ -342,7 +383,7 @@ xfs_iomap_write_direct( ...@@ -342,7 +383,7 @@ xfs_iomap_write_direct(
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
xfs_trans_ihold(tp, ip); 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; bmapi_flag |= XFS_BMAPI_PREALLOC;
/* /*
...@@ -441,7 +482,7 @@ xfs_iomap_write_delay( ...@@ -441,7 +482,7 @@ xfs_iomap_write_delay(
* We don't bother with this for sync writes, because we need * We don't bother with this for sync writes, because we need
* to minimize the amount we write for good performance. * 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; xfs_off_t aligned_offset;
unsigned int iosize; unsigned int iosize;
xfs_fileoff_t ioalign; xfs_fileoff_t ioalign;
...@@ -628,7 +669,7 @@ xfs_iomap_write_allocate( ...@@ -628,7 +669,7 @@ xfs_iomap_write_allocate(
for (i = 0; i < nimaps; i++) { for (i = 0; i < nimaps; i++) {
if ((map->br_startoff >= imap[i].br_startoff) && if ((map->br_startoff >= imap[i].br_startoff) &&
(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]; *map = imap[i];
*retmap = 1; *retmap = 1;
XFS_STATS_INC(xfsstats.xs_xstrat_quick); XFS_STATS_INC(xfsstats.xs_xstrat_quick);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,42 @@ ...@@ -30,7 +30,42 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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> #include <linux/xattr.h>
...@@ -478,7 +513,7 @@ linvfs_setattr( ...@@ -478,7 +513,7 @@ linvfs_setattr(
VOP_SETATTR(vp, &vattr, flags, NULL, error); VOP_SETATTR(vp, &vattr, flags, NULL, error);
if (error) if (error)
return(-error); /* Positive error up from XFS */ return(-error); /* Positive error up from XFS */
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
error = vmtruncate(inode, attr->ia_size); error = vmtruncate(inode, attr->ia_size);
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -45,12 +45,15 @@ ...@@ -45,12 +45,15 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/vfs.h> #include <linux/vfs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/param.h> #include <asm/param.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/xfs_behavior.h> #include <linux/xfs_behavior.h>
#include <linux/xfs_vfs.h> #include <linux/xfs_vfs.h>
...@@ -98,41 +101,41 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) ...@@ -98,41 +101,41 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
#define dpoff(DD) ((DD) & (NDPP-1)) #define dpoff(DD) ((DD) & (NDPP-1))
#define NBBY 8 /* number of bits per byte */ #define NBBY 8 /* number of bits per byte */
#define NBPC PAGE_SIZE /* Number of bytes per click */ #define NBPC PAGE_SIZE /* Number of bytes per click */
#define BPCSHIFT PAGE_SHIFT /* LOG2(NBPC) if exact */ #define BPCSHIFT PAGE_SHIFT /* LOG2(NBPC) if exact */
/* /*
* Size of block device i/o is parameterized here. * Size of block device i/o is parameterized here.
* Currently the system supports page-sized i/o. * Currently the system supports page-sized i/o.
*/ */
#define BLKDEV_IOSHIFT BPCSHIFT #define BLKDEV_IOSHIFT BPCSHIFT
#define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT) #define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT)
/* number of BB's per block device block */ /* number of BB's per block device block */
#define BLKDEV_BB BTOBB(BLKDEV_IOSIZE) #define BLKDEV_BB BTOBB(BLKDEV_IOSIZE)
/* bytes to clicks */ /* bytes to clicks */
#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT)
#define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) #define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
#define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) #define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT)
#define io_btoc(x) (((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT) #define io_btoc(x) (((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT)
#define io_btoct(x) ((__psunsigned_t)(x)>>IO_BPCSHIFT) #define io_btoct(x) ((__psunsigned_t)(x)>>IO_BPCSHIFT)
/* off_t bytes to clicks */ /* off_t bytes to clicks */
#define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) #define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
#define offtoct(x) ((xfs_off_t)(x)>>BPCSHIFT) #define offtoct(x) ((xfs_off_t)(x)>>BPCSHIFT)
/* clicks to off_t bytes */ /* clicks to off_t bytes */
#define ctooff(x) ((xfs_off_t)(x)<<BPCSHIFT) #define ctooff(x) ((xfs_off_t)(x)<<BPCSHIFT)
/* clicks to bytes */ /* clicks to bytes */
#define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) #define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT)
#define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT)
#define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) #define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT)
#define io_ctob(x) ((__psunsigned_t)(x)<<IO_BPCSHIFT) #define io_ctob(x) ((__psunsigned_t)(x)<<IO_BPCSHIFT)
/* bytes to clicks */ /* bytes to clicks */
#define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
#ifndef CELL_CAPABLE #ifndef CELL_CAPABLE
#define FSC_NOTIFY_NAME_CHANGED(vp) #define FSC_NOTIFY_NAME_CHANGED(vp)
...@@ -143,7 +146,7 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) ...@@ -143,7 +146,7 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
#endif #endif
/* Note: EWRONGFS never visible outside the kernel */ /* 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 * 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) ...@@ -156,14 +159,14 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
* 3/ EUCLEAN ["Structure needs cleaning"] * 3/ EUCLEAN ["Structure needs cleaning"]
* 4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace] * 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 SYNCHRONIZE() barrier()
#define __return_address __builtin_return_address(0) #define __return_address __builtin_return_address(0)
/* /*
* IRIX (BSD) quotactl makes use of separate commands for user/group, * 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 * field (see the QCMD macro in quota.h). These macros help keep the
* code portable - they are not visible from the syscall interface. * code portable - they are not visible from the syscall interface.
*/ */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -34,7 +34,44 @@ ...@@ -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> #include <linux/capability.h>
...@@ -50,7 +87,7 @@ ...@@ -50,7 +87,7 @@
*/ */
STATIC int STATIC int
xfs_iozero( xfs_iozero(
struct inode *ip, /* inode */ struct inode *ip, /* inode */
loff_t pos, /* offset in file */ loff_t pos, /* offset in file */
size_t count, /* size of data to zero */ size_t count, /* size of data to zero */
loff_t end_size) /* max file size to set */ loff_t end_size) /* max file size to set */
...@@ -280,7 +317,7 @@ xfs_zero_last_block( ...@@ -280,7 +317,7 @@ xfs_zero_last_block(
int zero_len; int zero_len;
int isize_fsb_offset; int isize_fsb_offset;
int error = 0; int error = 0;
xfs_bmbt_irec_t imap; xfs_bmbt_irec_t imap;
loff_t loff; loff_t loff;
size_t lsize; size_t lsize;
...@@ -334,7 +371,7 @@ xfs_zero_last_block( ...@@ -334,7 +371,7 @@ xfs_zero_last_block(
/* /*
* Zero any on disk space between the current EOF and the new, * 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 * 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 * out beyond the size of the file. This second case only happens
* with fixed size extents and when the system crashes before the inode * with fixed size extents and when the system crashes before the inode
...@@ -362,7 +399,7 @@ xfs_zero_eof( ...@@ -362,7 +399,7 @@ xfs_zero_eof(
xfs_mount_t *mp; xfs_mount_t *mp;
int nimaps; int nimaps;
int error = 0; int error = 0;
xfs_bmbt_irec_t imap; xfs_bmbt_irec_t imap;
loff_t loff; loff_t loff;
size_t lsize; size_t lsize;
...@@ -384,10 +421,10 @@ xfs_zero_eof( ...@@ -384,10 +421,10 @@ xfs_zero_eof(
/* /*
* Calculate the range between the new size and the old * 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, * block where the last byte in the file currently resides,
* we need to subtract one from the size and truncate back * 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. * exactly on a block boundary.
*/ */
last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1; last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1;
...@@ -435,7 +472,7 @@ xfs_zero_eof( ...@@ -435,7 +472,7 @@ xfs_zero_eof(
/* /*
* There are blocks in the range requested. * 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 * don't zero the entire range returned if it is
* too big and simply loop around to get the rest. * too big and simply loop around to get the rest.
* That is not the most efficient thing to do, but it * That is not the most efficient thing to do, but it
...@@ -709,7 +746,7 @@ xfs_write( ...@@ -709,7 +746,7 @@ xfs_write(
* the fact that buffered writes lock out direct I/O * the fact that buffered writes lock out direct I/O
* writes - the direct I/O write could have extended * writes - the direct I/O write could have extended
* the size nontransactionally, then finished before * 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 * didn't grow but the update isn't safe unless the
* size change is logged. * size change is logged.
* *
...@@ -857,33 +894,6 @@ XFS_bflush(xfs_buftarg_t *target) ...@@ -857,33 +894,6 @@ XFS_bflush(xfs_buftarg_t *target)
pagebuf_delwri_flush(target, PBDF_WAIT, NULL); 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 * If the underlying (log or data) device is readonly, there are some
* operations that cannot proceed. * operations that cannot proceed.
...@@ -903,4 +913,3 @@ xfs_dev_is_read_only(xfs_mount_t *mp, char *message) ...@@ -903,4 +913,3 @@ xfs_dev_is_read_only(xfs_mount_t *mp, char *message)
return 0; return 0;
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -45,7 +45,7 @@ struct page_buf_bmap_s; ...@@ -45,7 +45,7 @@ struct page_buf_bmap_s;
/* /*
* Maximum count of bmaps used by read and write paths. * 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, extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
struct page_buf_bmap_s *, int *); struct page_buf_bmap_s *, int *);
...@@ -76,8 +76,6 @@ extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t); ...@@ -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 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) \ #define XFS_FSB_TO_DB_IO(io,fsb) \
(((io)->io_flags & XFS_IOCORE_RT) ? \ (((io)->io_flags & XFS_IOCORE_RT) ? \
XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \ XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
struct xfsstats xfsstats; struct xfsstats xfsstats;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -92,8 +92,6 @@ struct xfs_mount; ...@@ -92,8 +92,6 @@ struct xfs_mount;
struct pb_target; struct pb_target;
struct block_device; 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 void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
extern int xfs_blkdev_get(struct xfs_mount *, const char *, extern int xfs_blkdev_get(struct xfs_mount *, const char *,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
#include "xfs_rw.h"
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -100,7 +101,7 @@ STATIC ctl_table xfs_dir_table[] = { ...@@ -100,7 +101,7 @@ STATIC ctl_table xfs_dir_table[] = {
}; };
STATIC ctl_table xfs_root_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} {0}
}; };
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,22 @@ ...@@ -30,7 +30,22 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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 int
vfs_mount( vfs_mount(
...@@ -88,6 +103,21 @@ vfs_unmount( ...@@ -88,6 +103,21 @@ vfs_unmount(
return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr)); return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
} }
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 int
vfs_root( vfs_root(
struct bhv_desc *bdp, struct bhv_desc *bdp,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -93,6 +93,8 @@ typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *, ...@@ -93,6 +93,8 @@ typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *,
struct xfs_mount_args *, int); struct xfs_mount_args *, int);
typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *); typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *); typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *,
struct xfs_mount_args *);
typedef int (*vfs_root_t)(bhv_desc_t *, struct vnode **); 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_statvfs_t)(bhv_desc_t *, struct statfs *, struct vnode *);
typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *); typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
...@@ -109,6 +111,7 @@ typedef struct vfsops { ...@@ -109,6 +111,7 @@ typedef struct vfsops {
vfs_parseargs_t vfs_parseargs; /* parse mount options */ vfs_parseargs_t vfs_parseargs; /* parse mount options */
vfs_showargs_t vfs_showargs; /* unparse mount options */ vfs_showargs_t vfs_showargs; /* unparse mount options */
vfs_unmount_t vfs_unmount; /* unmount file system */ 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_root_t vfs_root; /* get root vnode */
vfs_statvfs_t vfs_statvfs; /* file system statistics */ vfs_statvfs_t vfs_statvfs; /* file system statistics */
vfs_sync_t vfs_sync; /* flush files */ vfs_sync_t vfs_sync; /* flush files */
...@@ -126,7 +129,8 @@ typedef struct vfsops { ...@@ -126,7 +129,8 @@ typedef struct vfsops {
#define VFS_MOUNT(v, ma,cr, rv) ((rv) = vfs_mount(VHEAD(v), ma,cr)) #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_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_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_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_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)) #define VFS_SYNC(v, flag,cr, rv) ((rv) = vfs_sync(VHEAD(v), flag,cr))
...@@ -143,6 +147,7 @@ typedef struct vfsops { ...@@ -143,6 +147,7 @@ typedef struct vfsops {
#define PVFS_PARSEARGS(b, o,ma,f, rv) ((rv) = vfs_parseargs(b, o,ma,f)) #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_SHOWARGS(b, m, rv) ((rv) = vfs_showargs(b, m))
#define PVFS_UNMOUNT(b, f,cr, rv) ((rv) = vfs_unmount(b, f,cr)) #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_ROOT(b, vpp, rv) ((rv) = vfs_root(b, vpp))
#define PVFS_STATVFS(b, sp,vp, rv) ((rv) = vfs_statvfs(b, sp,vp)) #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)) #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 *); ...@@ -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_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
extern int vfs_showargs(bhv_desc_t *, struct seq_file *); extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
extern int vfs_unmount(bhv_desc_t *, int, struct cred *); extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
extern int vfs_root(bhv_desc_t *, struct vnode **); extern int vfs_root(bhv_desc_t *, struct vnode **);
extern int vfs_statvfs(bhv_desc_t *, struct statfs *, struct vnode *); extern int vfs_statvfs(bhv_desc_t *, struct statfs *, struct vnode *);
extern int vfs_sync(bhv_desc_t *, int, struct cred *); extern int vfs_sync(bhv_desc_t *, int, struct cred *);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
uint64_t vn_generation; /* vnode generation number */ uint64_t vn_generation; /* vnode generation number */
...@@ -40,8 +40,8 @@ spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED; ...@@ -40,8 +40,8 @@ spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
* Dedicated vnode inactive/reclaim sync semaphores. * Dedicated vnode inactive/reclaim sync semaphores.
* Prime number of hash buckets since address is used as the key. * Prime number of hash buckets since address is used as the key.
*/ */
#define NVSYNC 37 #define NVSYNC 37
#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) #define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC])
sv_t vsync[NVSYNC]; sv_t vsync[NVSYNC];
/* /*
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -118,11 +118,11 @@ typedef enum { ...@@ -118,11 +118,11 @@ typedef enum {
* Conversion between vnode types/modes and encoded type/mode as * Conversion between vnode types/modes and encoded type/mode as
* seen by stat(2) and mknod(2). * seen by stat(2) and mknod(2).
*/ */
extern enum vtype iftovt_tab[]; extern enum vtype iftovt_tab[];
extern ushort vttoif_tab[]; extern ushort vttoif_tab[];
#define IFTOVT(M) (iftovt_tab[((M) & S_IFMT) >> 12]) #define IFTOVT(M) (iftovt_tab[((M) & S_IFMT) >> 12])
#define VTTOIF(T) (vttoif_tab[(int)(T)]) #define VTTOIF(T) (vttoif_tab[(int)(T)])
#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) #define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT))
/* /*
* Vnode flags. * Vnode flags.
...@@ -142,8 +142,8 @@ typedef enum vrwlock { VRWLOCK_NONE, VRWLOCK_READ, ...@@ -142,8 +142,8 @@ typedef enum vrwlock { VRWLOCK_NONE, VRWLOCK_READ,
* VN_INACTIVE_NOCACHE implies that the file system behavior * VN_INACTIVE_NOCACHE implies that the file system behavior
* has disassociated its state and bhv_desc_t from the vnode. * has disassociated its state and bhv_desc_t from the vnode.
*/ */
#define VN_INACTIVE_CACHE 0 #define VN_INACTIVE_CACHE 0
#define VN_INACTIVE_NOCACHE 1 #define VN_INACTIVE_NOCACHE 1
/* /*
* Values for the cmd code given to VOP_VNODE_CHANGE. * 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, ...@@ -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_reclaim_t)(bhv_desc_t *);
typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int, typedef int (*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
struct cred *); 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 *); struct cred *);
typedef int (*vop_attr_remove_t)(bhv_desc_t *, char *, 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_list_t)(bhv_desc_t *, char *, int, int,
struct attrlist_cursor_kern *, struct cred *); struct attrlist_cursor_kern *, struct cred *);
typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int); 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); 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); ...@@ -218,7 +218,7 @@ typedef int (*vop_iflush_t)(bhv_desc_t *, int);
typedef struct vnodeops { 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_open_t vop_open;
vop_read_t vop_read; vop_read_t vop_read;
vop_write_t vop_write; vop_write_t vop_write;
...@@ -274,31 +274,31 @@ typedef struct vnodeops { ...@@ -274,31 +274,31 @@ typedef struct vnodeops {
rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr) rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr)
#define VOP_GETATTR(vp, vap, f, cr, rv) \ #define VOP_GETATTR(vp, vap, f, cr, rv) \
rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr) 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) 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) 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) rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr)
#define VOP_CREATE(dvp,d,vap,vpp,cr,rv) \ #define VOP_CREATE(dvp,d,vap,vpp,cr,rv) \
rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr) rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr)
#define VOP_REMOVE(dvp,d,cr,rv) \ #define VOP_REMOVE(dvp,d,cr,rv) \
rv = _VOP_(vop_remove, dvp)((dvp)->v_fbhv,d,cr) 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) 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) 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) rv = _VOP_(vop_mkdir, dp)((dp)->v_fbhv,d,vap,vpp,cr)
#define VOP_RMDIR(dp,d,cr,rv) \ #define VOP_RMDIR(dp,d,cr,rv) \
rv = _VOP_(vop_rmdir, dp)((dp)->v_fbhv,d,cr) 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) 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) 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) 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) rv = _VOP_(vop_fsync, vp)((vp)->v_fbhv,f,cr,b,e)
#define VOP_INACTIVE(vp, cr, rv) \ #define VOP_INACTIVE(vp, cr, rv) \
rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr) rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr)
...@@ -318,11 +318,11 @@ typedef struct vnodeops { ...@@ -318,11 +318,11 @@ typedef struct vnodeops {
rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv) rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv)
#define VOP_ATTR_GET(vp, name, val, vallenp, fl, cred, rv) \ #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) 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) 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) 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) rv = _VOP_(vop_attr_list, vp)((vp)->v_fbhv,buf,buflen,fl,cursor,cred)
#define VOP_LINK_REMOVED(vp, dvp, linkzero) \ #define VOP_LINK_REMOVED(vp, dvp, linkzero) \
(void)_VOP_(vop_link_removed, vp)((vp)->v_fbhv, 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) ...@@ -569,12 +569,12 @@ static __inline__ void vn_flagclr(struct vnode *vp, uint flag)
/* /*
* Flags to VOP_SETATTR/VOP_GETATTR. * Flags to VOP_SETATTR/VOP_GETATTR.
*/ */
#define ATTR_UTIME 0x01 /* non-default utime(2) request */ #define ATTR_UTIME 0x01 /* non-default utime(2) request */
#define ATTR_EXEC 0x02 /* invocation from exec(2) */ #define ATTR_EXEC 0x02 /* invocation from exec(2) */
#define ATTR_COMM 0x04 /* yield common vp attributes */ #define ATTR_COMM 0x04 /* yield common vp attributes */
#define ATTR_DMI 0x08 /* invocation from a DMI function */ #define ATTR_DMI 0x08 /* invocation from a DMI function */
#define ATTR_LAZY 0x80 /* set/get attributes lazily */ #define ATTR_LAZY 0x80 /* set/get attributes lazily */
#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ #define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */
#define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */ #define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */
#define ATTR_NOSIZETOK 0x400 /* Don't get the DVN_SIZE_READ token */ #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) ...@@ -588,33 +588,33 @@ static __inline__ void vn_flagclr(struct vnode *vp, uint flag)
#if (defined(CONFIG_XFS_VNODE_TRACING)) #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. * Tracing entries.
*/ */
#define VNODE_KTRACE_ENTRY 1 #define VNODE_KTRACE_ENTRY 1
#define VNODE_KTRACE_EXIT 2 #define VNODE_KTRACE_EXIT 2
#define VNODE_KTRACE_HOLD 3 #define VNODE_KTRACE_HOLD 3
#define VNODE_KTRACE_REF 4 #define VNODE_KTRACE_REF 4
#define VNODE_KTRACE_RELE 5 #define VNODE_KTRACE_RELE 5
extern void vn_trace_entry(struct vnode *, char *, inst_t *); extern void vn_trace_entry(struct vnode *, char *, inst_t *);
extern void vn_trace_exit(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_hold(struct vnode *, char *, int, inst_t *);
extern void vn_trace_ref(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 *); 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) vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address)
#else /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */ #else /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
#define vn_trace_entry(a,b,c) #define vn_trace_entry(a,b,c)
#define vn_trace_exit(a,b,c) #define vn_trace_exit(a,b,c)
#define vn_trace_hold(a,b,c,d) #define vn_trace_hold(a,b,c,d)
#define vn_trace_ref(a,b,c,d) #define vn_trace_ref(a,b,c,d)
#define vn_trace_rele(a,b,c,d) #define vn_trace_rele(a,b,c,d)
#define VN_TRACE(vp) #define VN_TRACE(vp)
#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */ #endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* cached pages for I/O. * 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. * and Rajagopal Ananthanarayanan ("ananth") at SGI.
* *
*/ */
...@@ -80,7 +80,7 @@ static spinlock_t pb_trace_lock = SPIN_LOCK_UNLOCKED; ...@@ -80,7 +80,7 @@ static spinlock_t pb_trace_lock = SPIN_LOCK_UNLOCKED;
struct pagebuf_trace_buf pb_trace; struct pagebuf_trace_buf pb_trace;
EXPORT_SYMBOL(pb_trace); EXPORT_SYMBOL(pb_trace);
EXPORT_SYMBOL(pb_trace_func); 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 void
pb_trace_func( pb_trace_func(
...@@ -129,7 +129,7 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue; ...@@ -129,7 +129,7 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
* /proc/sys/vm/pagebuf * /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 }; unsigned long pagebuf_max[P_PARAM] = { HZ*30, HZ*300, 1, 1 };
pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }}; pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }};
...@@ -194,13 +194,13 @@ _bhash( ...@@ -194,13 +194,13 @@ _bhash(
STATIC void *pagebuf_mapout_locked(page_buf_t *); 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 { typedef struct a_list {
void *vm_addr; void *vm_addr;
struct a_list *next; struct a_list *next;
} a_list_t; } a_list_t;
STATIC a_list_t *as_free_head; STATIC a_list_t *as_free_head;
STATIC int as_list_len; STATIC int as_list_len;
/* /*
...@@ -251,7 +251,7 @@ purge_addresses(void) ...@@ -251,7 +251,7 @@ purge_addresses(void)
* *
* Buffers associated with inodes for which buffer locking * Buffers associated with inodes for which buffer locking
* is not enabled are not protected by semaphores, and are * 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 * spinlock in the buffer, for use by the caller when concurrent
* access is possible. * access is possible.
*/ */
...@@ -549,7 +549,7 @@ _pagebuf_lookup_pages( ...@@ -549,7 +549,7 @@ _pagebuf_lookup_pages(
/* A single page buffer is always mappable */ /* A single page buffer is always mappable */
if (page_count == 1) { if (page_count == 1) {
pb->pb_addr = (caddr_t) 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; pb->pb_flags |= PBF_MAPPED;
} else if (flags & PBF_MAPPED) { } else if (flags & PBF_MAPPED) {
if (as_list_len > 64) if (as_list_len > 64)
...@@ -701,8 +701,8 @@ _pagebuf_find( /* find buffer for block */ ...@@ -701,8 +701,8 @@ _pagebuf_find( /* find buffer for block */
* *
* pagebuf_find returns a buffer matching the specified range of * pagebuf_find returns a buffer matching the specified range of
* data for the specified target, if any of the relevant blocks * data for the specified target, if any of the relevant blocks
* are in memory. The buffer may have unallocated holes, if * are in memory. The buffer may have unallocated holes, if
* some, but not all, of the blocks are in memory. Even where * 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 * pages are present in the buffer, not all of every page may be
* valid. * valid.
*/ */
...@@ -728,7 +728,7 @@ pagebuf_find( /* find buffer for block */ ...@@ -728,7 +728,7 @@ pagebuf_find( /* find buffer for block */
*/ */
page_buf_t * page_buf_t *
pagebuf_get( /* allocate a buffer */ 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 */ loff_t ioff, /* starting offset of range */
size_t isize, /* length of range */ size_t isize, /* length of range */
page_buf_flags_t flags) /* PBF_TRYLOCK */ page_buf_flags_t flags) /* PBF_TRYLOCK */
...@@ -846,7 +846,7 @@ mem_to_page( ...@@ -846,7 +846,7 @@ mem_to_page(
void *addr) void *addr)
{ {
if (((unsigned long)addr < VMALLOC_START) || if (((unsigned long)addr < VMALLOC_START) ||
((unsigned long)addr >= VMALLOC_END)) { ((unsigned long)addr >= VMALLOC_END)) {
return virt_to_page(addr); return virt_to_page(addr);
} else { } else {
return vmalloc_to_page(addr); return vmalloc_to_page(addr);
...@@ -1049,7 +1049,7 @@ pagebuf_rele( ...@@ -1049,7 +1049,7 @@ pagebuf_rele(
* pagebuf_pin * pagebuf_pin
* *
* pagebuf_pin locks all of the memory represented by a buffer in * 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 * the same or different buffers affecting a given page, will
* properly count the number of outstanding "pin" requests. The * properly count the number of outstanding "pin" requests. The
* buffer may be released after the pagebuf_pin and a different * buffer may be released after the pagebuf_pin and a different
...@@ -1095,7 +1095,7 @@ pagebuf_ispin( ...@@ -1095,7 +1095,7 @@ pagebuf_ispin(
* pagebuf_wait_unpin * pagebuf_wait_unpin
* *
* pagebuf_wait_unpin waits until all of the memory associated * 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. * immediately if none of the affected pages are locked.
*/ */
static inline void static inline void
...@@ -1575,6 +1575,13 @@ pagebuf_delwri_dequeue( ...@@ -1575,6 +1575,13 @@ pagebuf_delwri_dequeue(
spin_unlock(&pbd_delwrite_lock); spin_unlock(&pbd_delwrite_lock);
} }
STATIC void
pagebuf_runall_queues(
struct workqueue_struct *queue)
{
flush_workqueue(queue);
}
/* Defines for pagebuf daemon */ /* Defines for pagebuf daemon */
DECLARE_WAIT_QUEUE_HEAD(pbd_waitq); DECLARE_WAIT_QUEUE_HEAD(pbd_waitq);
STATIC int force_flush; STATIC int force_flush;
...@@ -1680,10 +1687,13 @@ pagebuf_delwri_flush( ...@@ -1680,10 +1687,13 @@ pagebuf_delwri_flush(
page_buf_t *pb; page_buf_t *pb;
struct list_head *curr, *next, tmp; struct list_head *curr, *next, tmp;
int pincount = 0; int pincount = 0;
int flush_cnt = 0;
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
INIT_LIST_HEAD(&tmp); INIT_LIST_HEAD(&tmp);
pagebuf_runall_queues(pagebuf_dataio_workqueue);
list_for_each_safe(curr, next, &pbd_delwrite_queue) { list_for_each_safe(curr, next, &pbd_delwrite_queue) {
pb = list_entry(curr, page_buf_t, pb_list); pb = list_entry(curr, page_buf_t, pb_list);
...@@ -1725,6 +1735,10 @@ pagebuf_delwri_flush( ...@@ -1725,6 +1735,10 @@ pagebuf_delwri_flush(
pb->pb_flags |= PBF_WRITE; pb->pb_flags |= PBF_WRITE;
__pagebuf_iorequest(pb); __pagebuf_iorequest(pb);
if (++flush_cnt > 32) {
pagebuf_run_queues(NULL);
flush_cnt = 0;
}
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
} }
...@@ -1776,7 +1790,7 @@ pagebuf_daemon_start(void) ...@@ -1776,7 +1790,7 @@ pagebuf_daemon_start(void)
/* /*
* pagebuf_daemon_stop * pagebuf_daemon_stop
* *
* Note: do not mark as __exit, it is called from pagebuf_terminate. * Note: do not mark as __exit, it is called from pagebuf_terminate.
*/ */
STATIC void STATIC void
...@@ -1845,7 +1859,7 @@ STATIC ctl_table pagebuf_dir_table[] = { ...@@ -1845,7 +1859,7 @@ STATIC ctl_table pagebuf_dir_table[] = {
}; };
STATIC ctl_table pagebuf_root_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} {0}
}; };
...@@ -1881,7 +1895,7 @@ pagebuf_readstats( ...@@ -1881,7 +1895,7 @@ pagebuf_readstats(
return len; return len;
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
STATIC void STATIC void
pagebuf_shaker(void) pagebuf_shaker(void)
...@@ -1935,8 +1949,8 @@ pagebuf_init(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. * Note: do not mark as __exit, this is also called from the __init code.
*/ */
void void
...@@ -1948,7 +1962,7 @@ pagebuf_terminate(void) ...@@ -1948,7 +1962,7 @@ pagebuf_terminate(void)
kmem_shake_deregister(pagebuf_shaker); kmem_shake_deregister(pagebuf_shaker);
unregister_sysctl_table(pagebuf_table_header); 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/stat", NULL);
remove_proc_entry("fs/pagebuf", NULL); remove_proc_entry("fs/pagebuf", NULL);
#endif #endif
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -83,17 +83,31 @@ typedef enum { /* pbm_flags values */ ...@@ -83,17 +83,31 @@ typedef enum { /* pbm_flags values */
/* but uninitialized file data */ /* but uninitialized file data */
} bmap_flags_t; } 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 */ typedef enum page_buf_flags_e { /* pb_flags values */
PBF_READ = (1 << 0), /* buffer intended for reading from device */ PBF_READ = (1 << 0), /* buffer intended for reading from device */
PBF_WRITE = (1 << 1), /* buffer intended for writing to device */ PBF_WRITE = (1 << 1), /* buffer intended for writing to device */
PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */ PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */
PBF_PARTIAL = (1 << 3), /* buffer partially read */ PBF_PARTIAL = (1 << 3), /* buffer partially read */
PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */ PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */
PBF_NONE = (1 << 5), /* buffer not read at all */ PBF_NONE = (1 << 5), /* buffer not read at all */
PBF_DELWRI = (1 << 6), /* buffer has dirty pages */ PBF_DELWRI = (1 << 6), /* buffer has dirty pages */
PBF_FREED = (1 << 7), /* buffer has been freed and is invalid */ PBF_FREED = (1 << 7), /* buffer has been freed and is invalid */
PBF_SYNC = (1 << 8), /* force updates to disk */ PBF_SYNC = (1 << 8), /* force updates to disk */
PBF_MAPPABLE = (1 << 9),/* use directly-addressable pages */ PBF_MAPPABLE = (1 << 9),/* use directly-addressable pages */
PBF_STALE = (1 << 10), /* buffer has been staled, do not find it */ PBF_STALE = (1 << 10), /* buffer has been staled, do not find it */
PBF_FS_MANAGED = (1 << 11), /* filesystem controls freeing memory */ PBF_FS_MANAGED = (1 << 11), /* filesystem controls freeing memory */
PBF_FS_DATAIOD = (1 << 12), /* schedule IO completion on fs datad */ PBF_FS_DATAIOD = (1 << 12), /* schedule IO completion on fs datad */
...@@ -101,20 +115,18 @@ typedef enum page_buf_flags_e { /* pb_flags values */ ...@@ -101,20 +115,18 @@ typedef enum page_buf_flags_e { /* pb_flags values */
/* flags used only as arguments to access routines */ /* flags used only as arguments to access routines */
PBF_LOCK = (1 << 13), /* lock requested */ PBF_LOCK = (1 << 13), /* lock requested */
PBF_TRYLOCK = (1 << 14), /* lock requested, but do not wait */ PBF_TRYLOCK = (1 << 14), /* lock requested, but do not wait */
PBF_FILE_ALLOCATE = (1 << 15), /* allocate all file space */ PBF_DONT_BLOCK = (1 << 15), /* do not block in current thread */
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 */
/* flags used only internally */ /* flags used only internally */
_PBF_LOCKABLE = (1 << 19), /* page_buf_t may be locked */ _PBF_LOCKABLE = (1 << 16), /* page_buf_t may be locked */
_PBF_ALL_PAGES_MAPPED = (1 << 21), /* all pages in range mapped */ _PBF_PRIVATE_BH = (1 << 17), /* do not use public buffer heads */
_PBF_ADDR_ALLOCATED = (1 << 22), /* pb_addr space was allocated */ _PBF_ALL_PAGES_MAPPED = (1 << 18), /* all pages in range mapped */
_PBF_MEM_ALLOCATED = (1 << 23), /* pb_mem+underlying pages alloc'd */ _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_FORCEIO = (1 << 21),
PBF_FLUSH = (1 << 25), /* flush disk write cache */ PBF_FLUSH = (1 << 22), /* flush disk write cache */
PBF_READ_AHEAD = (1 << 26), PBF_READ_AHEAD = (1 << 23),
} page_buf_flags_t; } page_buf_flags_t;
...@@ -170,10 +182,10 @@ typedef page_buf_bmap_t pb_bmap_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 * 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 * 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, * 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. * 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. * 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 * 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 * partially filled with data have bits set in their block_map entry
...@@ -200,7 +212,7 @@ typedef struct page_buf_s { ...@@ -200,7 +212,7 @@ typedef struct page_buf_s {
struct pb_target *pb_target; /* logical object */ struct pb_target *pb_target; /* logical object */
atomic_t pb_hold; /* reference count */ atomic_t pb_hold; /* reference count */
page_buf_daddr_t pb_bn; /* block number for I/O */ 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_buffer_length; /* size of buffer in bytes */
size_t pb_count_desired; /* desired transfer size */ size_t pb_count_desired; /* desired transfer size */
void *pb_addr; /* virtual address of buffer */ void *pb_addr; /* virtual address of buffer */
...@@ -241,10 +253,10 @@ extern page_buf_t *pagebuf_find( /* find buffer for block if */ ...@@ -241,10 +253,10 @@ extern page_buf_t *pagebuf_find( /* find buffer for block if */
extern page_buf_t *pagebuf_get( /* allocate a buffer */ extern page_buf_t *pagebuf_get( /* allocate a buffer */
struct pb_target *, /* inode for buffer */ struct pb_target *, /* inode for buffer */
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* PBF_LOCK, PBF_READ, */ page_buf_flags_t); /* PBF_LOCK, PBF_READ, */
/* PBF_ASYNC */ /* PBF_ASYNC */
extern page_buf_t *pagebuf_lookup( extern page_buf_t *pagebuf_lookup(
struct pb_target *, struct pb_target *,
...@@ -253,7 +265,7 @@ extern page_buf_t *pagebuf_lookup( ...@@ -253,7 +265,7 @@ extern page_buf_t *pagebuf_lookup(
page_buf_flags_t); /* PBF_READ, PBF_WRITE, */ page_buf_flags_t); /* PBF_READ, PBF_WRITE, */
/* PBF_FORCEIO, _PBF_LOCKABLE */ /* 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 */ /* no memory or disk address */
struct pb_target *); /* mount point "fake" inode */ struct pb_target *); /* mount point "fake" inode */
...@@ -273,8 +285,8 @@ extern void pagebuf_hold( /* increment reference count */ ...@@ -273,8 +285,8 @@ extern void pagebuf_hold( /* increment reference count */
extern void pagebuf_readahead( /* read ahead into cache */ extern void pagebuf_readahead( /* read ahead into cache */
struct pb_target *, /* target for buffer (or NULL) */ struct pb_target *, /* target for buffer (or NULL) */
loff_t, /* starting offset of range */ loff_t, /* starting offset of range */
size_t, /* length of range */ size_t, /* length of range */
page_buf_flags_t); /* additional read flags */ page_buf_flags_t); /* additional read flags */
/* Writing and Releasing Buffers */ /* Writing and Releasing Buffers */
...@@ -292,10 +304,10 @@ extern int pagebuf_cond_lock( /* lock buffer, if not locked */ ...@@ -292,10 +304,10 @@ extern int pagebuf_cond_lock( /* lock buffer, if not locked */
page_buf_t *); /* buffer to lock */ page_buf_t *); /* buffer to lock */
extern int pagebuf_lock_value( /* return count on 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 */ extern int pagebuf_lock( /* lock buffer */
page_buf_t *); /* buffer to lock */ page_buf_t *); /* buffer to lock */
extern void pagebuf_unlock( /* unlock buffer */ extern void pagebuf_unlock( /* unlock buffer */
page_buf_t *); /* buffer to unlock */ page_buf_t *); /* buffer to unlock */
...@@ -310,9 +322,9 @@ extern void pagebuf_iodone( /* mark buffer I/O complete */ ...@@ -310,9 +322,9 @@ extern void pagebuf_iodone( /* mark buffer I/O complete */
page_buf_t *, /* buffer to mark */ page_buf_t *, /* buffer to mark */
int, /* use data/log helper thread. */ int, /* use data/log helper thread. */
int); /* run completion locally, or in 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 */ page_buf_t *, /* buffer to mark */
unsigned int); /* error to store (0 if none) */ unsigned int); /* error to store (0 if none) */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -79,20 +79,20 @@ struct pagebuf_trace_buf { ...@@ -79,20 +79,20 @@ struct pagebuf_trace_buf {
}; };
#define PB_TRACE_BUFSIZE 1024 #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 * Tunable pagebuf parameters
*/ */
#define P_PARAM 4 #define P_PARAM 4
typedef union pagebuf_param { typedef union pagebuf_param {
struct { struct {
ulong flush_interval; /* interval between runs of the ulong flush_interval; /* interval between runs of the
* delwri flush daemon. */ * delwri flush daemon. */
ulong age_buffer; /* time for buffer to age before ulong age_buffer; /* time for buffer to age before
* we flush it. */ * we flush it. */
ulong debug; /* debug tracing on or off */ ulong debug; /* debug tracing on or off */
ulong stats_clear; /* clear the pagebuf stats */ ulong stats_clear; /* clear the pagebuf stats */
} p_un; } p_un;
...@@ -129,7 +129,7 @@ extern struct pbstats pbstats; ...@@ -129,7 +129,7 @@ extern struct pbstats pbstats;
#define PB_STATS_INC(count) ( count ++ ) #define PB_STATS_INC(count) ( count ++ )
#ifndef STATIC #ifndef STATIC
# define STATIC static # define STATIC static
#endif #endif
#endif /* __PAGE_BUF_PRIVATE_H__ */ #endif /* __PAGE_BUF_PRIVATE_H__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* cached pages for I/O. The page_buf_locking module adds support for * cached pages for I/O. The page_buf_locking module adds support for
* locking such page buffers. * locking such page buffers.
* *
* Written by Steve Lord at SGI * Written by Steve Lord at SGI
* *
*/ */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
#ifdef PB_DEFINE_TRACES #ifdef PB_DEFINE_TRACES
#define PB_TRACE_START typedef enum { #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; #define PB_TRACE_END } pb_trace_var_t;
#else #else
#define PB_TRACE_START static char *event_names[] = { #define PB_TRACE_START static char *event_names[] = {
#define PB_TRACE_REC(x) #x #define PB_TRACE_REC(x) #x
#define PB_TRACE_END }; #define PB_TRACE_END };
#endif #endif
...@@ -86,7 +86,7 @@ PB_TRACE_END ...@@ -86,7 +86,7 @@ PB_TRACE_END
extern void pb_trace_func(page_buf_t *, int, void *, void *); extern void pb_trace_func(page_buf_t *, int, void *, void *);
#ifdef PAGEBUF_TRACE #ifdef PAGEBUF_TRACE
# define PB_TRACE(pb, event, misc) \ # 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)) (void *)__builtin_return_address(0))
#else #else
# define PB_TRACE(pb, event, misc) do { } while (0) # define PB_TRACE(pb, event, misc) do { } while (0)
......
...@@ -30,7 +30,43 @@ ...@@ -30,7 +30,43 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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" #include "xfs_qm.h"
......
...@@ -30,7 +30,42 @@ ...@@ -30,7 +30,42 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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" #include "xfs_qm.h"
......
...@@ -30,7 +30,44 @@ ...@@ -30,7 +30,44 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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" #include "xfs_qm.h"
/* /*
......
...@@ -30,8 +30,41 @@ ...@@ -30,8 +30,41 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
#include <linux/init.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" #include "xfs_qm.h"
#define MNTOPT_QUOTA "quota" /* disk quotas (user) */ #define MNTOPT_QUOTA "quota" /* disk quotas (user) */
......
...@@ -30,8 +30,40 @@ ...@@ -30,8 +30,40 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#include <xfs.h> #include "xfs.h"
#include <linux/proc_fs.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" #include "xfs_qm.h"
struct xqmstats xqmstats; struct xqmstats xqmstats;
......
...@@ -30,7 +30,41 @@ ...@@ -30,7 +30,41 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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" #include "xfs_qm.h"
#ifdef DEBUG #ifdef DEBUG
...@@ -69,11 +103,11 @@ xfs_qm_quotactl( ...@@ -69,11 +103,11 @@ xfs_qm_quotactl(
xfs_caddr_t addr) xfs_caddr_t addr)
{ {
xfs_mount_t *mp; xfs_mount_t *mp;
int error; int error;
struct vfs *vfsp; struct vfs *vfsp;
vfsp = bhvtovfs(bdp); vfsp = bhvtovfs(bdp);
mp = XFS_VFSTOM(vfsp); mp = XFS_VFSTOM(vfsp);
if (addr == NULL && cmd != Q_SYNC) if (addr == NULL && cmd != Q_SYNC)
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
...@@ -84,7 +118,7 @@ xfs_qm_quotactl( ...@@ -84,7 +118,7 @@ xfs_qm_quotactl(
* The following commands are valid even when quotaoff. * The following commands are valid even when quotaoff.
*/ */
switch (cmd) { switch (cmd) {
/* /*
* truncate quota files. quota must be off. * truncate quota files. quota must be off.
*/ */
case Q_XQUOTARM: case Q_XQUOTARM:
...@@ -92,7 +126,7 @@ xfs_qm_quotactl( ...@@ -92,7 +126,7 @@ xfs_qm_quotactl(
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
if (vfsp->vfs_flag & VFS_RDONLY) if (vfsp->vfs_flag & VFS_RDONLY)
return XFS_ERROR(EROFS); 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))); xfs_qm_import_qtype_flags(*(uint *)addr)));
/* /*
* Get quota status information. * Get quota status information.
...@@ -116,7 +150,7 @@ xfs_qm_quotactl( ...@@ -116,7 +150,7 @@ xfs_qm_quotactl(
if (vfsp->vfs_flag & VFS_RDONLY) if (vfsp->vfs_flag & VFS_RDONLY)
return XFS_ERROR(EROFS); return XFS_ERROR(EROFS);
break; break;
default: default:
break; break;
} }
...@@ -133,11 +167,11 @@ xfs_qm_quotactl( ...@@ -133,11 +167,11 @@ xfs_qm_quotactl(
B_FALSE); B_FALSE);
break; break;
/* /*
* Defaults to XFS_GETUQUOTA. * Defaults to XFS_GETUQUOTA.
*/ */
case Q_XGETQUOTA: 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); (fs_disk_quota_t *)addr);
break; break;
/* /*
...@@ -157,9 +191,9 @@ xfs_qm_quotactl( ...@@ -157,9 +191,9 @@ xfs_qm_quotactl(
(fs_disk_quota_t *)addr); (fs_disk_quota_t *)addr);
break; break;
case Q_XGETGQUOTA: 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); (fs_disk_quota_t *)addr);
break; break;
......
...@@ -30,7 +30,42 @@ ...@@ -30,7 +30,42 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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" #include "xfs_qm.h"
STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
int doass = 1; int doass = 1;
static char message[256]; /* keep it off the stack */ 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 */ /* Translate from CE_FOO to KERN_FOO, err_level(CE_FOO) == KERN_FOO */
#define XFS_MAX_ERR_LEVEL 7 #define XFS_MAX_ERR_LEVEL 7
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -29,17 +29,17 @@ ...@@ -29,17 +29,17 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef __XFS_SUPPORT_DEBUG_H__ #ifndef __XFS_SUPPORT_DEBUG_H__
#define __XFS_SUPPORT_DEBUG_H__ #define __XFS_SUPPORT_DEBUG_H__
#include <stdarg.h> #include <stdarg.h>
#define CE_DEBUG 7 /* debug */ #define CE_DEBUG 7 /* debug */
#define CE_CONT 6 /* continuation */ #define CE_CONT 6 /* continuation */
#define CE_NOTE 5 /* notice */ #define CE_NOTE 5 /* notice */
#define CE_WARN 4 /* warning */ #define CE_WARN 4 /* warning */
#define CE_ALERT 1 /* alert */ #define CE_ALERT 1 /* alert */
#define CE_PANIC 0 /* panic */ #define CE_PANIC 0 /* panic */
extern void icmn_err(int, char *, va_list); extern void icmn_err(int, char *, va_list);
extern void cmn_err(int, char *, ...); extern void cmn_err(int, char *, ...);
...@@ -49,7 +49,7 @@ 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 */ # define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */
# else # else
# define ASSERT(EX) ((!doass||(EX))?((void)0):assfail(#EX, __FILE__, __LINE__)) # define ASSERT(EX) ((!doass||(EX))?((void)0):assfail(#EX, __FILE__, __LINE__))
# endif /* lint */ # endif /* lint */
#else #else
# define ASSERT(x) ((void)0) # define ASSERT(x) ((void)0)
#endif #endif
...@@ -62,6 +62,6 @@ extern int get_thread_id(void); ...@@ -62,6 +62,6 @@ extern int get_thread_id(void);
#endif #endif
#define ASSERT_ALWAYS(EX) ((EX)?((void)0):assfail(#EX, __FILE__, __LINE__)) #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__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -162,7 +162,7 @@ void ...@@ -162,7 +162,7 @@ void
kmem_free(void *ptr, size_t size) kmem_free(void *ptr, size_t size)
{ {
if (((unsigned long)ptr < VMALLOC_START) || if (((unsigned long)ptr < VMALLOC_START) ||
((unsigned long)ptr >= VMALLOC_END)) { ((unsigned long)ptr >= VMALLOC_END)) {
kfree(ptr); kfree(ptr);
} else { } else {
vfree(ptr); vfree(ptr);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
extern kmem_zone_t *kmem_zone_init(int, char *); extern kmem_zone_t *kmem_zone_init(int, char *);
extern void *kmem_zone_zalloc(kmem_zone_t *, int); extern void *kmem_zone_zalloc(kmem_zone_t *, int);
extern void *kmem_zone_alloc(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_alloc(size_t, int);
extern void *kmem_realloc(void *, size_t, size_t, int); extern void *kmem_realloc(void *, size_t, size_t, int);
extern void *kmem_zalloc(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); typedef void (*kmem_shake_func_t)(void);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <xfs_types.h> #include <xfs_types.h>
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
static kmem_zone_t *ktrace_hdr_zone; static kmem_zone_t *ktrace_hdr_zone;
static kmem_zone_t *ktrace_ent_zone; static kmem_zone_t *ktrace_ent_zone;
static int ktrace_zentries; static int ktrace_zentries;
void void
ktrace_init(int zentries) ktrace_init(int zentries)
...@@ -76,8 +77,8 @@ ktrace_uninit(void) ...@@ -76,8 +77,8 @@ ktrace_uninit(void)
ktrace_t * ktrace_t *
ktrace_alloc(int nentries, int sleep) ktrace_alloc(int nentries, int sleep)
{ {
ktrace_t *ktp; ktrace_t *ktp;
ktrace_entry_t *ktep; ktrace_entry_t *ktep;
ktp = (ktrace_t*)kmem_zone_alloc(ktrace_hdr_zone, sleep); ktp = (ktrace_t*)kmem_zone_alloc(ktrace_hdr_zone, sleep);
...@@ -116,9 +117,9 @@ ktrace_alloc(int nentries, int sleep) ...@@ -116,9 +117,9 @@ ktrace_alloc(int nentries, int sleep)
spinlock_init(&(ktp->kt_lock), "kt_lock"); spinlock_init(&(ktp->kt_lock), "kt_lock");
ktp->kt_entries = ktep; ktp->kt_entries = ktep;
ktp->kt_nentries = nentries; ktp->kt_nentries = nentries;
ktp->kt_index = 0; ktp->kt_index = 0;
ktp->kt_rollover = 0; ktp->kt_rollover = 0;
return ktp; return ktp;
...@@ -134,7 +135,7 @@ ktrace_alloc(int nentries, int sleep) ...@@ -134,7 +135,7 @@ ktrace_alloc(int nentries, int sleep)
void void
ktrace_free(ktrace_t *ktp) ktrace_free(ktrace_t *ktp)
{ {
int entries_size; int entries_size;
if (ktp == (ktrace_t *)NULL) if (ktp == (ktrace_t *)NULL)
return; return;
...@@ -162,27 +163,27 @@ ktrace_free(ktrace_t *ktp) ...@@ -162,27 +163,27 @@ ktrace_free(ktrace_t *ktp)
*/ */
void void
ktrace_enter( ktrace_enter(
ktrace_t *ktp, ktrace_t *ktp,
void *val0, void *val0,
void *val1, void *val1,
void *val2, void *val2,
void *val3, void *val3,
void *val4, void *val4,
void *val5, void *val5,
void *val6, void *val6,
void *val7, void *val7,
void *val8, void *val8,
void *val9, void *val9,
void *val10, void *val10,
void *val11, void *val11,
void *val12, void *val12,
void *val13, void *val13,
void *val14, void *val14,
void *val15) void *val15)
{ {
static lock_t wrap_lock = SPIN_LOCK_UNLOCKED; static lock_t wrap_lock = SPIN_LOCK_UNLOCKED;
int index; int index;
ktrace_entry_t *ktep; ktrace_entry_t *ktep;
ASSERT(ktp != NULL); ASSERT(ktp != NULL);
...@@ -225,7 +226,7 @@ ktrace_enter( ...@@ -225,7 +226,7 @@ ktrace_enter(
*/ */
int int
ktrace_nentries( ktrace_nentries(
ktrace_t *ktp) ktrace_t *ktp)
{ {
if (ktp == NULL) { if (ktp == NULL) {
return 0; return 0;
...@@ -246,15 +247,15 @@ ktrace_nentries( ...@@ -246,15 +247,15 @@ ktrace_nentries(
* *
* The caller must pass in a pointer to a ktrace_snap * The caller must pass in a pointer to a ktrace_snap
* structure in which we will keep some state used to * 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. * by any code outside of this module.
*/ */
ktrace_entry_t * 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; ktrace_entry_t *ktep;
int index; int index;
int nentries; int nentries;
if (ktp->kt_rollover) if (ktp->kt_rollover)
index = ktp->kt_index; index = ktp->kt_index;
...@@ -288,11 +289,11 @@ ktrace_first(ktrace_t *ktp, ktrace_snap_t *ktsp) ...@@ -288,11 +289,11 @@ ktrace_first(ktrace_t *ktp, ktrace_snap_t *ktsp)
*/ */
ktrace_entry_t * ktrace_entry_t *
ktrace_next( ktrace_next(
ktrace_t *ktp, ktrace_t *ktp,
ktrace_snap_t *ktsp) ktrace_snap_t *ktsp)
{ {
int index; int index;
ktrace_entry_t *ktep; ktrace_entry_t *ktep;
index = ktsp->ks_index; index = ktsp->ks_index;
if (index == ktsp->ks_start) { if (index == ktsp->ks_start) {
...@@ -325,14 +326,14 @@ EXPORT_SYMBOL(ktrace_next); ...@@ -325,14 +326,14 @@ EXPORT_SYMBOL(ktrace_next);
ktrace_entry_t * ktrace_entry_t *
ktrace_skip( ktrace_skip(
ktrace_t *ktp, ktrace_t *ktp,
int count, int count,
ktrace_snap_t *ktsp) ktrace_snap_t *ktsp)
{ {
int index; int index;
int new_index; int new_index;
ktrace_entry_t *ktep; ktrace_entry_t *ktep;
int nentries = ktrace_nentries(ktp); int nentries = ktrace_nentries(ktp);
index = ktsp->ks_index; index = ktsp->ks_index;
new_index = index + count; new_index = index + count;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -90,15 +90,15 @@ extern void ktrace_enter( ...@@ -90,15 +90,15 @@ extern void ktrace_enter(
void *, void *,
void *); void *);
extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *); extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *);
extern int ktrace_nentries(ktrace_t *); extern int ktrace_nentries(ktrace_t *);
extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_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_skip(ktrace_t *, int, ktrace_snap_t *);
#else #else
#define ktrace_free(ktp) #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_enter(ktp,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15)
#endif #endif
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
/* /*
* Move "n" bytes at byte address "cp"; "rw" indicates the direction * 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 * 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. * a non-zero errno on failure.
*/ */
int int
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
typedef struct iovec iovec_t; typedef struct iovec iovec_t;
typedef struct uio { typedef struct uio {
iovec_t *uio_iov; /* pointer to array of iovecs */ iovec_t *uio_iov; /* pointer to array of iovecs */
int uio_iovcnt; /* number of iovecs */ int uio_iovcnt; /* number of iovecs */
int uio_fmode; /* file mode flags */ int uio_fmode; /* file mode flags */
xfs_off_t uio_offset; /* file offset */ xfs_off_t uio_offset; /* file offset */
short uio_segflg; /* address space (kernel or user) */ short uio_segflg; /* address space (kernel or user) */
ssize_t uio_resid; /* residual count */ ssize_t uio_resid; /* residual count */
} uio_t; } uio_t;
/* /*
...@@ -56,11 +56,11 @@ typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t; ...@@ -56,11 +56,11 @@ typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t;
* Segment flag values. * Segment flag values.
*/ */
typedef enum uio_seg { typedef enum uio_seg {
UIO_USERSPACE, /* uio_iov describes user space */ UIO_USERSPACE, /* uio_iov describes user space */
UIO_SYSSPACE, /* uio_iov describes system space */ UIO_SYSSPACE, /* uio_iov describes system space */
} uio_seg_t; } uio_seg_t;
extern int uiomove (void *, size_t, uio_rw_t, uio_t *); extern int uiomove (void *, size_t, uio_rw_t, uio_t *);
#endif /* __XFS_SUPPORT_MOVE_H__ */ #endif /* __XFS_SUPPORT_MOVE_H__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * 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 */ ...@@ -251,7 +251,7 @@ ismrlocked(mrlock_t *mrp, int type) /* No need to lock since info can change */
else if (type == MR_UPDATE) else if (type == MR_UPDATE)
return (mrp->mr_count < 0); /* Write lock */ return (mrp->mr_count < 0); /* Write lock */
else if (type == (MR_UPDATE | MR_ACCESS)) 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 */ else /* Any waiters */
return (mrp->mr_reads_waiting | mrp->mr_writes_waiting); return (mrp->mr_reads_waiting | mrp->mr_writes_waiting);
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -67,17 +67,17 @@ typedef struct mrlock_s { ...@@ -67,17 +67,17 @@ typedef struct mrlock_s {
extern void mraccessf(mrlock_t *, int); extern void mraccessf(mrlock_t *, int);
extern void mrupdatef(mrlock_t *, int); extern void mrupdatef(mrlock_t *, int);
extern void mrlock(mrlock_t *, int, int); extern void mrlock(mrlock_t *, int, int);
extern void mrunlock(mrlock_t *); extern void mrunlock(mrlock_t *);
extern void mraccunlock(mrlock_t *); extern void mraccunlock(mrlock_t *);
extern int mrtryupdate(mrlock_t *); extern int mrtryupdate(mrlock_t *);
extern int mrtryaccess(mrlock_t *); extern int mrtryaccess(mrlock_t *);
extern int mrtrypromote(mrlock_t *); extern int mrtrypromote(mrlock_t *);
extern void mrdemote(mrlock_t *); extern void mrdemote(mrlock_t *);
extern int ismrlocked(mrlock_t *, int); extern int ismrlocked(mrlock_t *, int);
extern void mrlock_init(mrlock_t *, int type, char *name, long sequence); extern void mrlock_init(mrlock_t *, int type, char *name, long sequence);
extern void mrfree(mrlock_t *); extern void mrfree(mrlock_t *);
#define mrinit(mrp, name) mrlock_init(mrp, MRLOCK_BARRIER, name, -1) #define mrinit(mrp, name) mrlock_init(mrp, MRLOCK_BARRIER, name, -1)
#define mraccess(mrp) mraccessf(mrp, 0) /* grab for READ/ACCESS */ #define mraccess(mrp) mraccessf(mrp, 0) /* grab for READ/ACCESS */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of 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. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
...@@ -55,12 +55,12 @@ typedef struct ...@@ -55,12 +55,12 @@ typedef struct
upper bound for log (total_elements): upper bound for log (total_elements):
bits per byte (CHAR_BIT) * sizeof(size_t). */ bits per byte (CHAR_BIT) * sizeof(size_t). */
#define STACK_SIZE (8 * sizeof(unsigned long int)) #define STACK_SIZE (8 * sizeof(unsigned long int))
#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++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 POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi)))
#define STACK_NOT_EMPTY (stack < top) #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: four optimizations discussed in Sedgewick:
1. Non-recursive, using an explicit stack of pointer that store the 1. Non-recursive, using an explicit stack of pointer that store the
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
typedef spinlock_t lock_t; typedef spinlock_t lock_t;
#define spinlock_init(lock, name) spin_lock_init(lock) #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) static inline unsigned long mutex_spinlock(lock_t *lock)
{ {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -51,7 +51,7 @@ typedef struct sv_s { ...@@ -51,7 +51,7 @@ typedef struct sv_s {
#define SV_LIFO 0x2 /* sv_t is LIFO type */ #define SV_LIFO 0x2 /* sv_t is LIFO type */
#define SV_PRIO 0x4 /* sv_t is PRIO type */ #define SV_PRIO 0x4 /* sv_t is PRIO type */
#define SV_KEYED 0x6 /* sv_t is KEYED 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, 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, ...@@ -76,7 +76,7 @@ static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state,
/*NOTHING*/ /*NOTHING*/
#define sv_wait(sv, pri, lock, s) \ #define sv_wait(sv, pri, lock, s) \
_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT) _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) _sv_wait(sv, lock, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT)
#define sv_timedwait(sv, pri, lock, s, svf, ts, rts) \ #define sv_timedwait(sv, pri, lock, s, svf, ts, rts) \
_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, timespec_to_jiffies(ts)) _sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, timespec_to_jiffies(ts))
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
/* /*
* 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 * 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 * under the terms of version 2 of the GNU General Public License as
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -31,58 +31,22 @@ ...@@ -31,58 +31,22 @@
*/ */
#include <linux/types.h> #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_types.h>
#include <xfs_arch.h> #include <xfs_arch.h>
#include "time.h" #include "time.h"
#include "move.h"
#include "uuid.h" #include "uuid.h"
#include "kmem.h"
#include "debug.h"
#include "mutex.h"
#ifndef CONFIG_NET static mutex_t uuid_monitor;
#define dev_get_by_name(x) (NULL) static int uuid_table_size;
#define dev_put(x) do { } while (0) static uuid_t *uuid_table;
#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 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 void
uuid_init(void) uuid_init(void)
{ {
mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor");
} }
/* /*
...@@ -94,7 +58,7 @@ uuid_init(void) ...@@ -94,7 +58,7 @@ uuid_init(void)
void void
uuid_getnodeuniq(uuid_t *uuid, int fsid [2]) 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 /* on IRIX, this function assumes big-endian fields within
* the uuid, so we use INT_GET to get the same result on * the uuid, so we use INT_GET to get the same result on
...@@ -119,24 +83,24 @@ uuid_is_nil(uuid_t *uuid) ...@@ -119,24 +83,24 @@ uuid_is_nil(uuid_t *uuid)
char *cp = (char *)uuid; char *cp = (char *)uuid;
if (uuid == NULL) if (uuid == NULL)
return B_TRUE; return 0;
/* implied check of version number here... */ /* implied check of version number here... */
for (i = 0; i < sizeof *uuid; i++) for (i = 0; i < sizeof *uuid; i++)
if (*cp++) return B_FALSE; /* not nil */ if (*cp++) return 0; /* not nil */
return B_TRUE; /* is nil */ return 1; /* is nil */
} }
int int
uuid_equal(uuid_t *uuid1, uuid_t *uuid2) 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 * 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 * 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. * filehandle.
*/ */
__uint64_t __uint64_t
...@@ -145,94 +109,50 @@ uuid_hash64(uuid_t *uuid) ...@@ -145,94 +109,50 @@ uuid_hash64(uuid_t *uuid)
__uint64_t *sp = (__uint64_t *)uuid; __uint64_t *sp = (__uint64_t *)uuid;
return sp[0] + sp[1]; 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
} }
/* int
* uuid_create - kernel version, does the actual work uuid_table_insert(uuid_t *uuid)
*/
void
uuid_create(uuid_t *uuid)
{ {
int i; int i, hole;
uu_t *uu = (uu_t *)uuid;
static int uuid_have_eaddr = 0; /* ethernet addr inited? */ mutex_lock(&uuid_monitor, PVFS);
static int uuid_is_init = 0; /* time/clockseq inited? */ for (i = 0, hole = -1; i < uuid_table_size; i++) {
if (uuid_is_nil(&uuid_table[i])) {
down(&uuid_lock); hole = i;
if (!uuid_is_init) { continue;
timespec_t ts; }
if (uuid_equal(uuid, &uuid_table[i])) {
nanotime(&ts); mutex_unlock(&uuid_monitor);
/* return 0;
* 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;
} }
if (!uuid_have_eaddr) { if (hole < 0) {
uuid_have_eaddr = 1; uuid_table = kmem_realloc(uuid_table,
get_eaddr((char *)uuid_eaddr); (uuid_table_size + 1) * sizeof(*uuid_table),
uuid_table_size * sizeof(*uuid_table),
KM_SLEEP);
hole = uuid_table_size++;
} }
uuid_time++; uuid_table[hole] = *uuid;
uu->uu_timelow = (u_int32_t)(uuid_time & 0x00000000ffffffffLL); mutex_unlock(&uuid_monitor);
uu->uu_timemid = (u_int16_t)((uuid_time >> 32) & 0x0000ffff); return 1;
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];
} }
int void
uuid_compare(uuid_t *uuid1, uuid_t *uuid2) uuid_table_remove(uuid_t *uuid)
{ {
int i; 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... */ mutex_lock(&uuid_monitor, PVFS);
for (i = 0; i < sizeof(uuid_t); i++) { for (i = 0; i < uuid_table_size; i++) {
if (*cp1 < *cp2) if (uuid_is_nil(&uuid_table[i]))
return -1; continue;
if (*cp1++ > *cp2++) if (!uuid_equal(uuid, &uuid_table[i]))
return 1; continue;
uuid_create_nil(&uuid_table[i]);
break;
} }
return 0; /* they're equal */ ASSERT(i < uuid_table_size);
mutex_unlock(&uuid_monitor);
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -36,10 +36,13 @@ typedef struct { ...@@ -36,10 +36,13 @@ typedef struct {
unsigned char __u_bits[16]; unsigned char __u_bits[16];
} uuid_t; } uuid_t;
void uuid_init(void);
void uuid_create_nil(uuid_t *uuid); void uuid_create_nil(uuid_t *uuid);
int uuid_is_nil(uuid_t *uuid); int uuid_is_nil(uuid_t *uuid);
int uuid_equal(uuid_t *uuid1, uuid_t *uuid2); int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]); void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
__uint64_t uuid_hash64(uuid_t *uuid); __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__ */ #endif /* __XFS_SUPPORT_UUID_H__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#ifndef __XFS_H__ #ifndef __XFS_H__
#define __XFS_H__ #define __XFS_H__
#include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/config.h>
#include <xfs_types.h> #include <xfs_types.h>
#include <xfs_arch.h> #include <xfs_arch.h>
#include <support/kmem.h> #include <support/kmem.h>
...@@ -53,56 +53,7 @@ ...@@ -53,56 +53,7 @@
#include <linux/xfs_linux.h> #include <linux/xfs_linux.h>
#include <xfs_fs.h> #include <xfs_fs.h>
#include <xfs_buf.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__ */ #endif /* __XFS_H__ */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,11 +30,28 @@ ...@@ -30,11 +30,28 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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> #include <linux/posix_acl_xattr.h>
STATIC int xfs_acl_setmode(vnode_t *, xfs_acl_t *, int *); 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 void xfs_acl_get_endian(xfs_acl_t *);
STATIC int xfs_acl_access(uid_t, gid_t, xfs_acl_t *, mode_t, cred_t *); STATIC int xfs_acl_access(uid_t, gid_t, xfs_acl_t *, mode_t, cred_t *);
STATIC int xfs_acl_invalid(xfs_acl_t *); STATIC int xfs_acl_invalid(xfs_acl_t *);
...@@ -146,7 +163,7 @@ xfs_acl_entry_compare( ...@@ -146,7 +163,7 @@ xfs_acl_entry_compare(
const void *va, const void *va,
const void *vb) 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; *b = (xfs_acl_entry_t *)vb;
if (a->ae_tag == b->ae_tag) if (a->ae_tag == b->ae_tag)
...@@ -233,7 +250,7 @@ xfs_acl_vget( ...@@ -233,7 +250,7 @@ xfs_acl_vget(
goto out; goto out;
} }
if (kind == _ACL_TYPE_ACCESS) { if (kind == _ACL_TYPE_ACCESS) {
vattr_t va; vattr_t va;
va.va_mask = XFS_AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); VOP_GETATTR(vp, &va, 0, sys_cred, error);
...@@ -317,7 +334,7 @@ xfs_acl_vset( ...@@ -317,7 +334,7 @@ xfs_acl_vset(
} else { } else {
xfs_acl_vremove(vp, _ACL_TYPE_ACCESS); xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
} }
out: out:
VN_RELE(vp); VN_RELE(vp);
...@@ -437,7 +454,7 @@ xfs_acl_capability_check( ...@@ -437,7 +454,7 @@ xfs_acl_capability_check(
return EACCES; return EACCES;
if ((mode & ACL_EXECUTE) && if ((mode & ACL_EXECUTE) &&
(!capable_cred(cr, CAP_DAC_OVERRIDE) || (!capable_cred(cr, CAP_DAC_OVERRIDE) ||
!xfs_acl_find_any_exec(fap))) { !xfs_acl_find_any_exec(fap))) {
return EACCES; return EACCES;
} }
...@@ -446,9 +463,9 @@ xfs_acl_capability_check( ...@@ -446,9 +463,9 @@ xfs_acl_capability_check(
/* /*
* Note: cr is only used here for the capability check if the ACL test fails. * 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 * 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 * done in IRIX. It is assumed that the uid and groups for the current
* thread are taken from "current" instead of the cr parameter. * thread are taken from "current" instead of the cr parameter.
*/ */
STATIC int STATIC int
xfs_acl_access( xfs_acl_access(
...@@ -458,7 +475,7 @@ xfs_acl_access( ...@@ -458,7 +475,7 @@ xfs_acl_access(
mode_t md, mode_t md,
cred_t *cr) cred_t *cr)
{ {
xfs_acl_entry_t matched; xfs_acl_entry_t matched;
int i, allows; int i, allows;
int maskallows = -1; /* true, but not 1, either */ int maskallows = -1; /* true, but not 1, either */
int seen_userobj = 0; int seen_userobj = 0;
...@@ -557,7 +574,7 @@ STATIC int ...@@ -557,7 +574,7 @@ STATIC int
xfs_acl_invalid( xfs_acl_invalid(
xfs_acl_t *aclp) 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 user = 0, group = 0, other = 0, mask = 0;
int mask_required = 0; int mask_required = 0;
int i, j; int i, j;
...@@ -616,7 +633,7 @@ STATIC void ...@@ -616,7 +633,7 @@ STATIC void
xfs_acl_get_endian( xfs_acl_get_endian(
xfs_acl_t *aclp) 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); INT_SET(aclp->acl_cnt, ARCH_CONVERT, aclp->acl_cnt);
end = &aclp->acl_entry[0]+aclp->acl_cnt; end = &aclp->acl_entry[0]+aclp->acl_cnt;
...@@ -659,7 +676,7 @@ xfs_acl_set_attr( ...@@ -659,7 +676,7 @@ xfs_acl_set_attr(
int kind, int kind,
int *error) int *error)
{ {
xfs_acl_entry_t *ace, *newace, *end; xfs_acl_entry_t *ace, *newace, *end;
xfs_acl_t *newacl; xfs_acl_t *newacl;
int len; int len;
...@@ -759,7 +776,7 @@ xfs_acl_inherit( ...@@ -759,7 +776,7 @@ xfs_acl_inherit(
xfs_acl_setmode(vp, cacl, &basicperms); 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. * 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 * If the new file is a directory, its default ACL is a copy of
...@@ -787,8 +804,8 @@ xfs_acl_setmode( ...@@ -787,8 +804,8 @@ xfs_acl_setmode(
int *basicperms) int *basicperms)
{ {
vattr_t va; vattr_t va;
xfs_acl_entry_t *ap; xfs_acl_entry_t *ap;
xfs_acl_entry_t *gap = NULL; xfs_acl_entry_t *gap = NULL;
int i, error, nomask = 1; int i, error, nomask = 1;
*basicperms = 1; *basicperms = 1;
...@@ -858,16 +875,16 @@ xfs_acl_setmode( ...@@ -858,16 +875,16 @@ xfs_acl_setmode(
* most accurately reflects what the special ACL entries should permit/deny. * most accurately reflects what the special ACL entries should permit/deny.
* *
* CAVEAT: If someone sets the SGI_ACL_FILE attribute directly, * CAVEAT: If someone sets the SGI_ACL_FILE attribute directly,
* the existing mode bits will override whatever is in the * the existing mode bits will override whatever is in the
* ACL. Similarly, if there is a pre-existing ACL that was * 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 * never in sync with its mode (owing to a bug in 6.5 and
* before), it will now magically (or mystically) be * before), it will now magically (or mystically) be
* synchronized. This could cause slight astonishment, but * synchronized. This could cause slight astonishment, but
* it is better than inconsistent permissions. * it is better than inconsistent permissions.
* *
* The supplied ACL is a template that may contain any combination * The supplied ACL is a template that may contain any combination
* of special entries. These are treated as place holders when we fill * 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 * out the ACL. This routine does not add or remove special entries, it
* simply unites each special entry with its associated set of permissions. * simply unites each special entry with its associated set of permissions.
*/ */
STATIC void STATIC void
...@@ -876,8 +893,8 @@ xfs_acl_sync_mode( ...@@ -876,8 +893,8 @@ xfs_acl_sync_mode(
xfs_acl_t *acl) xfs_acl_t *acl)
{ {
int i, nomask = 1; int i, nomask = 1;
xfs_acl_entry_t *ap; xfs_acl_entry_t *ap;
xfs_acl_entry_t *gap = NULL; xfs_acl_entry_t *gap = NULL;
/* /*
* Set ACL entries. POSIX1003.1eD16 requires that the MASK * Set ACL entries. POSIX1003.1eD16 requires that the MASK
...@@ -920,8 +937,8 @@ xfs_acl_filter_mode( ...@@ -920,8 +937,8 @@ xfs_acl_filter_mode(
xfs_acl_t *acl) xfs_acl_t *acl)
{ {
int i, nomask = 1; int i, nomask = 1;
xfs_acl_entry_t *ap; xfs_acl_entry_t *ap;
xfs_acl_entry_t *gap = NULL; xfs_acl_entry_t *gap = NULL;
/* /*
* Set ACL entries. POSIX1003.1eD16 requires that the MASK * Set ACL entries. POSIX1003.1eD16 requires that the MASK
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -51,12 +51,12 @@ typedef struct xfs_acl_entry { ...@@ -51,12 +51,12 @@ typedef struct xfs_acl_entry {
typedef struct xfs_acl { typedef struct xfs_acl {
__int32_t acl_cnt; __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; } xfs_acl_t;
/* On-disk XFS extended attribute names */ /* On-disk XFS extended attribute names */
#define SGI_ACL_FILE "SGI_ACL_FILE" #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_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
...@@ -84,7 +84,7 @@ extern struct kmem_zone *xfs_acl_zone; ...@@ -84,7 +84,7 @@ extern struct kmem_zone *xfs_acl_zone;
#define _ACL_TYPE_ACCESS 1 #define _ACL_TYPE_ACCESS 1
#define _ACL_TYPE_DEFAULT 2 #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_DECL(a) xfs_acl_t *(a) = NULL
#define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP)) #define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP))
...@@ -93,7 +93,7 @@ extern struct kmem_zone *xfs_acl_zone; ...@@ -93,7 +93,7 @@ extern struct kmem_zone *xfs_acl_zone;
#define _ACL_ZONE_DESTROY(z) (kmem_cache_destroy(z)) #define _ACL_ZONE_DESTROY(z) (kmem_cache_destroy(z))
#define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d)) #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_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_ACCESS_EXISTS xfs_acl_vhasacl_access
#define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default #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) #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; ...@@ -109,7 +109,7 @@ extern struct kmem_zone *xfs_acl_zone;
#define _ACL_ZONE_DESTROY(z) ((void)0) #define _ACL_ZONE_DESTROY(z) ((void)0)
#define _ACL_INHERIT(c,v,d) (0) #define _ACL_INHERIT(c,v,d) (0)
#define _ACL_GET_ACCESS(pv,pa) (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_ACCESS_EXISTS (NULL)
#define _ACL_DEFAULT_EXISTS (NULL) #define _ACL_DEFAULT_EXISTS (NULL)
#define _ACL_XFS_IACCESS(i,m,c) (-1) #define _ACL_XFS_IACCESS(i,m,c) (-1)
......
This diff is collapsed.
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef __XFS_ALLOC_H__ #ifndef __XFS_ALLOC_H__
#define __XFS_ALLOC_H__ #define __XFS_ALLOC_H__
struct xfs_buf; struct xfs_buf;
struct xfs_mount; struct xfs_mount;
...@@ -38,7 +38,7 @@ struct xfs_perag; ...@@ -38,7 +38,7 @@ struct xfs_perag;
struct xfs_trans; 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 typedef enum xfs_alloctype
{ {
...@@ -54,7 +54,7 @@ typedef enum xfs_alloctype ...@@ -54,7 +54,7 @@ typedef enum xfs_alloctype
/* /*
* Flags for xfs_alloc_fix_freelist. * Flags for xfs_alloc_fix_freelist.
*/ */
#define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */ #define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */
/* /*
* Argument structure for xfs_alloc routines. * Argument structure for xfs_alloc routines.
...@@ -78,8 +78,8 @@ typedef struct xfs_alloc_arg { ...@@ -78,8 +78,8 @@ typedef struct xfs_alloc_arg {
xfs_extlen_t alignment; /* align answer to multiple of this */ xfs_extlen_t alignment; /* align answer to multiple of this */
xfs_extlen_t minalignslop; /* slop for minlen+alignment calcs */ xfs_extlen_t minalignslop; /* slop for minlen+alignment calcs */
xfs_extlen_t len; /* output: actual size of extent */ xfs_extlen_t len; /* output: actual size of extent */
xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */ xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */
xfs_alloctype_t otype; /* original allocation type */ xfs_alloctype_t otype; /* original allocation type */
char wasdel; /* set if allocation was prev delayed */ char wasdel; /* set if allocation was prev delayed */
char wasfromfl; /* set if allocation is from freelist */ char wasfromfl; /* set if allocation is from freelist */
char isfl; /* set if is freelist blocks - !actg */ char isfl; /* set if is freelist blocks - !actg */
...@@ -98,21 +98,21 @@ typedef struct xfs_alloc_arg { ...@@ -98,21 +98,21 @@ typedef struct xfs_alloc_arg {
/* /*
* Types for alloc tracing. * Types for alloc tracing.
*/ */
#define XFS_ALLOC_KTRACE_ALLOC 1 #define XFS_ALLOC_KTRACE_ALLOC 1
#define XFS_ALLOC_KTRACE_FREE 2 #define XFS_ALLOC_KTRACE_FREE 2
#define XFS_ALLOC_KTRACE_MODAGF 3 #define XFS_ALLOC_KTRACE_MODAGF 3
#define XFS_ALLOC_KTRACE_BUSY 4 #define XFS_ALLOC_KTRACE_BUSY 4
#define XFS_ALLOC_KTRACE_UNBUSY 5 #define XFS_ALLOC_KTRACE_UNBUSY 5
#define XFS_ALLOC_KTRACE_BUSYSEARCH 6 #define XFS_ALLOC_KTRACE_BUSYSEARCH 6
/* /*
* Allocation tracing buffer size. * Allocation tracing buffer size.
*/ */
#define XFS_ALLOC_TRACE_SIZE 4096 #define XFS_ALLOC_TRACE_SIZE 4096
#ifdef XFS_ALL_TRACE #ifdef XFS_ALL_TRACE
#define XFS_ALLOC_TRACE #define XFS_ALLOC_TRACE
#endif #endif
#if !defined(DEBUG) #if !defined(DEBUG)
...@@ -138,7 +138,7 @@ int /* error */ ...@@ -138,7 +138,7 @@ int /* error */
xfs_alloc_get_freelist( xfs_alloc_get_freelist(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
struct xfs_buf *agbp, /* buffer containing the agf structure */ 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. * Log the given fields from the agf structure.
...@@ -157,7 +157,7 @@ xfs_alloc_pagf_init( ...@@ -157,7 +157,7 @@ xfs_alloc_pagf_init(
struct xfs_mount *mp, /* file system mount structure */ struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */ 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. * Put the block on the freelist for the allocation group.
...@@ -185,7 +185,7 @@ xfs_alloc_read_agf( ...@@ -185,7 +185,7 @@ xfs_alloc_read_agf(
*/ */
int /* error */ int /* error */
xfs_alloc_vextent( xfs_alloc_vextent(
xfs_alloc_arg_t *args); /* allocation argument structure */ xfs_alloc_arg_t *args); /* allocation argument structure */
/* /*
* Free an extent. * Free an extent.
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef __XFS_ALLOC_BTREE_H__ #ifndef __XFS_ALLOC_BTREE_H__
#define __XFS_ALLOC_BTREE_H__ #define __XFS_ALLOC_BTREE_H__
/* /*
* Freespace on-disk structures * Freespace on-disk structures
...@@ -46,8 +46,8 @@ struct xfs_mount; ...@@ -46,8 +46,8 @@ struct xfs_mount;
* by blockcount and blockno. All blocks look the same to make the code * by blockcount and blockno. All blocks look the same to make the code
* simpler; if we have time later, we'll make the optimizations. * simpler; if we have time later, we'll make the optimizations.
*/ */
#define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */ #define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */
#define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */ #define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */
/* /*
* Data record/key structure * Data record/key structure
...@@ -60,13 +60,13 @@ typedef struct xfs_alloc_rec ...@@ -60,13 +60,13 @@ typedef struct xfs_alloc_rec
typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */ typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */
/* btree block header 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) #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); 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 #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 #endif
/* /*
...@@ -75,23 +75,23 @@ xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp); ...@@ -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) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_SIZE)
int xfs_alloc_block_size(int lev, struct xfs_btree_cur *cur); 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 #else
#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) #define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif #endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS)
int xfs_alloc_block_maxrecs(int lev, struct xfs_btree_cur *cur); 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 #else
#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \ #define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mxr[lev != 0]) ((cur)->bc_mp->m_alloc_mxr[lev != 0])
#endif #endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS)
int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur); 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 #else
#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \ #define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mnr[lev != 0]) ((cur)->bc_mp->m_alloc_mnr[lev != 0])
#endif #endif
...@@ -115,15 +115,15 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur); ...@@ -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) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
xfs_agblock_t xfs_bno_block(struct xfs_mount *mp); 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 #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 #endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK) #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK)
xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp); 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 #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 #endif
/* /*
...@@ -132,9 +132,9 @@ xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp); ...@@ -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) #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, xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur); 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 #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_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(0, cur)) XFS_ALLOC_BLOCK_MAXRECS(0, cur))
#endif #endif
...@@ -142,9 +142,9 @@ xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i, ...@@ -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) #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, xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur); 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 #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_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur)) XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif #endif
...@@ -152,9 +152,9 @@ xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i, ...@@ -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) #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, xfs_alloc_ptr_t *xfs_alloc_ptr_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur); 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 #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_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur)) XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif #endif
...@@ -171,7 +171,7 @@ int /* error */ ...@@ -171,7 +171,7 @@ int /* error */
xfs_alloc_decrement( xfs_alloc_decrement(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */ int level, /* level in btree, 0 is leaf */
int *stat); /* success/failure */ int *stat); /* success/failure */
/* /*
* Delete the record pointed to by cur. * Delete the record pointed to by cur.
...@@ -181,7 +181,7 @@ xfs_alloc_decrement( ...@@ -181,7 +181,7 @@ xfs_alloc_decrement(
int /* error */ int /* error */
xfs_alloc_delete( xfs_alloc_delete(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
int *stat); /* success/failure */ int *stat); /* success/failure */
/* /*
* Get the data from the pointed-to record. * Get the data from the pointed-to record.
...@@ -191,7 +191,7 @@ xfs_alloc_get_rec( ...@@ -191,7 +191,7 @@ xfs_alloc_get_rec(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t *bno, /* output: starting block of extent */ xfs_agblock_t *bno, /* output: starting block of extent */
xfs_extlen_t *len, /* output: length 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. * Increment cursor by one record at the level.
...@@ -201,7 +201,7 @@ int /* error */ ...@@ -201,7 +201,7 @@ int /* error */
xfs_alloc_increment( xfs_alloc_increment(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */ 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. * Insert the current record at the point referenced by cur.
...@@ -210,7 +210,7 @@ xfs_alloc_increment( ...@@ -210,7 +210,7 @@ xfs_alloc_increment(
int /* error */ int /* error */
xfs_alloc_insert( xfs_alloc_insert(
struct xfs_btree_cur *cur, /* btree cursor */ 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. * Lookup the record equal to [bno, len] in the btree given by cur.
...@@ -220,7 +220,7 @@ xfs_alloc_lookup_eq( ...@@ -220,7 +220,7 @@ xfs_alloc_lookup_eq(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */ xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length 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] * Lookup the first record greater than or equal to [bno, len]
...@@ -231,7 +231,7 @@ xfs_alloc_lookup_ge( ...@@ -231,7 +231,7 @@ xfs_alloc_lookup_ge(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */ xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length 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] * Lookup the first record less than or equal to [bno, len]
...@@ -242,7 +242,7 @@ xfs_alloc_lookup_le( ...@@ -242,7 +242,7 @@ xfs_alloc_lookup_le(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */ xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length 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]. * Update the record referred to by cur, to the value given by [bno, len].
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
......
This diff is collapsed.
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Further, this software is distributed without any warranty that it is * Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement * 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 * otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with * any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever. * other software, or any other product whatsoever.
...@@ -30,7 +30,36 @@ ...@@ -30,7 +30,36 @@
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * 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 int
xfs_attr_fetch(xfs_inode_t *ip, char *name, char *value, int valuelen) xfs_attr_fetch(xfs_inode_t *ip, char *name, char *value, int valuelen)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment