Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84446
b: refs/heads/master
c: 3685c2a
h: refs/heads/master
v: v3
  • Loading branch information
Eric Sandeen authored and Lachlan McIlroy committed Feb 7, 2008
1 parent dc1343b commit fa6a515
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 80 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba74d0cba51dcaa99e4dc2e4fb62e6e13abbf703
refs/heads/master: 3685c2a1d773781608c9e281a6ff6b4c8ea8f6f9
12 changes: 5 additions & 7 deletions trunk/fs/xfs/quota/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ xfs_qm_mount_quotas(
xfs_mount_t *mp,
int mfsi_flags)
{
unsigned long s;
int error = 0;
uint sbf;

Expand Down Expand Up @@ -367,13 +366,13 @@ xfs_qm_mount_quotas(

write_changes:
/*
* We actually don't have to acquire the SB_LOCK at all.
* We actually don't have to acquire the m_sb_lock at all.
* This can only be called from mount, and that's single threaded. XXX
*/
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
sbf = mp->m_sb.sb_qflags;
mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);

if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
Expand Down Expand Up @@ -1370,7 +1369,6 @@ xfs_qm_qino_alloc(
{
xfs_trans_t *tp;
int error;
unsigned long s;
int committed;

tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE);
Expand Down Expand Up @@ -1402,7 +1400,7 @@ xfs_qm_qino_alloc(
* sbfields arg may contain fields other than *QUOTINO;
* VERSIONNUM for example.
*/
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
if (flags & XFS_QMOPT_SBVERSION) {
#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
unsigned oldv = mp->m_sb.sb_versionnum;
Expand All @@ -1429,7 +1427,7 @@ xfs_qm_qino_alloc(
mp->m_sb.sb_uquotino = (*ip)->i_ino;
else
mp->m_sb.sb_gquotino = (*ip)->i_ino;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
xfs_mod_sb(tp, sbfields);

if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
Expand Down
19 changes: 8 additions & 11 deletions trunk/fs/xfs/quota/xfs_qm_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ xfs_qm_scall_quotaoff(
boolean_t force)
{
uint dqtype;
unsigned long s;
int error;
uint inactivate_flags;
xfs_qoff_logitem_t *qoffstart;
Expand Down Expand Up @@ -237,9 +236,9 @@ xfs_qm_scall_quotaoff(
if ((flags & XFS_ALL_QUOTA_ACCT) == 0) {
mp->m_qflags &= ~(flags);

s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
mp->m_sb.sb_qflags = mp->m_qflags;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));

/* XXX what to do if error ? Revert back to old vals incore ? */
Expand Down Expand Up @@ -415,7 +414,6 @@ xfs_qm_scall_quotaon(
uint flags)
{
int error;
unsigned long s;
uint qf;
uint accflags;
__int64_t sbflags;
Expand Down Expand Up @@ -468,10 +466,10 @@ xfs_qm_scall_quotaon(
* Change sb_qflags on disk but not incore mp->qflags
* if this is the root filesystem.
*/
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
qf = mp->m_sb.sb_qflags;
mp->m_sb.sb_qflags = qf | flags;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);

/*
* There's nothing to change if it's the same.
Expand Down Expand Up @@ -815,7 +813,6 @@ xfs_qm_log_quotaoff(
{
xfs_trans_t *tp;
int error;
unsigned long s;
xfs_qoff_logitem_t *qoffi=NULL;
uint oldsbqflag=0;

Expand All @@ -832,10 +829,10 @@ xfs_qm_log_quotaoff(
qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT);
xfs_trans_log_quotaoff_item(tp, qoffi);

s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
oldsbqflag = mp->m_sb.sb_qflags;
mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);

xfs_mod_sb(tp, XFS_SB_QFLAGS);

Expand All @@ -854,9 +851,9 @@ xfs_qm_log_quotaoff(
* No one else is modifying sb_qflags, so this is OK.
* We still hold the quotaofflock.
*/
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
mp->m_sb.sb_qflags = oldsbqflag;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
}
*qoffstartp = qoffi;
return (error);
Expand Down
8 changes: 3 additions & 5 deletions trunk/fs/xfs/xfs_attr_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,15 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
STATIC void
xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
{
unsigned long s;

if ((mp->m_flags & XFS_MOUNT_ATTR2) &&
!(XFS_SB_VERSION_HASATTR2(&mp->m_sb))) {
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
XFS_SB_VERSION_ADDATTR2(&mp->m_sb);
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
} else
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
}
}

Expand Down
7 changes: 3 additions & 4 deletions trunk/fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3956,7 +3956,6 @@ xfs_bmap_add_attrfork(
xfs_bmap_free_t flist; /* freed extent records */
xfs_mount_t *mp; /* mount structure */
xfs_trans_t *tp; /* transaction pointer */
unsigned long s; /* spinlock spl value */
int blks; /* space reservation */
int version = 1; /* superblock attr version */
int committed; /* xaction was committed */
Expand Down Expand Up @@ -4053,7 +4052,7 @@ xfs_bmap_add_attrfork(
(!XFS_SB_VERSION_HASATTR2(&mp->m_sb) && version == 2)) {
__int64_t sbfields = 0;

s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
if (!XFS_SB_VERSION_HASATTR(&mp->m_sb)) {
XFS_SB_VERSION_ADDATTR(&mp->m_sb);
sbfields |= XFS_SB_VERSIONNUM;
Expand All @@ -4063,10 +4062,10 @@ xfs_bmap_add_attrfork(
sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
}
if (sbfields) {
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
xfs_mod_sb(tp, sbfields);
} else
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
}
if ((error = xfs_bmap_finish(&tp, &flist, &committed)))
goto error2;
Expand Down
13 changes: 5 additions & 8 deletions trunk/fs/xfs/xfs_fsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,13 @@ xfs_fs_counts(
xfs_mount_t *mp,
xfs_fsop_counts_t *cnt)
{
unsigned long s;

xfs_icsb_sync_counters_flags(mp, XFS_ICSB_LAZY_COUNT);
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
cnt->freedata = mp->m_sb.sb_fdblocks - XFS_ALLOC_SET_ASIDE(mp);
cnt->freertx = mp->m_sb.sb_frextents;
cnt->freeino = mp->m_sb.sb_ifree;
cnt->allocino = mp->m_sb.sb_icount;
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);
return 0;
}

Expand All @@ -497,7 +495,6 @@ xfs_reserve_blocks(
{
__int64_t lcounter, delta, fdblks_delta;
__uint64_t request;
unsigned long s;

/* If inval is null, report current values and return */
if (inval == (__uint64_t *)NULL) {
Expand All @@ -515,7 +512,7 @@ xfs_reserve_blocks(
* problem. we needto work out if we are freeing or allocation
* blocks first, then we can do the modification as necessary.
*
* We do this under the XFS_SB_LOCK so that if we are near
* We do this under the m_sb_lock so that if we are near
* ENOSPC, we will hold out any changes while we work out
* what to do. This means that the amount of free space can
* change while we do this, so we need to retry if we end up
Expand All @@ -526,7 +523,7 @@ xfs_reserve_blocks(
* enabled, disabled or even compiled in....
*/
retry:
s = XFS_SB_LOCK(mp);
spin_lock(&mp->m_sb_lock);
xfs_icsb_sync_counters_flags(mp, XFS_ICSB_SB_LOCKED);

/*
Expand Down Expand Up @@ -569,7 +566,7 @@ xfs_reserve_blocks(
outval->resblks = mp->m_resblks;
outval->resblks_avail = mp->m_resblks_avail;
}
XFS_SB_UNLOCK(mp, s);
spin_unlock(&mp->m_sb_lock);

if (fdblks_delta) {
/*
Expand Down
Loading

0 comments on commit fa6a515

Please sign in to comment.