Commit 36f392d0 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  Long btree pointers are still 64 bit on disk
  [XFS] Remove the rest of the macro-to-function indirections.
  xfs: sanity check attr fork size
  xfs: fix bad_features2 fixups for the root filesystem
  xfs: add a lock class for group/project dquots
  xfs: lockdep annotations for xfs_dqlock2
  xfs: add a separate lock class for the per-mount list of dquots
  xfs: use mnt_want_write in compat_attrmulti ioctl
  xfs: fix dentry aliasing issues in open_by_handle
parents 6c31e7ee 74e2d065
config XFS_FS config XFS_FS
tristate "XFS filesystem support" tristate "XFS filesystem support"
depends on BLOCK depends on BLOCK
select EXPORTFS
help help
XFS is a high performance journaling filesystem which originated XFS is a high performance journaling filesystem which originated
on the SGI IRIX platform. It is completely multi-threaded, can on the SGI IRIX platform. It is completely multi-threaded, can
......
This diff is collapsed.
...@@ -34,16 +34,13 @@ xfs_find_handle( ...@@ -34,16 +34,13 @@ xfs_find_handle(
extern int extern int
xfs_open_by_handle( xfs_open_by_handle(
xfs_mount_t *mp,
xfs_fsop_handlereq_t *hreq,
struct file *parfilp, struct file *parfilp,
struct inode *parinode); xfs_fsop_handlereq_t *hreq);
extern int extern int
xfs_readlink_by_handle( xfs_readlink_by_handle(
xfs_mount_t *mp, struct file *parfilp,
xfs_fsop_handlereq_t *hreq, xfs_fsop_handlereq_t *hreq);
struct inode *parinode);
extern int extern int
xfs_attrmulti_attr_get( xfs_attrmulti_attr_get(
...@@ -67,6 +64,12 @@ xfs_attrmulti_attr_remove( ...@@ -67,6 +64,12 @@ xfs_attrmulti_attr_remove(
char *name, char *name,
__uint32_t flags); __uint32_t flags);
extern struct dentry *
xfs_handle_to_dentry(
struct file *parfilp,
void __user *uhandle,
u32 hlen);
extern long extern long
xfs_file_ioctl( xfs_file_ioctl(
struct file *filp, struct file *filp,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/mount.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
...@@ -340,96 +341,24 @@ xfs_compat_handlereq_copyin( ...@@ -340,96 +341,24 @@ xfs_compat_handlereq_copyin(
return 0; return 0;
} }
/* STATIC struct dentry *
* Convert userspace handle data into inode. xfs_compat_handlereq_to_dentry(
* struct file *parfilp,
* We use the fact that all the fsop_handlereq ioctl calls have a data compat_xfs_fsop_handlereq_t *hreq)
* structure argument whose first component is always a xfs_fsop_handlereq_t,
* so we can pass that sub structure into this handy, shared routine.
*
* If no error, caller must always iput the returned inode.
*/
STATIC int
xfs_vget_fsop_handlereq_compat(
xfs_mount_t *mp,
struct inode *parinode, /* parent inode pointer */
compat_xfs_fsop_handlereq_t *hreq,
struct inode **inode)
{ {
void __user *hanp; return xfs_handle_to_dentry(parfilp,
size_t hlen; compat_ptr(hreq->ihandle), hreq->ihandlen);
xfs_fid_t *xfid;
xfs_handle_t *handlep;
xfs_handle_t handle;
xfs_inode_t *ip;
xfs_ino_t ino;
__u32 igen;
int error;
/*
* Only allow handle opens under a directory.
*/
if (!S_ISDIR(parinode->i_mode))
return XFS_ERROR(ENOTDIR);
hanp = compat_ptr(hreq->ihandle);
hlen = hreq->ihandlen;
handlep = &handle;
if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep))
return XFS_ERROR(EINVAL);
if (copy_from_user(handlep, hanp, hlen))
return XFS_ERROR(EFAULT);
if (hlen < sizeof(*handlep))
memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
if (hlen > sizeof(handlep->ha_fsid)) {
if (handlep->ha_fid.fid_len !=
(hlen - sizeof(handlep->ha_fsid) -
sizeof(handlep->ha_fid.fid_len)) ||
handlep->ha_fid.fid_pad)
return XFS_ERROR(EINVAL);
}
/*
* Crack the handle, obtain the inode # & generation #
*/
xfid = (struct xfs_fid *)&handlep->ha_fid;
if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) {
ino = xfid->fid_ino;
igen = xfid->fid_gen;
} else {
return XFS_ERROR(EINVAL);
}
/*
* Get the XFS inode, building a Linux inode to go with it.
*/
error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0);
if (error)
return error;
if (ip == NULL)
return XFS_ERROR(EIO);
if (ip->i_d.di_gen != igen) {
xfs_iput_new(ip, XFS_ILOCK_SHARED);
return XFS_ERROR(ENOENT);
}
xfs_iunlock(ip, XFS_ILOCK_SHARED);
*inode = VFS_I(ip);
return 0;
} }
STATIC int STATIC int
xfs_compat_attrlist_by_handle( xfs_compat_attrlist_by_handle(
xfs_mount_t *mp, struct file *parfilp,
void __user *arg, void __user *arg)
struct inode *parinode)
{ {
int error; int error;
attrlist_cursor_kern_t *cursor; attrlist_cursor_kern_t *cursor;
compat_xfs_fsop_attrlist_handlereq_t al_hreq; compat_xfs_fsop_attrlist_handlereq_t al_hreq;
struct inode *inode; struct dentry *dentry;
char *kbuf; char *kbuf;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -446,17 +375,17 @@ xfs_compat_attrlist_by_handle( ...@@ -446,17 +375,17 @@ xfs_compat_attrlist_by_handle(
if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
return -XFS_ERROR(EINVAL); return -XFS_ERROR(EINVAL);
error = xfs_vget_fsop_handlereq_compat(mp, parinode, &al_hreq.hreq, dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq);
&inode); if (IS_ERR(dentry))
if (error) return PTR_ERR(dentry);
goto out;
error = -ENOMEM;
kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL); kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL);
if (!kbuf) if (!kbuf)
goto out_vn_rele; goto out_dput;
cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen, error = -xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
al_hreq.flags, cursor); al_hreq.flags, cursor);
if (error) if (error)
goto out_kfree; goto out_kfree;
...@@ -466,22 +395,20 @@ xfs_compat_attrlist_by_handle( ...@@ -466,22 +395,20 @@ xfs_compat_attrlist_by_handle(
out_kfree: out_kfree:
kfree(kbuf); kfree(kbuf);
out_vn_rele: out_dput:
iput(inode); dput(dentry);
out: return error;
return -error;
} }
STATIC int STATIC int
xfs_compat_attrmulti_by_handle( xfs_compat_attrmulti_by_handle(
xfs_mount_t *mp, struct file *parfilp,
void __user *arg, void __user *arg)
struct inode *parinode)
{ {
int error; int error;
compat_xfs_attr_multiop_t *ops; compat_xfs_attr_multiop_t *ops;
compat_xfs_fsop_attrmulti_handlereq_t am_hreq; compat_xfs_fsop_attrmulti_handlereq_t am_hreq;
struct inode *inode; struct dentry *dentry;
unsigned int i, size; unsigned int i, size;
char *attr_name; char *attr_name;
...@@ -491,20 +418,19 @@ xfs_compat_attrmulti_by_handle( ...@@ -491,20 +418,19 @@ xfs_compat_attrmulti_by_handle(
sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) sizeof(compat_xfs_fsop_attrmulti_handlereq_t)))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
error = xfs_vget_fsop_handlereq_compat(mp, parinode, &am_hreq.hreq, dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq);
&inode); if (IS_ERR(dentry))
if (error) return PTR_ERR(dentry);
goto out;
error = E2BIG; error = E2BIG;
size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t); size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t);
if (!size || size > 16 * PAGE_SIZE) if (!size || size > 16 * PAGE_SIZE)
goto out_vn_rele; goto out_dput;
error = ENOMEM; error = ENOMEM;
ops = kmalloc(size, GFP_KERNEL); ops = kmalloc(size, GFP_KERNEL);
if (!ops) if (!ops)
goto out_vn_rele; goto out_dput;
error = EFAULT; error = EFAULT;
if (copy_from_user(ops, compat_ptr(am_hreq.ops), size)) if (copy_from_user(ops, compat_ptr(am_hreq.ops), size))
...@@ -527,20 +453,29 @@ xfs_compat_attrmulti_by_handle( ...@@ -527,20 +453,29 @@ xfs_compat_attrmulti_by_handle(
switch (ops[i].am_opcode) { switch (ops[i].am_opcode) {
case ATTR_OP_GET: case ATTR_OP_GET:
ops[i].am_error = xfs_attrmulti_attr_get(inode, ops[i].am_error = xfs_attrmulti_attr_get(
attr_name, dentry->d_inode, attr_name,
compat_ptr(ops[i].am_attrvalue), compat_ptr(ops[i].am_attrvalue),
&ops[i].am_length, ops[i].am_flags); &ops[i].am_length, ops[i].am_flags);
break; break;
case ATTR_OP_SET: case ATTR_OP_SET:
ops[i].am_error = xfs_attrmulti_attr_set(inode, ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
attr_name, if (ops[i].am_error)
break;
ops[i].am_error = xfs_attrmulti_attr_set(
dentry->d_inode, attr_name,
compat_ptr(ops[i].am_attrvalue), compat_ptr(ops[i].am_attrvalue),
ops[i].am_length, ops[i].am_flags); ops[i].am_length, ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt);
break; break;
case ATTR_OP_REMOVE: case ATTR_OP_REMOVE:
ops[i].am_error = xfs_attrmulti_attr_remove(inode, ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
attr_name, ops[i].am_flags); if (ops[i].am_error)
break;
ops[i].am_error = xfs_attrmulti_attr_remove(
dentry->d_inode, attr_name,
ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt);
break; break;
default: default:
ops[i].am_error = EINVAL; ops[i].am_error = EINVAL;
...@@ -553,22 +488,20 @@ xfs_compat_attrmulti_by_handle( ...@@ -553,22 +488,20 @@ xfs_compat_attrmulti_by_handle(
kfree(attr_name); kfree(attr_name);
out_kfree_ops: out_kfree_ops:
kfree(ops); kfree(ops);
out_vn_rele: out_dput:
iput(inode); dput(dentry);
out:
return -error; return -error;
} }
STATIC int STATIC int
xfs_compat_fssetdm_by_handle( xfs_compat_fssetdm_by_handle(
xfs_mount_t *mp, struct file *parfilp,
void __user *arg, void __user *arg)
struct inode *parinode)
{ {
int error; int error;
struct fsdmidata fsd; struct fsdmidata fsd;
compat_xfs_fsop_setdm_handlereq_t dmhreq; compat_xfs_fsop_setdm_handlereq_t dmhreq;
struct inode *inode; struct dentry *dentry;
if (!capable(CAP_MKNOD)) if (!capable(CAP_MKNOD))
return -XFS_ERROR(EPERM); return -XFS_ERROR(EPERM);
...@@ -576,12 +509,11 @@ xfs_compat_fssetdm_by_handle( ...@@ -576,12 +509,11 @@ xfs_compat_fssetdm_by_handle(
sizeof(compat_xfs_fsop_setdm_handlereq_t))) sizeof(compat_xfs_fsop_setdm_handlereq_t)))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
error = xfs_vget_fsop_handlereq_compat(mp, parinode, &dmhreq.hreq, dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
&inode); if (IS_ERR(dentry))
if (error) return PTR_ERR(dentry);
return -error;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
error = -XFS_ERROR(EPERM); error = -XFS_ERROR(EPERM);
goto out; goto out;
} }
...@@ -591,11 +523,11 @@ xfs_compat_fssetdm_by_handle( ...@@ -591,11 +523,11 @@ xfs_compat_fssetdm_by_handle(
goto out; goto out;
} }
error = -xfs_set_dmattrs(XFS_I(inode), fsd.fsd_dmevmask, error = -xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
fsd.fsd_dmstate); fsd.fsd_dmstate);
out: out:
iput(inode); dput(dentry);
return error; return error;
} }
...@@ -722,21 +654,21 @@ xfs_file_compat_ioctl( ...@@ -722,21 +654,21 @@ xfs_file_compat_ioctl(
if (xfs_compat_handlereq_copyin(&hreq, arg)) if (xfs_compat_handlereq_copyin(&hreq, arg))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
return xfs_open_by_handle(mp, &hreq, filp, inode); return xfs_open_by_handle(filp, &hreq);
} }
case XFS_IOC_READLINK_BY_HANDLE_32: { case XFS_IOC_READLINK_BY_HANDLE_32: {
struct xfs_fsop_handlereq hreq; struct xfs_fsop_handlereq hreq;
if (xfs_compat_handlereq_copyin(&hreq, arg)) if (xfs_compat_handlereq_copyin(&hreq, arg))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
return xfs_readlink_by_handle(mp, &hreq, inode); return xfs_readlink_by_handle(filp, &hreq);
} }
case XFS_IOC_ATTRLIST_BY_HANDLE_32: case XFS_IOC_ATTRLIST_BY_HANDLE_32:
return xfs_compat_attrlist_by_handle(mp, arg, inode); return xfs_compat_attrlist_by_handle(filp, arg);
case XFS_IOC_ATTRMULTI_BY_HANDLE_32: case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
return xfs_compat_attrmulti_by_handle(mp, arg, inode); return xfs_compat_attrmulti_by_handle(filp, arg);
case XFS_IOC_FSSETDM_BY_HANDLE_32: case XFS_IOC_FSSETDM_BY_HANDLE_32:
return xfs_compat_fssetdm_by_handle(mp, arg, inode); return xfs_compat_fssetdm_by_handle(filp, arg);
default: default:
return -XFS_ERROR(ENOIOCTLCMD); return -XFS_ERROR(ENOIOCTLCMD);
} }
......
...@@ -1197,6 +1197,7 @@ xfs_fs_remount( ...@@ -1197,6 +1197,7 @@ xfs_fs_remount(
struct xfs_mount *mp = XFS_M(sb); struct xfs_mount *mp = XFS_M(sb);
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
char *p; char *p;
int error;
while ((p = strsep(&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token; int token;
...@@ -1247,11 +1248,25 @@ xfs_fs_remount( ...@@ -1247,11 +1248,25 @@ xfs_fs_remount(
} }
} }
/* rw/ro -> rw */ /* ro -> rw */
if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) { if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) {
mp->m_flags &= ~XFS_MOUNT_RDONLY; mp->m_flags &= ~XFS_MOUNT_RDONLY;
if (mp->m_flags & XFS_MOUNT_BARRIER) if (mp->m_flags & XFS_MOUNT_BARRIER)
xfs_mountfs_check_barriers(mp); xfs_mountfs_check_barriers(mp);
/*
* If this is the first remount to writeable state we
* might have some superblock changes to update.
*/
if (mp->m_update_flags) {
error = xfs_mount_log_sb(mp, mp->m_update_flags);
if (error) {
cmn_err(CE_WARN,
"XFS: failed to write sb changes");
return error;
}
mp->m_update_flags = 0;
}
} }
/* rw -> ro */ /* rw -> ro */
......
...@@ -73,6 +73,8 @@ int xfs_dqreq_num; ...@@ -73,6 +73,8 @@ int xfs_dqreq_num;
int xfs_dqerror_mod = 33; int xfs_dqerror_mod = 33;
#endif #endif
static struct lock_class_key xfs_dquot_other_class;
/* /*
* Allocate and initialize a dquot. We don't always allocate fresh memory; * Allocate and initialize a dquot. We don't always allocate fresh memory;
* we try to reclaim a free dquot if the number of incore dquots are above * we try to reclaim a free dquot if the number of incore dquots are above
...@@ -139,7 +141,15 @@ xfs_qm_dqinit( ...@@ -139,7 +141,15 @@ xfs_qm_dqinit(
ASSERT(dqp->q_trace); ASSERT(dqp->q_trace);
xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT"); xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
#endif #endif
} }
/*
* In either case we need to make sure group quotas have a different
* lock class than user quotas, to make sure lockdep knows we can
* locks of one of each at the same time.
*/
if (!(type & XFS_DQ_USER))
lockdep_set_class(&dqp->q_qlock, &xfs_dquot_other_class);
/* /*
* log item gets initialized later * log item gets initialized later
...@@ -421,7 +431,7 @@ xfs_qm_dqalloc( ...@@ -421,7 +431,7 @@ xfs_qm_dqalloc(
/* /*
* Initialize the bmap freelist prior to calling bmapi code. * Initialize the bmap freelist prior to calling bmapi code.
*/ */
XFS_BMAP_INIT(&flist, &firstblock); xfs_bmap_init(&flist, &firstblock);
xfs_ilock(quotip, XFS_ILOCK_EXCL); xfs_ilock(quotip, XFS_ILOCK_EXCL);
/* /*
* Return if this type of quotas is turned off while we didn't * Return if this type of quotas is turned off while we didn't
...@@ -1383,6 +1393,12 @@ xfs_dqunlock_nonotify( ...@@ -1383,6 +1393,12 @@ xfs_dqunlock_nonotify(
mutex_unlock(&(dqp->q_qlock)); mutex_unlock(&(dqp->q_qlock));
} }
/*
* Lock two xfs_dquot structures.
*
* To avoid deadlocks we always lock the quota structure with
* the lowerd id first.
*/
void void
xfs_dqlock2( xfs_dqlock2(
xfs_dquot_t *d1, xfs_dquot_t *d1,
...@@ -1392,18 +1408,16 @@ xfs_dqlock2( ...@@ -1392,18 +1408,16 @@ xfs_dqlock2(
ASSERT(d1 != d2); ASSERT(d1 != d2);
if (be32_to_cpu(d1->q_core.d_id) > if (be32_to_cpu(d1->q_core.d_id) >
be32_to_cpu(d2->q_core.d_id)) { be32_to_cpu(d2->q_core.d_id)) {
xfs_dqlock(d2); mutex_lock(&d2->q_qlock);
xfs_dqlock(d1); mutex_lock_nested(&d1->q_qlock, XFS_QLOCK_NESTED);
} else { } else {
xfs_dqlock(d1); mutex_lock(&d1->q_qlock);
xfs_dqlock(d2); mutex_lock_nested(&d2->q_qlock, XFS_QLOCK_NESTED);
}
} else {
if (d1) {
xfs_dqlock(d1);
} else if (d2) {
xfs_dqlock(d2);
} }
} else if (d1) {
mutex_lock(&d1->q_qlock);
} else if (d2) {
mutex_lock(&d2->q_qlock);
} }
} }
......
...@@ -97,6 +97,16 @@ typedef struct xfs_dquot { ...@@ -97,6 +97,16 @@ typedef struct xfs_dquot {
#define dq_hashlist q_lists.dqm_hashlist #define dq_hashlist q_lists.dqm_hashlist
#define dq_flags q_lists.dqm_flags #define dq_flags q_lists.dqm_flags
/*
* Lock hierachy for q_qlock:
* XFS_QLOCK_NORMAL is the implicit default,
* XFS_QLOCK_NESTED is the dquot with the higher id in xfs_dqlock2
*/
enum {
XFS_QLOCK_NORMAL = 0,
XFS_QLOCK_NESTED,
};
#define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++)
#ifdef DEBUG #ifdef DEBUG
......
...@@ -1070,6 +1070,13 @@ xfs_qm_sync( ...@@ -1070,6 +1070,13 @@ xfs_qm_sync(
return 0; return 0;
} }
/*
* The hash chains and the mplist use the same xfs_dqhash structure as
* their list head, but we can take the mplist qh_lock and one of the
* hash qh_locks at the same time without any problem as they aren't
* related.
*/
static struct lock_class_key xfs_quota_mplist_class;
/* /*
* This initializes all the quota information that's kept in the * This initializes all the quota information that's kept in the
...@@ -1105,6 +1112,8 @@ xfs_qm_init_quotainfo( ...@@ -1105,6 +1112,8 @@ xfs_qm_init_quotainfo(
} }
xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0); xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
lockdep_set_class(&qinf->qi_dqlist.qh_lock, &xfs_quota_mplist_class);
qinf->qi_dqreclaims = 0; qinf->qi_dqreclaims = 0;
/* mutex used to serialize quotaoffs */ /* mutex used to serialize quotaoffs */
......
...@@ -244,8 +244,8 @@ typedef struct xfs_perag ...@@ -244,8 +244,8 @@ typedef struct xfs_perag
#define XFS_AG_CHECK_DADDR(mp,d,len) \ #define XFS_AG_CHECK_DADDR(mp,d,len) \
((len) == 1 ? \ ((len) == 1 ? \
ASSERT((d) == XFS_SB_DADDR || \ ASSERT((d) == XFS_SB_DADDR || \
XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \ ASSERT(xfs_daddr_to_agno(mp, d) == \
XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1))) xfs_daddr_to_agno(mp, (d) + (len) - 1)))
#endif /* __XFS_AG_H__ */ #endif /* __XFS_AG_H__ */
...@@ -115,7 +115,7 @@ xfs_allocbt_free_block( ...@@ -115,7 +115,7 @@ xfs_allocbt_free_block(
xfs_agblock_t bno; xfs_agblock_t bno;
int error; int error;
bno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(bp)); bno = xfs_daddr_to_agbno(cur->bc_mp, XFS_BUF_ADDR(bp));
error = xfs_alloc_put_freelist(cur->bc_tp, agbp, NULL, bno, 1); error = xfs_alloc_put_freelist(cur->bc_tp, agbp, NULL, bno, 1);
if (error) if (error)
return error; return error;
......
...@@ -374,7 +374,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name, ...@@ -374,7 +374,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
* It won't fit in the shortform, transform to a leaf block. * It won't fit in the shortform, transform to a leaf block.
* GROT: another possible req'mt for a double-split btree op. * GROT: another possible req'mt for a double-split btree op.
*/ */
XFS_BMAP_INIT(args.flist, args.firstblock); xfs_bmap_init(args.flist, args.firstblock);
error = xfs_attr_shortform_to_leaf(&args); error = xfs_attr_shortform_to_leaf(&args);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args.trans, args.flist, error = xfs_bmap_finish(&args.trans, args.flist,
...@@ -956,7 +956,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -956,7 +956,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
* Commit that transaction so that the node_addname() call * Commit that transaction so that the node_addname() call
* can manage its own transactions. * can manage its own transactions.
*/ */
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr_leaf_to_node(args); error = xfs_attr_leaf_to_node(args);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
...@@ -1057,7 +1057,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -1057,7 +1057,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
* If the result is small enough, shrink it all into the inode. * If the result is small enough, shrink it all into the inode.
*/ */
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr_leaf_to_shortform(bp, args, forkoff); error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (!error) { if (!error) {
...@@ -1135,7 +1135,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) ...@@ -1135,7 +1135,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
* If the result is small enough, shrink it all into the inode. * If the result is small enough, shrink it all into the inode.
*/ */
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr_leaf_to_shortform(bp, args, forkoff); error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (!error) { if (!error) {
...@@ -1290,7 +1290,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1290,7 +1290,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* have been a b-tree. * have been a b-tree.
*/ */
xfs_da_state_free(state); xfs_da_state_free(state);
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr_leaf_to_node(args); error = xfs_attr_leaf_to_node(args);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, error = xfs_bmap_finish(&args->trans,
...@@ -1331,7 +1331,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1331,7 +1331,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* in the index/blkno/rmtblkno/rmtblkcnt fields and * in the index/blkno/rmtblkno/rmtblkcnt fields and
* in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields. * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
*/ */
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_split(state); error = xfs_da_split(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
...@@ -1443,7 +1443,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1443,7 +1443,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* Check to see if the tree needs to be collapsed. * Check to see if the tree needs to be collapsed.
*/ */
if (retval && (state->path.active > 1)) { if (retval && (state->path.active > 1)) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_join(state); error = xfs_da_join(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, error = xfs_bmap_finish(&args->trans,
...@@ -1579,7 +1579,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1579,7 +1579,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
* Check to see if the tree needs to be collapsed. * Check to see if the tree needs to be collapsed.
*/ */
if (retval && (state->path.active > 1)) { if (retval && (state->path.active > 1)) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_join(state); error = xfs_da_join(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
...@@ -1630,7 +1630,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1630,7 +1630,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
== XFS_ATTR_LEAF_MAGIC); == XFS_ATTR_LEAF_MAGIC);
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr_leaf_to_shortform(bp, args, forkoff); error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */ /* bp is gone due to xfs_da_shrink_inode */
if (!error) { if (!error) {
...@@ -2069,7 +2069,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -2069,7 +2069,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
/* /*
* Allocate a single extent, up to the size of the value. * Allocate a single extent, up to the size of the value.
*/ */
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
nmap = 1; nmap = 1;
error = xfs_bmapi(args->trans, dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi(args->trans, dp, (xfs_fileoff_t)lblkno,
blkcnt, blkcnt,
...@@ -2123,7 +2123,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -2123,7 +2123,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
/* /*
* Try to remember where we decided to put the value. * Try to remember where we decided to put the value.
*/ */
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
nmap = 1; nmap = 1;
error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno,
args->rmtblkcnt, args->rmtblkcnt,
...@@ -2188,7 +2188,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) ...@@ -2188,7 +2188,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
/* /*
* Try to remember where we decided to put the value. * Try to remember where we decided to put the value.
*/ */
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
nmap = 1; nmap = 1;
error = xfs_bmapi(NULL, args->dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi(NULL, args->dp, (xfs_fileoff_t)lblkno,
args->rmtblkcnt, args->rmtblkcnt,
...@@ -2229,7 +2229,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) ...@@ -2229,7 +2229,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
blkcnt = args->rmtblkcnt; blkcnt = args->rmtblkcnt;
done = 0; done = 0;
while (!done) { while (!done) {
XFS_BMAP_INIT(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
1, args->firstblock, args->flist, 1, args->firstblock, args->flist,
......
This diff is collapsed.
...@@ -95,7 +95,6 @@ typedef struct xfs_bmap_free ...@@ -95,7 +95,6 @@ typedef struct xfs_bmap_free
/* need write cache flushing and no */ /* need write cache flushing and no */
/* additional allocation alignments */ /* additional allocation alignments */
#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
static inline int xfs_bmapi_aflag(int w) static inline int xfs_bmapi_aflag(int w)
{ {
return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0); return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0);
...@@ -107,7 +106,6 @@ static inline int xfs_bmapi_aflag(int w) ...@@ -107,7 +106,6 @@ static inline int xfs_bmapi_aflag(int w)
#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
{ {
((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
......
...@@ -121,7 +121,7 @@ __xfs_bmbt_get_all( ...@@ -121,7 +121,7 @@ __xfs_bmbt_get_all(
b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) | b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
(((xfs_dfsbno_t)l1) >> 21); (((xfs_dfsbno_t)l1) >> 21);
ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); ASSERT((b >> 32) == 0 || isnulldstartblock(b));
s->br_startblock = (xfs_fsblock_t)b; s->br_startblock = (xfs_fsblock_t)b;
} }
#else /* !DEBUG */ #else /* !DEBUG */
...@@ -172,7 +172,7 @@ xfs_bmbt_get_startblock( ...@@ -172,7 +172,7 @@ xfs_bmbt_get_startblock(
b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) | b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
(((xfs_dfsbno_t)r->l1) >> 21); (((xfs_dfsbno_t)r->l1) >> 21);
ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); ASSERT((b >> 32) == 0 || isnulldstartblock(b));
return (xfs_fsblock_t)b; return (xfs_fsblock_t)b;
#else /* !DEBUG */ #else /* !DEBUG */
return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21); return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
...@@ -261,7 +261,7 @@ xfs_bmbt_set_allf( ...@@ -261,7 +261,7 @@ xfs_bmbt_set_allf(
((xfs_bmbt_rec_base_t)blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)xfs_mask64lo(21)); (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
#else /* !XFS_BIG_BLKNOS */ #else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(startblock)) { if (isnullstartblock(startblock)) {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)startoff << 9) | ((xfs_bmbt_rec_base_t)startoff << 9) |
(xfs_bmbt_rec_base_t)xfs_mask64lo(9); (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
...@@ -321,7 +321,7 @@ xfs_bmbt_disk_set_allf( ...@@ -321,7 +321,7 @@ xfs_bmbt_disk_set_allf(
((xfs_bmbt_rec_base_t)blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)xfs_mask64lo(21))); (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
#else /* !XFS_BIG_BLKNOS */ #else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(startblock)) { if (isnullstartblock(startblock)) {
r->l0 = cpu_to_be64( r->l0 = cpu_to_be64(
((xfs_bmbt_rec_base_t)extent_flag << 63) | ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)startoff << 9) | ((xfs_bmbt_rec_base_t)startoff << 9) |
...@@ -382,7 +382,7 @@ xfs_bmbt_set_startblock( ...@@ -382,7 +382,7 @@ xfs_bmbt_set_startblock(
r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) | r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
(xfs_bmbt_rec_base_t)(v << 21); (xfs_bmbt_rec_base_t)(v << 21);
#else /* !XFS_BIG_BLKNOS */ #else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(v)) { if (isnullstartblock(v)) {
r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9); r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) | r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
((xfs_bmbt_rec_base_t)v << 21) | ((xfs_bmbt_rec_base_t)v << 21) |
......
...@@ -76,26 +76,22 @@ typedef struct xfs_bmbt_rec_host { ...@@ -76,26 +76,22 @@ typedef struct xfs_bmbt_rec_host {
#define DSTARTBLOCKMASK \ #define DSTARTBLOCKMASK \
(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
static inline int isnullstartblock(xfs_fsblock_t x) static inline int isnullstartblock(xfs_fsblock_t x)
{ {
return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
} }
#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
static inline int isnulldstartblock(xfs_dfsbno_t x) static inline int isnulldstartblock(xfs_dfsbno_t x)
{ {
return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK; return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
} }
#define NULLSTARTBLOCK(k) nullstartblock(k)
static inline xfs_fsblock_t nullstartblock(int k) static inline xfs_fsblock_t nullstartblock(int k)
{ {
ASSERT(k < (1 << STARTBLOCKVALBITS)); ASSERT(k < (1 << STARTBLOCKVALBITS));
return STARTBLOCKMASK | (k); return STARTBLOCKMASK | (k);
} }
#define STARTBLOCKVAL(x) startblockval(x)
static inline xfs_filblks_t startblockval(xfs_fsblock_t x) static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
{ {
return (xfs_filblks_t)((x) & ~STARTBLOCKMASK); return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
......
...@@ -843,7 +843,7 @@ xfs_btree_ptr_is_null( ...@@ -843,7 +843,7 @@ xfs_btree_ptr_is_null(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
return be64_to_cpu(ptr->l) == NULLFSBLOCK; return be64_to_cpu(ptr->l) == NULLDFSBNO;
else else
return be32_to_cpu(ptr->s) == NULLAGBLOCK; return be32_to_cpu(ptr->s) == NULLAGBLOCK;
} }
...@@ -854,7 +854,7 @@ xfs_btree_set_ptr_null( ...@@ -854,7 +854,7 @@ xfs_btree_set_ptr_null(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
ptr->l = cpu_to_be64(NULLFSBLOCK); ptr->l = cpu_to_be64(NULLDFSBNO);
else else
ptr->s = cpu_to_be32(NULLAGBLOCK); ptr->s = cpu_to_be32(NULLAGBLOCK);
} }
...@@ -918,8 +918,8 @@ xfs_btree_init_block( ...@@ -918,8 +918,8 @@ xfs_btree_init_block(
new->bb_numrecs = cpu_to_be16(numrecs); new->bb_numrecs = cpu_to_be16(numrecs);
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
new->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK); new->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO);
new->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK); new->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO);
} else { } else {
new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK); new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK);
new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK); new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK);
...@@ -960,7 +960,7 @@ xfs_btree_buf_to_ptr( ...@@ -960,7 +960,7 @@ xfs_btree_buf_to_ptr(
ptr->l = cpu_to_be64(XFS_DADDR_TO_FSB(cur->bc_mp, ptr->l = cpu_to_be64(XFS_DADDR_TO_FSB(cur->bc_mp,
XFS_BUF_ADDR(bp))); XFS_BUF_ADDR(bp)));
else { else {
ptr->s = cpu_to_be32(XFS_DADDR_TO_AGBNO(cur->bc_mp, ptr->s = cpu_to_be32(xfs_daddr_to_agbno(cur->bc_mp,
XFS_BUF_ADDR(bp))); XFS_BUF_ADDR(bp)));
} }
} }
...@@ -971,7 +971,7 @@ xfs_btree_ptr_to_daddr( ...@@ -971,7 +971,7 @@ xfs_btree_ptr_to_daddr(
union xfs_btree_ptr *ptr) union xfs_btree_ptr *ptr)
{ {
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
ASSERT(be64_to_cpu(ptr->l) != NULLFSBLOCK); ASSERT(be64_to_cpu(ptr->l) != NULLDFSBNO);
return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
} else { } else {
...@@ -2454,7 +2454,7 @@ xfs_btree_new_iroot( ...@@ -2454,7 +2454,7 @@ xfs_btree_new_iroot(
xfs_btree_log_ptrs(cur, cbp, 1, be16_to_cpu(cblock->bb_numrecs)); xfs_btree_log_ptrs(cur, cbp, 1, be16_to_cpu(cblock->bb_numrecs));
*logflags |= *logflags |=
XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork); XFS_ILOG_CORE | xfs_ilog_fbroot(cur->bc_private.b.whichfork);
*stat = 1; *stat = 1;
XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT); XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
return 0; return 0;
...@@ -3048,7 +3048,7 @@ xfs_btree_kill_iroot( ...@@ -3048,7 +3048,7 @@ xfs_btree_kill_iroot(
cur->bc_bufs[level - 1] = NULL; cur->bc_bufs[level - 1] = NULL;
be16_add_cpu(&block->bb_level, -1); be16_add_cpu(&block->bb_level, -1);
xfs_trans_log_inode(cur->bc_tp, ip, xfs_trans_log_inode(cur->bc_tp, ip,
XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork)); XFS_ILOG_CORE | xfs_ilog_fbroot(cur->bc_private.b.whichfork));
cur->bc_nlevels--; cur->bc_nlevels--;
out0: out0:
XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT); XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
......
...@@ -1597,7 +1597,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1597,7 +1597,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
nmap = 1; nmap = 1;
ASSERT(args->firstblock != NULL); ASSERT(args->firstblock != NULL);
if ((error = xfs_bmapi(tp, dp, bno, count, if ((error = xfs_bmapi(tp, dp, bno, count,
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA| xfs_bmapi_aflag(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|
XFS_BMAPI_CONTIG, XFS_BMAPI_CONTIG,
args->firstblock, args->total, &map, &nmap, args->firstblock, args->total, &map, &nmap,
args->flist, NULL))) { args->flist, NULL))) {
...@@ -1618,7 +1618,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno) ...@@ -1618,7 +1618,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
nmap = MIN(XFS_BMAP_MAX_NMAP, count); nmap = MIN(XFS_BMAP_MAX_NMAP, count);
c = (int)(bno + count - b); c = (int)(bno + count - b);
if ((error = xfs_bmapi(tp, dp, b, c, if ((error = xfs_bmapi(tp, dp, b, c,
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE| xfs_bmapi_aflag(w)|XFS_BMAPI_WRITE|
XFS_BMAPI_METADATA, XFS_BMAPI_METADATA,
args->firstblock, args->total, args->firstblock, args->total,
&mapp[mapi], &nmap, args->flist, &mapp[mapi], &nmap, args->flist,
...@@ -1882,7 +1882,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, ...@@ -1882,7 +1882,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
* the last block to the place we want to kill. * the last block to the place we want to kill.
*/ */
if ((error = xfs_bunmapi(tp, dp, dead_blkno, count, if ((error = xfs_bunmapi(tp, dp, dead_blkno, count,
XFS_BMAPI_AFLAG(w)|XFS_BMAPI_METADATA, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
0, args->firstblock, args->flist, NULL, 0, args->firstblock, args->flist, NULL,
&done)) == ENOSPC) { &done)) == ENOSPC) {
if (w != XFS_DATA_FORK) if (w != XFS_DATA_FORK)
...@@ -1987,7 +1987,7 @@ xfs_da_do_buf( ...@@ -1987,7 +1987,7 @@ xfs_da_do_buf(
if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno, if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno,
nfsb, nfsb,
XFS_BMAPI_METADATA | XFS_BMAPI_METADATA |
XFS_BMAPI_AFLAG(whichfork), xfs_bmapi_aflag(whichfork),
NULL, 0, mapp, &nmap, NULL, NULL))) NULL, 0, mapp, &nmap, NULL, NULL)))
goto exit0; goto exit0;
} }
......
...@@ -357,7 +357,7 @@ xfs_ialloc_ag_alloc( ...@@ -357,7 +357,7 @@ xfs_ialloc_ag_alloc(
int ioffset = i << args.mp->m_sb.sb_inodelog; int ioffset = i << args.mp->m_sb.sb_inodelog;
uint isize = sizeof(struct xfs_dinode); uint isize = sizeof(struct xfs_dinode);
free = XFS_MAKE_IPTR(args.mp, fbuf, i); free = xfs_make_iptr(args.mp, fbuf, i);
free->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); free->di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
free->di_version = version; free->di_version = version;
free->di_gen = cpu_to_be32(gen); free->di_gen = cpu_to_be32(gen);
...@@ -937,7 +937,7 @@ xfs_dialloc( ...@@ -937,7 +937,7 @@ xfs_dialloc(
} }
} }
} }
offset = XFS_IALLOC_FIND_FREE(&rec.ir_free); offset = xfs_ialloc_find_free(&rec.ir_free);
ASSERT(offset >= 0); ASSERT(offset >= 0);
ASSERT(offset < XFS_INODES_PER_CHUNK); ASSERT(offset < XFS_INODES_PER_CHUNK);
ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) % ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
...@@ -1279,7 +1279,7 @@ xfs_imap( ...@@ -1279,7 +1279,7 @@ xfs_imap(
offset = XFS_INO_TO_OFFSET(mp, ino); offset = XFS_INO_TO_OFFSET(mp, ino);
ASSERT(offset < mp->m_sb.sb_inopblock); ASSERT(offset < mp->m_sb.sb_inopblock);
cluster_agbno = XFS_DADDR_TO_AGBNO(mp, imap->im_blkno); cluster_agbno = xfs_daddr_to_agbno(mp, imap->im_blkno);
offset += (agbno - cluster_agbno) * mp->m_sb.sb_inopblock; offset += (agbno - cluster_agbno) * mp->m_sb.sb_inopblock;
imap->im_len = XFS_FSB_TO_BB(mp, blks_per_cluster); imap->im_len = XFS_FSB_TO_BB(mp, blks_per_cluster);
......
...@@ -39,7 +39,6 @@ struct xfs_trans; ...@@ -39,7 +39,6 @@ struct xfs_trans;
/* /*
* Make an inode pointer out of the buffer/offset. * Make an inode pointer out of the buffer/offset.
*/ */
#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
static inline struct xfs_dinode * static inline struct xfs_dinode *
xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
{ {
...@@ -50,7 +49,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) ...@@ -50,7 +49,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
/* /*
* Find a free (set) bit in the inode bitmask. * Find a free (set) bit in the inode bitmask.
*/ */
#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
static inline int xfs_ialloc_find_free(xfs_inofree_t *fp) static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
{ {
return xfs_lowbit64(*fp); return xfs_lowbit64(*fp);
......
...@@ -36,7 +36,6 @@ typedef __uint64_t xfs_inofree_t; ...@@ -36,7 +36,6 @@ typedef __uint64_t xfs_inofree_t;
#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) #define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) #define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n) static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
{ {
return (((n) >= XFS_INODES_PER_CHUNK ? \ return (((n) >= XFS_INODES_PER_CHUNK ? \
......
...@@ -424,6 +424,19 @@ xfs_iformat( ...@@ -424,6 +424,19 @@ xfs_iformat(
case XFS_DINODE_FMT_LOCAL: case XFS_DINODE_FMT_LOCAL:
atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
size = be16_to_cpu(atp->hdr.totsize); size = be16_to_cpu(atp->hdr.totsize);
if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
"corrupt inode %Lu "
"(bad attr fork size %Ld).",
(unsigned long long) ip->i_ino,
(long long) size);
XFS_CORRUPTION_ERROR("xfs_iformat(8)",
XFS_ERRLEVEL_LOW,
ip->i_mount, dip);
return XFS_ERROR(EFSCORRUPTED);
}
error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size);
break; break;
case XFS_DINODE_FMT_EXTENTS: case XFS_DINODE_FMT_EXTENTS:
...@@ -1601,10 +1614,10 @@ xfs_itruncate_finish( ...@@ -1601,10 +1614,10 @@ xfs_itruncate_finish(
* in this file with garbage in them once recovery * in this file with garbage in them once recovery
* runs. * runs.
*/ */
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
error = xfs_bunmapi(ntp, ip, error = xfs_bunmapi(ntp, ip,
first_unmap_block, unmap_len, first_unmap_block, unmap_len,
XFS_BMAPI_AFLAG(fork) | xfs_bmapi_aflag(fork) |
(sync ? 0 : XFS_BMAPI_ASYNC), (sync ? 0 : XFS_BMAPI_ASYNC),
XFS_ITRUNC_MAX_EXTENTS, XFS_ITRUNC_MAX_EXTENTS,
&first_block, &free_list, &first_block, &free_list,
...@@ -2557,7 +2570,7 @@ xfs_iextents_copy( ...@@ -2557,7 +2570,7 @@ xfs_iextents_copy(
for (i = 0; i < nrecs; i++) { for (i = 0; i < nrecs; i++) {
xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i); xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
start_block = xfs_bmbt_get_startblock(ep); start_block = xfs_bmbt_get_startblock(ep);
if (ISNULLSTARTBLOCK(start_block)) { if (isnullstartblock(start_block)) {
/* /*
* It's a delayed allocation extent, so skip it. * It's a delayed allocation extent, so skip it.
*/ */
......
...@@ -111,20 +111,16 @@ typedef struct xfs_inode_log_format_64 { ...@@ -111,20 +111,16 @@ typedef struct xfs_inode_log_format_64 {
#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) #define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
static inline int xfs_ilog_fbroot(int w) static inline int xfs_ilog_fbroot(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT); return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
} }
#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
static inline int xfs_ilog_fext(int w) static inline int xfs_ilog_fext(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
} }
#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
static inline int xfs_ilog_fdata(int w) static inline int xfs_ilog_fdata(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA); return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
......
...@@ -155,7 +155,7 @@ xfs_imap_to_bmap( ...@@ -155,7 +155,7 @@ xfs_imap_to_bmap(
iomapp->iomap_bn = IOMAP_DADDR_NULL; iomapp->iomap_bn = IOMAP_DADDR_NULL;
iomapp->iomap_flags |= IOMAP_DELAY; iomapp->iomap_flags |= IOMAP_DELAY;
} else { } else {
iomapp->iomap_bn = XFS_FSB_TO_DB(ip, start_block); iomapp->iomap_bn = xfs_fsb_to_db(ip, start_block);
if (ISUNWRITTEN(imap)) if (ISUNWRITTEN(imap))
iomapp->iomap_flags |= IOMAP_UNWRITTEN; iomapp->iomap_flags |= IOMAP_UNWRITTEN;
} }
...@@ -261,7 +261,7 @@ xfs_iomap( ...@@ -261,7 +261,7 @@ xfs_iomap(
xfs_iunlock(ip, lockmode); xfs_iunlock(ip, lockmode);
lockmode = 0; lockmode = 0;
if (nimaps && !ISNULLSTARTBLOCK(imap.br_startblock)) { if (nimaps && !isnullstartblock(imap.br_startblock)) {
xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip, xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip,
offset, count, iomapp, &imap, flags); offset, count, iomapp, &imap, flags);
break; break;
...@@ -491,7 +491,7 @@ xfs_iomap_write_direct( ...@@ -491,7 +491,7 @@ xfs_iomap_write_direct(
/* /*
* Issue the xfs_bmapi() call to allocate the blocks * Issue the xfs_bmapi() call to allocate the blocks
*/ */
XFS_BMAP_INIT(&free_list, &firstfsb); xfs_bmap_init(&free_list, &firstfsb);
nimaps = 1; nimaps = 1;
error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag, error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag,
&firstfsb, 0, &imap, &nimaps, &free_list, NULL); &firstfsb, 0, &imap, &nimaps, &free_list, NULL);
...@@ -751,7 +751,7 @@ xfs_iomap_write_allocate( ...@@ -751,7 +751,7 @@ xfs_iomap_write_allocate(
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);
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
/* /*
* it is possible that the extents have changed since * it is possible that the extents have changed since
...@@ -911,7 +911,7 @@ xfs_iomap_write_unwritten( ...@@ -911,7 +911,7 @@ xfs_iomap_write_unwritten(
/* /*
* Modify the unwritten extent state of the buffer. * Modify the unwritten extent state of the buffer.
*/ */
XFS_BMAP_INIT(&free_list, &firstfsb); xfs_bmap_init(&free_list, &firstfsb);
nimaps = 1; nimaps = 1;
error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, error = xfs_bmapi(tp, ip, offset_fsb, count_fsb,
XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb, XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb,
......
...@@ -453,7 +453,7 @@ xfs_bulkstat( ...@@ -453,7 +453,7 @@ xfs_bulkstat(
(chunkidx = agino - gino + 1) < (chunkidx = agino - gino + 1) <
XFS_INODES_PER_CHUNK && XFS_INODES_PER_CHUNK &&
/* there are some left allocated */ /* there are some left allocated */
XFS_INOBT_MASKN(chunkidx, xfs_inobt_maskn(chunkidx,
XFS_INODES_PER_CHUNK - chunkidx) & ~gfree) { XFS_INODES_PER_CHUNK - chunkidx) & ~gfree) {
/* /*
* Grab the chunk record. Mark all the * Grab the chunk record. Mark all the
...@@ -464,7 +464,7 @@ xfs_bulkstat( ...@@ -464,7 +464,7 @@ xfs_bulkstat(
if (XFS_INOBT_MASK(i) & ~gfree) if (XFS_INOBT_MASK(i) & ~gfree)
gcnt++; gcnt++;
} }
gfree |= XFS_INOBT_MASKN(0, chunkidx); gfree |= xfs_inobt_maskn(0, chunkidx);
irbp->ir_startino = gino; irbp->ir_startino = gino;
irbp->ir_freecount = gcnt; irbp->ir_freecount = gcnt;
irbp->ir_free = gfree; irbp->ir_free = gfree;
...@@ -535,7 +535,7 @@ xfs_bulkstat( ...@@ -535,7 +535,7 @@ xfs_bulkstat(
chunkidx < XFS_INODES_PER_CHUNK; chunkidx < XFS_INODES_PER_CHUNK;
chunkidx += nicluster, chunkidx += nicluster,
agbno += nbcluster) { agbno += nbcluster) {
if (XFS_INOBT_MASKN(chunkidx, if (xfs_inobt_maskn(chunkidx,
nicluster) & ~gfree) nicluster) & ~gfree)
xfs_btree_reada_bufs(mp, agno, xfs_btree_reada_bufs(mp, agno,
agbno, nbcluster); agbno, nbcluster);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "xfs_fsops.h" #include "xfs_fsops.h"
#include "xfs_utils.h" #include "xfs_utils.h"
STATIC int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
STATIC int xfs_uuid_mount(xfs_mount_t *); STATIC int xfs_uuid_mount(xfs_mount_t *);
STATIC void xfs_unmountfs_wait(xfs_mount_t *); STATIC void xfs_unmountfs_wait(xfs_mount_t *);
...@@ -682,7 +681,7 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount) ...@@ -682,7 +681,7 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
* Update alignment values based on mount options and sb values * Update alignment values based on mount options and sb values
*/ */
STATIC int STATIC int
xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags) xfs_update_alignment(xfs_mount_t *mp)
{ {
xfs_sb_t *sbp = &(mp->m_sb); xfs_sb_t *sbp = &(mp->m_sb);
...@@ -736,11 +735,11 @@ xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags) ...@@ -736,11 +735,11 @@ xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags)
if (xfs_sb_version_hasdalign(sbp)) { if (xfs_sb_version_hasdalign(sbp)) {
if (sbp->sb_unit != mp->m_dalign) { if (sbp->sb_unit != mp->m_dalign) {
sbp->sb_unit = mp->m_dalign; sbp->sb_unit = mp->m_dalign;
*update_flags |= XFS_SB_UNIT; mp->m_update_flags |= XFS_SB_UNIT;
} }
if (sbp->sb_width != mp->m_swidth) { if (sbp->sb_width != mp->m_swidth) {
sbp->sb_width = mp->m_swidth; sbp->sb_width = mp->m_swidth;
*update_flags |= XFS_SB_WIDTH; mp->m_update_flags |= XFS_SB_WIDTH;
} }
} }
} else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
...@@ -905,7 +904,6 @@ xfs_mountfs( ...@@ -905,7 +904,6 @@ xfs_mountfs(
xfs_sb_t *sbp = &(mp->m_sb); xfs_sb_t *sbp = &(mp->m_sb);
xfs_inode_t *rip; xfs_inode_t *rip;
__uint64_t resblks; __uint64_t resblks;
__int64_t update_flags = 0LL;
uint quotamount, quotaflags; uint quotamount, quotaflags;
int uuid_mounted = 0; int uuid_mounted = 0;
int error = 0; int error = 0;
...@@ -933,7 +931,7 @@ xfs_mountfs( ...@@ -933,7 +931,7 @@ xfs_mountfs(
"XFS: correcting sb_features alignment problem"); "XFS: correcting sb_features alignment problem");
sbp->sb_features2 |= sbp->sb_bad_features2; sbp->sb_features2 |= sbp->sb_bad_features2;
sbp->sb_bad_features2 = sbp->sb_features2; sbp->sb_bad_features2 = sbp->sb_features2;
update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2; mp->m_update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
/* /*
* Re-check for ATTR2 in case it was found in bad_features2 * Re-check for ATTR2 in case it was found in bad_features2
...@@ -947,11 +945,11 @@ xfs_mountfs( ...@@ -947,11 +945,11 @@ xfs_mountfs(
if (xfs_sb_version_hasattr2(&mp->m_sb) && if (xfs_sb_version_hasattr2(&mp->m_sb) &&
(mp->m_flags & XFS_MOUNT_NOATTR2)) { (mp->m_flags & XFS_MOUNT_NOATTR2)) {
xfs_sb_version_removeattr2(&mp->m_sb); xfs_sb_version_removeattr2(&mp->m_sb);
update_flags |= XFS_SB_FEATURES2; mp->m_update_flags |= XFS_SB_FEATURES2;
/* update sb_versionnum for the clearing of the morebits */ /* update sb_versionnum for the clearing of the morebits */
if (!sbp->sb_features2) if (!sbp->sb_features2)
update_flags |= XFS_SB_VERSIONNUM; mp->m_update_flags |= XFS_SB_VERSIONNUM;
} }
/* /*
...@@ -960,7 +958,7 @@ xfs_mountfs( ...@@ -960,7 +958,7 @@ xfs_mountfs(
* allocator alignment is within an ag, therefore ag has * allocator alignment is within an ag, therefore ag has
* to be aligned at stripe boundary. * to be aligned at stripe boundary.
*/ */
error = xfs_update_alignment(mp, &update_flags); error = xfs_update_alignment(mp);
if (error) if (error)
goto error1; goto error1;
...@@ -1137,10 +1135,12 @@ xfs_mountfs( ...@@ -1137,10 +1135,12 @@ xfs_mountfs(
} }
/* /*
* If fs is not mounted readonly, then update the superblock changes. * If this is a read-only mount defer the superblock updates until
* the next remount into writeable mode. Otherwise we would never
* perform the update e.g. for the root filesystem.
*/ */
if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) { if (mp->m_update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) {
error = xfs_mount_log_sb(mp, update_flags); error = xfs_mount_log_sb(mp, mp->m_update_flags);
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: failed to write sb changes"); cmn_err(CE_WARN, "XFS: failed to write sb changes");
goto error4; goto error4;
...@@ -1820,7 +1820,7 @@ xfs_uuid_mount( ...@@ -1820,7 +1820,7 @@ xfs_uuid_mount(
* be altered by the mount options, as well as any potential sb_features2 * be altered by the mount options, as well as any potential sb_features2
* fixup. Only the first superblock is updated. * fixup. Only the first superblock is updated.
*/ */
STATIC int int
xfs_mount_log_sb( xfs_mount_log_sb(
xfs_mount_t *mp, xfs_mount_t *mp,
__int64_t fields) __int64_t fields)
......
...@@ -44,9 +44,9 @@ typedef struct xfs_trans_reservations { ...@@ -44,9 +44,9 @@ typedef struct xfs_trans_reservations {
#ifndef __KERNEL__ #ifndef __KERNEL__
#define XFS_DADDR_TO_AGNO(mp,d) \ #define xfs_daddr_to_agno(mp,d) \
((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
#define XFS_DADDR_TO_AGBNO(mp,d) \ #define xfs_daddr_to_agbno(mp,d) \
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
#else /* __KERNEL__ */ #else /* __KERNEL__ */
...@@ -327,6 +327,8 @@ typedef struct xfs_mount { ...@@ -327,6 +327,8 @@ typedef struct xfs_mount {
spinlock_t m_sync_lock; /* work item list lock */ spinlock_t m_sync_lock; /* work item list lock */
int m_sync_seq; /* sync thread generation no. */ int m_sync_seq; /* sync thread generation no. */
wait_queue_head_t m_wait_single_sync_task; wait_queue_head_t m_wait_single_sync_task;
__int64_t m_update_flags; /* sb flags we need to update
on the next remount,rw */
} xfs_mount_t; } xfs_mount_t;
/* /*
...@@ -439,7 +441,6 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, ...@@ -439,7 +441,6 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
*/ */
#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */ #define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */
#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
static inline xfs_agnumber_t static inline xfs_agnumber_t
xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
{ {
...@@ -448,7 +449,6 @@ xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) ...@@ -448,7 +449,6 @@ xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
return (xfs_agnumber_t) ld; return (xfs_agnumber_t) ld;
} }
#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
static inline xfs_agblock_t static inline xfs_agblock_t
xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
{ {
...@@ -514,6 +514,7 @@ extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t, ...@@ -514,6 +514,7 @@ extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t,
int64_t, int); int64_t, int);
extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *,
uint, int); uint, int);
extern int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
extern int xfs_readsb(xfs_mount_t *, int); extern int xfs_readsb(xfs_mount_t *, int);
extern void xfs_freesb(xfs_mount_t *); extern void xfs_freesb(xfs_mount_t *);
......
...@@ -147,7 +147,7 @@ xfs_rename( ...@@ -147,7 +147,7 @@ xfs_rename(
xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip, xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip,
inodes, &num_inodes); inodes, &num_inodes);
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME);
cancel_flags = XFS_TRANS_RELEASE_LOG_RES; cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len); spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len);
......
...@@ -120,7 +120,7 @@ xfs_growfs_rt_alloc( ...@@ -120,7 +120,7 @@ xfs_growfs_rt_alloc(
if ((error = xfs_trans_iget(mp, tp, ino, 0, if ((error = xfs_trans_iget(mp, tp, ino, 0,
XFS_ILOCK_EXCL, &ip))) XFS_ILOCK_EXCL, &ip)))
goto error_cancel; goto error_cancel;
XFS_BMAP_INIT(&flist, &firstblock); xfs_bmap_init(&flist, &firstblock);
/* /*
* Allocate blocks to the bitmap file. * Allocate blocks to the bitmap file.
*/ */
......
...@@ -28,7 +28,6 @@ struct xfs_mount; ...@@ -28,7 +28,6 @@ struct xfs_mount;
* file is a real time file or not, because the bmap code * file is a real time file or not, because the bmap code
* does. * does.
*/ */
#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb)
static inline xfs_daddr_t static inline xfs_daddr_t
xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb) xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
{ {
......
...@@ -505,7 +505,7 @@ static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp) ...@@ -505,7 +505,7 @@ static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp)
#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d)) xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \ #define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno)) XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
......
...@@ -862,7 +862,7 @@ xfs_inactive_symlink_rmt( ...@@ -862,7 +862,7 @@ xfs_inactive_symlink_rmt(
* Find the block(s) so we can inval and unmap them. * Find the block(s) so we can inval and unmap them.
*/ */
done = 0; done = 0;
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
nmaps = ARRAY_SIZE(mval); nmaps = ARRAY_SIZE(mval);
if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size),
XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps,
...@@ -1288,7 +1288,7 @@ xfs_inactive( ...@@ -1288,7 +1288,7 @@ xfs_inactive(
/* /*
* Free the inode. * Free the inode.
*/ */
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
error = xfs_ifree(tp, ip, &free_list); error = xfs_ifree(tp, ip, &free_list);
if (error) { if (error) {
/* /*
...@@ -1461,7 +1461,7 @@ xfs_create( ...@@ -1461,7 +1461,7 @@ xfs_create(
xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
unlock_dp_on_error = B_TRUE; unlock_dp_on_error = B_TRUE;
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
ASSERT(ip == NULL); ASSERT(ip == NULL);
...@@ -1879,7 +1879,7 @@ xfs_remove( ...@@ -1879,7 +1879,7 @@ xfs_remove(
} }
} }
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
error = xfs_dir_removename(tp, dp, name, ip->i_ino, error = xfs_dir_removename(tp, dp, name, ip->i_ino,
&first_block, &free_list, resblks); &first_block, &free_list, resblks);
if (error) { if (error) {
...@@ -2059,7 +2059,7 @@ xfs_link( ...@@ -2059,7 +2059,7 @@ xfs_link(
if (error) if (error)
goto error_return; goto error_return;
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino, error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino,
&first_block, &free_list, resblks); &first_block, &free_list, resblks);
...@@ -2231,7 +2231,7 @@ xfs_mkdir( ...@@ -2231,7 +2231,7 @@ xfs_mkdir(
xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
unlock_dp_on_error = B_FALSE; unlock_dp_on_error = B_FALSE;
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino, error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino,
&first_block, &free_list, resblks ? &first_block, &free_list, resblks ?
...@@ -2438,7 +2438,7 @@ xfs_symlink( ...@@ -2438,7 +2438,7 @@ xfs_symlink(
* Initialize the bmap freelist prior to calling either * Initialize the bmap freelist prior to calling either
* bmapi or the directory create code. * bmapi or the directory create code.
*/ */
XFS_BMAP_INIT(&free_list, &first_block); xfs_bmap_init(&free_list, &first_block);
/* /*
* Allocate an inode for the symlink. * Allocate an inode for the symlink.
...@@ -2860,7 +2860,7 @@ xfs_alloc_file_space( ...@@ -2860,7 +2860,7 @@ xfs_alloc_file_space(
/* /*
* Issue the xfs_bmapi() call to allocate the blocks * Issue the xfs_bmapi() call to allocate the blocks
*/ */
XFS_BMAP_INIT(&free_list, &firstfsb); xfs_bmap_init(&free_list, &firstfsb);
error = xfs_bmapi(tp, ip, startoffset_fsb, error = xfs_bmapi(tp, ip, startoffset_fsb,
allocatesize_fsb, bmapi_flag, allocatesize_fsb, bmapi_flag,
&firstfsb, 0, imapp, &nimaps, &firstfsb, 0, imapp, &nimaps,
...@@ -2980,7 +2980,7 @@ xfs_zero_remaining_bytes( ...@@ -2980,7 +2980,7 @@ xfs_zero_remaining_bytes(
XFS_BUF_UNDONE(bp); XFS_BUF_UNDONE(bp);
XFS_BUF_UNWRITE(bp); XFS_BUF_UNWRITE(bp);
XFS_BUF_READ(bp); XFS_BUF_READ(bp);
XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock)); XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock));
xfsbdstrat(mp, bp); xfsbdstrat(mp, bp);
error = xfs_iowait(bp); error = xfs_iowait(bp);
if (error) { if (error) {
...@@ -3186,7 +3186,7 @@ xfs_free_file_space( ...@@ -3186,7 +3186,7 @@ xfs_free_file_space(
/* /*
* issue the bunmapi() call to free the blocks * issue the bunmapi() call to free the blocks
*/ */
XFS_BMAP_INIT(&free_list, &firstfsb); xfs_bmap_init(&free_list, &firstfsb);
error = xfs_bunmapi(tp, ip, startoffset_fsb, error = xfs_bunmapi(tp, ip, startoffset_fsb,
endoffset_fsb - startoffset_fsb, endoffset_fsb - startoffset_fsb,
0, 2, &firstfsb, &free_list, NULL, &done); 0, 2, &firstfsb, &free_list, NULL, &done);
......
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