Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
465e2def
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
465e2def
编写于
1月 22, 2015
作者:
D
Dave Chinner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'xfs-sb-logging-rework' into for-next
Conflicts: fs/xfs/xfs_mount.c
上级
6bcf0939
074e427b
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
226 addition
and
416 deletion
+226
-416
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_leaf.c
+1
-1
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap.c
+6
-8
fs/xfs/libxfs/xfs_format.h
fs/xfs/libxfs/xfs_format.h
+7
-7
fs/xfs/libxfs/xfs_sb.c
fs/xfs/libxfs/xfs_sb.c
+136
-184
fs/xfs/libxfs/xfs_sb.h
fs/xfs/libxfs/xfs_sb.h
+6
-5
fs/xfs/libxfs/xfs_shared.h
fs/xfs/libxfs/xfs_shared.h
+15
-18
fs/xfs/libxfs/xfs_trans_resv.c
fs/xfs/libxfs/xfs_trans_resv.c
+0
-14
fs/xfs/libxfs/xfs_trans_resv.h
fs/xfs/libxfs/xfs_trans_resv.h
+0
-1
fs/xfs/xfs_fsops.c
fs/xfs/xfs_fsops.c
+1
-32
fs/xfs/xfs_log.c
fs/xfs/xfs_log.c
+15
-3
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+23
-83
fs/xfs/xfs_mount.h
fs/xfs/xfs_mount.h
+2
-3
fs/xfs/xfs_qm.c
fs/xfs/xfs_qm.c
+2
-41
fs/xfs/xfs_qm.h
fs/xfs/xfs_qm.h
+0
-1
fs/xfs/xfs_qm_syscalls.c
fs/xfs/xfs_qm_syscalls.c
+5
-9
fs/xfs/xfs_super.c
fs/xfs/xfs_super.c
+7
-6
未找到文件。
fs/xfs/libxfs/xfs_attr_leaf.c
浏览文件 @
465e2def
...
@@ -403,7 +403,7 @@ xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
...
@@ -403,7 +403,7 @@ xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
))
{
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
))
{
xfs_sb_version_addattr2
(
&
mp
->
m_sb
);
xfs_sb_version_addattr2
(
&
mp
->
m_sb
);
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
xfs_
mod_sb
(
tp
,
XFS_SB_VERSIONNUM
|
XFS_SB_FEATURES2
);
xfs_
log_sb
(
tp
);
}
else
}
else
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
}
}
...
...
fs/xfs/libxfs/xfs_bmap.c
浏览文件 @
465e2def
...
@@ -1221,22 +1221,20 @@ xfs_bmap_add_attrfork(
...
@@ -1221,22 +1221,20 @@ xfs_bmap_add_attrfork(
goto
bmap_cancel
;
goto
bmap_cancel
;
if
(
!
xfs_sb_version_hasattr
(
&
mp
->
m_sb
)
||
if
(
!
xfs_sb_version_hasattr
(
&
mp
->
m_sb
)
||
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
))
{
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
))
{
__int64_t
sbfields
=
0
;
bool
log_sb
=
false
;
spin_lock
(
&
mp
->
m_sb_lock
);
spin_lock
(
&
mp
->
m_sb_lock
);
if
(
!
xfs_sb_version_hasattr
(
&
mp
->
m_sb
))
{
if
(
!
xfs_sb_version_hasattr
(
&
mp
->
m_sb
))
{
xfs_sb_version_addattr
(
&
mp
->
m_sb
);
xfs_sb_version_addattr
(
&
mp
->
m_sb
);
sbfields
|=
XFS_SB_VERSIONNUM
;
log_sb
=
true
;
}
}
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
)
{
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
)
{
xfs_sb_version_addattr2
(
&
mp
->
m_sb
);
xfs_sb_version_addattr2
(
&
mp
->
m_sb
);
sbfields
|=
(
XFS_SB_VERSIONNUM
|
XFS_SB_FEATURES2
)
;
log_sb
=
true
;
}
}
if
(
sbfields
)
{
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
if
(
log_sb
)
xfs_mod_sb
(
tp
,
sbfields
);
xfs_log_sb
(
tp
);
}
else
spin_unlock
(
&
mp
->
m_sb_lock
);
}
}
error
=
xfs_bmap_finish
(
&
tp
,
&
flist
,
&
committed
);
error
=
xfs_bmap_finish
(
&
tp
,
&
flist
,
&
committed
);
...
...
fs/xfs/libxfs/xfs_format.h
浏览文件 @
465e2def
...
@@ -151,10 +151,13 @@ typedef struct xfs_sb {
...
@@ -151,10 +151,13 @@ typedef struct xfs_sb {
__uint32_t
sb_features2
;
/* additional feature bits */
__uint32_t
sb_features2
;
/* additional feature bits */
/*
/*
* bad features2 field as a result of failing to pad the sb
* bad features2 field as a result of failing to pad the sb structure to
* structure to 64 bits. Some machines will be using this field
* 64 bits. Some machines will be using this field for features2 bits.
* for features2 bits. Easiest just to mark it bad and not use
* Easiest just to mark it bad and not use it for anything else.
* it for anything else.
*
* This is not kept up to date in memory; it is always overwritten by
* the value in sb_features2 when formatting the incore superblock to
* the disk buffer.
*/
*/
__uint32_t
sb_bad_features2
;
__uint32_t
sb_bad_features2
;
...
@@ -453,13 +456,11 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
...
@@ -453,13 +456,11 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
{
{
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_features2
|=
XFS_SB_VERSION2_ATTR2BIT
;
sbp
->
sb_features2
|=
XFS_SB_VERSION2_ATTR2BIT
;
sbp
->
sb_bad_features2
|=
XFS_SB_VERSION2_ATTR2BIT
;
}
}
static
inline
void
xfs_sb_version_removeattr2
(
struct
xfs_sb
*
sbp
)
static
inline
void
xfs_sb_version_removeattr2
(
struct
xfs_sb
*
sbp
)
{
{
sbp
->
sb_features2
&=
~
XFS_SB_VERSION2_ATTR2BIT
;
sbp
->
sb_features2
&=
~
XFS_SB_VERSION2_ATTR2BIT
;
sbp
->
sb_bad_features2
&=
~
XFS_SB_VERSION2_ATTR2BIT
;
if
(
!
sbp
->
sb_features2
)
if
(
!
sbp
->
sb_features2
)
sbp
->
sb_versionnum
&=
~
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_versionnum
&=
~
XFS_SB_VERSION_MOREBITSBIT
;
}
}
...
@@ -475,7 +476,6 @@ static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
...
@@ -475,7 +476,6 @@ static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
{
{
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_features2
|=
XFS_SB_VERSION2_PROJID32BIT
;
sbp
->
sb_features2
|=
XFS_SB_VERSION2_PROJID32BIT
;
sbp
->
sb_bad_features2
|=
XFS_SB_VERSION2_PROJID32BIT
;
}
}
/*
/*
...
...
fs/xfs/libxfs/xfs_sb.c
浏览文件 @
465e2def
...
@@ -40,69 +40,6 @@
...
@@ -40,69 +40,6 @@
* Physical superblock buffer manipulations. Shared with libxfs in userspace.
* Physical superblock buffer manipulations. Shared with libxfs in userspace.
*/
*/
static
const
struct
{
short
offset
;
short
type
;
/* 0 = integer
* 1 = binary / string (no translation)
*/
}
xfs_sb_info
[]
=
{
{
offsetof
(
xfs_sb_t
,
sb_magicnum
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_blocksize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_dblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rextents
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_uuid
),
1
},
{
offsetof
(
xfs_sb_t
,
sb_logstart
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rootino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rbmino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rsumino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rextsize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_agblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_agcount
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rbmblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_versionnum
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_sectsize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inodesize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inopblock
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_fname
[
0
]),
1
},
{
offsetof
(
xfs_sb_t
,
sb_blocklog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_sectlog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inodelog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inopblog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_agblklog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_rextslog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inprogress
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_imax_pct
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_icount
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_ifree
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_fdblocks
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_frextents
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_uquotino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_gquotino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_qflags
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_flags
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_shared_vn
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_inoalignmt
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_unit
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_width
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_dirblklog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logsectlog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logsectsize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logsunit
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_features2
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_bad_features2
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_features_compat
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_features_ro_compat
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_features_incompat
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_features_log_incompat
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_crc
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_pad
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_pquotino
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_lsn
),
0
},
{
sizeof
(
xfs_sb_t
),
0
}
};
/*
/*
* Reference counting access wrappers to the perag structures.
* Reference counting access wrappers to the perag structures.
* Because we never free per-ag structures, the only thing we
* Because we never free per-ag structures, the only thing we
...
@@ -461,58 +398,49 @@ xfs_sb_from_disk(
...
@@ -461,58 +398,49 @@ xfs_sb_from_disk(
__xfs_sb_from_disk
(
to
,
from
,
true
);
__xfs_sb_from_disk
(
to
,
from
,
true
);
}
}
static
inline
void
static
void
xfs_sb_quota_to_disk
(
xfs_sb_quota_to_disk
(
xfs_dsb_t
*
to
,
struct
xfs_dsb
*
to
,
xfs_sb_t
*
from
,
struct
xfs_sb
*
from
)
__int64_t
*
fields
)
{
{
__uint16_t
qflags
=
from
->
sb_qflags
;
__uint16_t
qflags
=
from
->
sb_qflags
;
to
->
sb_uquotino
=
cpu_to_be64
(
from
->
sb_uquotino
);
if
(
xfs_sb_version_has_pquotino
(
from
))
{
to
->
sb_qflags
=
cpu_to_be16
(
from
->
sb_qflags
);
to
->
sb_gquotino
=
cpu_to_be64
(
from
->
sb_gquotino
);
to
->
sb_pquotino
=
cpu_to_be64
(
from
->
sb_pquotino
);
return
;
}
/*
/*
* We need to do these manipilations only if we are working
* The in-core version of sb_qflags do not have XFS_OQUOTA_*
* with an older version of on-disk superblock.
* flags, whereas the on-disk version does. So, convert incore
* XFS_{PG}QUOTA_* flags to on-disk XFS_OQUOTA_* flags.
*/
*/
if
(
xfs_sb_version_has_pquotino
(
from
))
qflags
&=
~
(
XFS_PQUOTA_ENFD
|
XFS_PQUOTA_CHKD
|
return
;
XFS_GQUOTA_ENFD
|
XFS_GQUOTA_CHKD
)
;
if
(
*
fields
&
XFS_SB_QFLAGS
)
{
if
(
from
->
sb_qflags
&
/*
(
XFS_PQUOTA_ENFD
|
XFS_GQUOTA_ENFD
))
* The in-core version of sb_qflags do not have
qflags
|=
XFS_OQUOTA_ENFD
;
* XFS_OQUOTA_* flags, whereas the on-disk version
if
(
from
->
sb_qflags
&
* does. So, convert incore XFS_{PG}QUOTA_* flags
(
XFS_PQUOTA_CHKD
|
XFS_GQUOTA_CHKD
))
* to on-disk XFS_OQUOTA_* flags.
qflags
|=
XFS_OQUOTA_CHKD
;
*/
to
->
sb_qflags
=
cpu_to_be16
(
qflags
);
qflags
&=
~
(
XFS_PQUOTA_ENFD
|
XFS_PQUOTA_CHKD
|
XFS_GQUOTA_ENFD
|
XFS_GQUOTA_CHKD
);
if
(
from
->
sb_qflags
&
(
XFS_PQUOTA_ENFD
|
XFS_GQUOTA_ENFD
))
qflags
|=
XFS_OQUOTA_ENFD
;
if
(
from
->
sb_qflags
&
(
XFS_PQUOTA_CHKD
|
XFS_GQUOTA_CHKD
))
qflags
|=
XFS_OQUOTA_CHKD
;
to
->
sb_qflags
=
cpu_to_be16
(
qflags
);
*
fields
&=
~
XFS_SB_QFLAGS
;
}
/*
/*
* GQUOTINO and PQUOTINO cannot be used together in versions of
* GQUOTINO and PQUOTINO cannot be used together in versions
* superblock that do not have pquotino. from->sb_flags tells us which
* of superblock that do not have pquotino. from->sb_flags
* quota is active and should be copied to disk. If neither are active,
* tells us which quota is active and should be copied to
* make sure we write NULLFSINO to the sb_gquotino field as a quota
* disk. If neither are active, we should NULL the inode.
* inode value of "0" is invalid when the XFS_SB_VERSION_QUOTA feature
* bit is set.
*
*
* Note that we don't need to handle the sb_uquotino or sb_pquotino here
* In all cases, the separate pquotino must remain 0 because it
* as they do not require any translation. Hence the main sb field loop
* it beyond the "end" of the valid non-pquotino superblock.
* will write them appropriately from the in-core superblock.
*/
*/
if
((
*
fields
&
XFS_SB_GQUOTINO
)
&&
if
(
from
->
sb_qflags
&
XFS_GQUOTA_ACCT
)
(
from
->
sb_qflags
&
XFS_GQUOTA_ACCT
))
to
->
sb_gquotino
=
cpu_to_be64
(
from
->
sb_gquotino
);
to
->
sb_gquotino
=
cpu_to_be64
(
from
->
sb_gquotino
);
else
if
((
*
fields
&
XFS_SB_PQUOTINO
)
&&
else
if
(
from
->
sb_qflags
&
XFS_PQUOTA_ACCT
)
(
from
->
sb_qflags
&
XFS_PQUOTA_ACCT
))
to
->
sb_gquotino
=
cpu_to_be64
(
from
->
sb_pquotino
);
to
->
sb_gquotino
=
cpu_to_be64
(
from
->
sb_pquotino
);
else
{
else
{
/*
/*
...
@@ -526,63 +454,78 @@ xfs_sb_quota_to_disk(
...
@@ -526,63 +454,78 @@ xfs_sb_quota_to_disk(
to
->
sb_gquotino
=
cpu_to_be64
(
NULLFSINO
);
to
->
sb_gquotino
=
cpu_to_be64
(
NULLFSINO
);
}
}
*
fields
&=
~
(
XFS_SB_PQUOTINO
|
XFS_SB_GQUOTINO
)
;
to
->
sb_pquotino
=
0
;
}
}
/*
* Copy in core superblock to ondisk one.
*
* The fields argument is mask of superblock fields to copy.
*/
void
void
xfs_sb_to_disk
(
xfs_sb_to_disk
(
xfs_dsb_t
*
to
,
struct
xfs_dsb
*
to
,
xfs_sb_t
*
from
,
struct
xfs_sb
*
from
)
__int64_t
fields
)
{
{
xfs_caddr_t
to_ptr
=
(
xfs_caddr_t
)
to
;
xfs_sb_quota_to_disk
(
to
,
from
);
xfs_caddr_t
from_ptr
=
(
xfs_caddr_t
)
from
;
xfs_sb_field_t
f
;
int
first
;
int
size
;
ASSERT
(
fields
);
if
(
!
fields
)
return
;
/* We should never write the crc here, it's updated in the IO path */
to
->
sb_magicnum
=
cpu_to_be32
(
from
->
sb_magicnum
);
fields
&=
~
XFS_SB_CRC
;
to
->
sb_blocksize
=
cpu_to_be32
(
from
->
sb_blocksize
);
to
->
sb_dblocks
=
cpu_to_be64
(
from
->
sb_dblocks
);
xfs_sb_quota_to_disk
(
to
,
from
,
&
fields
);
to
->
sb_rblocks
=
cpu_to_be64
(
from
->
sb_rblocks
);
while
(
fields
)
{
to
->
sb_rextents
=
cpu_to_be64
(
from
->
sb_rextents
);
f
=
(
xfs_sb_field_t
)
xfs_lowbit64
((
__uint64_t
)
fields
);
memcpy
(
&
to
->
sb_uuid
,
&
from
->
sb_uuid
,
sizeof
(
to
->
sb_uuid
));
first
=
xfs_sb_info
[
f
].
offset
;
to
->
sb_logstart
=
cpu_to_be64
(
from
->
sb_logstart
);
size
=
xfs_sb_info
[
f
+
1
].
offset
-
first
;
to
->
sb_rootino
=
cpu_to_be64
(
from
->
sb_rootino
);
to
->
sb_rbmino
=
cpu_to_be64
(
from
->
sb_rbmino
);
ASSERT
(
xfs_sb_info
[
f
].
type
==
0
||
xfs_sb_info
[
f
].
type
==
1
);
to
->
sb_rsumino
=
cpu_to_be64
(
from
->
sb_rsumino
);
to
->
sb_rextsize
=
cpu_to_be32
(
from
->
sb_rextsize
);
if
(
size
==
1
||
xfs_sb_info
[
f
].
type
==
1
)
{
to
->
sb_agblocks
=
cpu_to_be32
(
from
->
sb_agblocks
);
memcpy
(
to_ptr
+
first
,
from_ptr
+
first
,
size
);
to
->
sb_agcount
=
cpu_to_be32
(
from
->
sb_agcount
);
}
else
{
to
->
sb_rbmblocks
=
cpu_to_be32
(
from
->
sb_rbmblocks
);
switch
(
size
)
{
to
->
sb_logblocks
=
cpu_to_be32
(
from
->
sb_logblocks
);
case
2
:
to
->
sb_versionnum
=
cpu_to_be16
(
from
->
sb_versionnum
);
*
(
__be16
*
)(
to_ptr
+
first
)
=
to
->
sb_sectsize
=
cpu_to_be16
(
from
->
sb_sectsize
);
cpu_to_be16
(
*
(
__u16
*
)(
from_ptr
+
first
));
to
->
sb_inodesize
=
cpu_to_be16
(
from
->
sb_inodesize
);
break
;
to
->
sb_inopblock
=
cpu_to_be16
(
from
->
sb_inopblock
);
case
4
:
memcpy
(
&
to
->
sb_fname
,
&
from
->
sb_fname
,
sizeof
(
to
->
sb_fname
));
*
(
__be32
*
)(
to_ptr
+
first
)
=
to
->
sb_blocklog
=
from
->
sb_blocklog
;
cpu_to_be32
(
*
(
__u32
*
)(
from_ptr
+
first
));
to
->
sb_sectlog
=
from
->
sb_sectlog
;
break
;
to
->
sb_inodelog
=
from
->
sb_inodelog
;
case
8
:
to
->
sb_inopblog
=
from
->
sb_inopblog
;
*
(
__be64
*
)(
to_ptr
+
first
)
=
to
->
sb_agblklog
=
from
->
sb_agblklog
;
cpu_to_be64
(
*
(
__u64
*
)(
from_ptr
+
first
));
to
->
sb_rextslog
=
from
->
sb_rextslog
;
break
;
to
->
sb_inprogress
=
from
->
sb_inprogress
;
default:
to
->
sb_imax_pct
=
from
->
sb_imax_pct
;
ASSERT
(
0
);
to
->
sb_icount
=
cpu_to_be64
(
from
->
sb_icount
);
}
to
->
sb_ifree
=
cpu_to_be64
(
from
->
sb_ifree
);
}
to
->
sb_fdblocks
=
cpu_to_be64
(
from
->
sb_fdblocks
);
to
->
sb_frextents
=
cpu_to_be64
(
from
->
sb_frextents
);
fields
&=
~
(
1LL
<<
f
);
to
->
sb_flags
=
from
->
sb_flags
;
to
->
sb_shared_vn
=
from
->
sb_shared_vn
;
to
->
sb_inoalignmt
=
cpu_to_be32
(
from
->
sb_inoalignmt
);
to
->
sb_unit
=
cpu_to_be32
(
from
->
sb_unit
);
to
->
sb_width
=
cpu_to_be32
(
from
->
sb_width
);
to
->
sb_dirblklog
=
from
->
sb_dirblklog
;
to
->
sb_logsectlog
=
from
->
sb_logsectlog
;
to
->
sb_logsectsize
=
cpu_to_be16
(
from
->
sb_logsectsize
);
to
->
sb_logsunit
=
cpu_to_be32
(
from
->
sb_logsunit
);
/*
* We need to ensure that bad_features2 always matches features2.
* Hence we enforce that here rather than having to remember to do it
* everywhere else that updates features2.
*/
from
->
sb_bad_features2
=
from
->
sb_features2
;
to
->
sb_features2
=
cpu_to_be32
(
from
->
sb_features2
);
to
->
sb_bad_features2
=
cpu_to_be32
(
from
->
sb_bad_features2
);
if
(
xfs_sb_version_hascrc
(
from
))
{
to
->
sb_features_compat
=
cpu_to_be32
(
from
->
sb_features_compat
);
to
->
sb_features_ro_compat
=
cpu_to_be32
(
from
->
sb_features_ro_compat
);
to
->
sb_features_incompat
=
cpu_to_be32
(
from
->
sb_features_incompat
);
to
->
sb_features_log_incompat
=
cpu_to_be32
(
from
->
sb_features_log_incompat
);
to
->
sb_pad
=
0
;
to
->
sb_lsn
=
cpu_to_be64
(
from
->
sb_lsn
);
}
}
}
}
...
@@ -816,42 +759,51 @@ xfs_initialize_perag_data(
...
@@ -816,42 +759,51 @@ xfs_initialize_perag_data(
}
}
/*
/*
* xfs_mod_sb() can be used to copy arbitrary changes to the
* xfs_log_sb() can be used to copy arbitrary changes to the in-core superblock
* in-core superblock into the superblock buffer to be logged.
* into the superblock buffer to be logged. It does not provide the higher
* It does not provide the higher level of locking that is
* level of locking that is needed to protect the in-core superblock from
* needed to protect the in-core superblock from concurrent
* concurrent access.
* access.
*/
*/
void
void
xfs_mod_sb
(
xfs_trans_t
*
tp
,
__int64_t
fields
)
xfs_log_sb
(
struct
xfs_trans
*
tp
)
{
{
xfs_buf_t
*
bp
;
struct
xfs_mount
*
mp
=
tp
->
t_mountp
;
int
first
;
struct
xfs_buf
*
bp
=
xfs_trans_getsb
(
tp
,
mp
,
0
);
int
last
;
xfs_mount_t
*
mp
;
xfs_sb_field_t
f
;
ASSERT
(
fields
);
if
(
!
fields
)
return
;
mp
=
tp
->
t_mountp
;
bp
=
xfs_trans_getsb
(
tp
,
mp
,
0
);
first
=
sizeof
(
xfs_sb_t
);
last
=
0
;
/* translate/copy */
xfs_sb_to_disk
(
XFS_BUF_TO_SBP
(
bp
),
&
mp
->
m_sb
,
fields
);
xfs_sb_to_disk
(
XFS_BUF_TO_SBP
(
bp
),
&
mp
->
m_sb
);
xfs_trans_buf_set_type
(
tp
,
bp
,
XFS_BLFT_SB_BUF
);
xfs_trans_log_buf
(
tp
,
bp
,
0
,
sizeof
(
struct
xfs_dsb
));
}
/* find modified range */
/*
f
=
(
xfs_sb_field_t
)
xfs_highbit64
((
__uint64_t
)
fields
);
* xfs_sync_sb
ASSERT
((
1LL
<<
f
)
&
XFS_SB_MOD_BITS
);
*
last
=
xfs_sb_info
[
f
+
1
].
offset
-
1
;
* Sync the superblock to disk.
*
* Note that the caller is responsible for checking the frozen state of the
* filesystem. This procedure uses the non-blocking transaction allocator and
* thus will allow modifications to a frozen fs. This is required because this
* code can be called during the process of freezing where use of the high-level
* allocator would deadlock.
*/
int
xfs_sync_sb
(
struct
xfs_mount
*
mp
,
bool
wait
)
{
struct
xfs_trans
*
tp
;
int
error
;
f
=
(
xfs_sb_field_t
)
xfs_lowbit64
((
__uint64_t
)
fields
);
tp
=
_xfs_trans_alloc
(
mp
,
XFS_TRANS_SB_CHANGE
,
KM_SLEEP
);
ASSERT
((
1LL
<<
f
)
&
XFS_SB_MOD_BITS
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_sb
,
0
,
0
);
first
=
xfs_sb_info
[
f
].
offset
;
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
return
error
;
}
xfs_trans_buf_set_type
(
tp
,
bp
,
XFS_BLFT_SB_BUF
);
xfs_log_sb
(
tp
);
xfs_trans_log_buf
(
tp
,
bp
,
first
,
last
);
if
(
wait
)
xfs_trans_set_sync
(
tp
);
return
xfs_trans_commit
(
tp
,
0
);
}
}
fs/xfs/libxfs/xfs_sb.h
浏览文件 @
465e2def
...
@@ -27,11 +27,12 @@ extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber_t,
...
@@ -27,11 +27,12 @@ extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber_t,
extern
void
xfs_perag_put
(
struct
xfs_perag
*
pag
);
extern
void
xfs_perag_put
(
struct
xfs_perag
*
pag
);
extern
int
xfs_initialize_perag_data
(
struct
xfs_mount
*
,
xfs_agnumber_t
);
extern
int
xfs_initialize_perag_data
(
struct
xfs_mount
*
,
xfs_agnumber_t
);
extern
void
xfs_sb_calc_crc
(
struct
xfs_buf
*
);
extern
void
xfs_sb_calc_crc
(
struct
xfs_buf
*
bp
);
extern
void
xfs_mod_sb
(
struct
xfs_trans
*
,
__int64_t
);
extern
void
xfs_log_sb
(
struct
xfs_trans
*
tp
);
extern
void
xfs_sb_mount_common
(
struct
xfs_mount
*
,
struct
xfs_sb
*
);
extern
int
xfs_sync_sb
(
struct
xfs_mount
*
mp
,
bool
wait
);
extern
void
xfs_sb_from_disk
(
struct
xfs_sb
*
,
struct
xfs_dsb
*
);
extern
void
xfs_sb_mount_common
(
struct
xfs_mount
*
mp
,
struct
xfs_sb
*
sbp
);
extern
void
xfs_sb_to_disk
(
struct
xfs_dsb
*
,
struct
xfs_sb
*
,
__int64_t
);
extern
void
xfs_sb_from_disk
(
struct
xfs_sb
*
to
,
struct
xfs_dsb
*
from
);
extern
void
xfs_sb_to_disk
(
struct
xfs_dsb
*
to
,
struct
xfs_sb
*
from
);
extern
void
xfs_sb_quota_from_disk
(
struct
xfs_sb
*
sbp
);
extern
void
xfs_sb_quota_from_disk
(
struct
xfs_sb
*
sbp
);
#endif
/* __XFS_SB_H__ */
#endif
/* __XFS_SB_H__ */
fs/xfs/libxfs/xfs_shared.h
浏览文件 @
465e2def
...
@@ -82,7 +82,7 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
...
@@ -82,7 +82,7 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
#define XFS_TRANS_ATTR_RM 23
#define XFS_TRANS_ATTR_RM 23
#define XFS_TRANS_ATTR_FLAG 24
#define XFS_TRANS_ATTR_FLAG 24
#define XFS_TRANS_CLEAR_AGI_BUCKET 25
#define XFS_TRANS_CLEAR_AGI_BUCKET 25
#define XFS_TRANS_
QM_SB
CHANGE 26
#define XFS_TRANS_
SB_
CHANGE 26
/*
/*
* Dummy entries since we use the transaction type to index into the
* Dummy entries since we use the transaction type to index into the
* trans_type[] in xlog_recover_print_trans_head()
* trans_type[] in xlog_recover_print_trans_head()
...
@@ -95,17 +95,15 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
...
@@ -95,17 +95,15 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
#define XFS_TRANS_QM_DQCLUSTER 32
#define XFS_TRANS_QM_DQCLUSTER 32
#define XFS_TRANS_QM_QINOCREATE 33
#define XFS_TRANS_QM_QINOCREATE 33
#define XFS_TRANS_QM_QUOTAOFF_END 34
#define XFS_TRANS_QM_QUOTAOFF_END 34
#define XFS_TRANS_SB_UNIT 35
#define XFS_TRANS_FSYNC_TS 35
#define XFS_TRANS_FSYNC_TS 36
#define XFS_TRANS_GROWFSRT_ALLOC 36
#define XFS_TRANS_GROWFSRT_ALLOC 37
#define XFS_TRANS_GROWFSRT_ZERO 37
#define XFS_TRANS_GROWFSRT_ZERO 38
#define XFS_TRANS_GROWFSRT_FREE 38
#define XFS_TRANS_GROWFSRT_FREE 39
#define XFS_TRANS_SWAPEXT 39
#define XFS_TRANS_SWAPEXT 40
#define XFS_TRANS_CHECKPOINT 40
#define XFS_TRANS_SB_COUNT 41
#define XFS_TRANS_ICREATE 41
#define XFS_TRANS_CHECKPOINT 42
#define XFS_TRANS_CREATE_TMPFILE 42
#define XFS_TRANS_ICREATE 43
#define XFS_TRANS_TYPE_MAX 43
#define XFS_TRANS_CREATE_TMPFILE 44
#define XFS_TRANS_TYPE_MAX 44
/* new transaction types need to be reflected in xfs_logprint(8) */
/* new transaction types need to be reflected in xfs_logprint(8) */
#define XFS_TRANS_TYPES \
#define XFS_TRANS_TYPES \
...
@@ -113,7 +111,6 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
...
@@ -113,7 +111,6 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
{ XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \
{ XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \
{ XFS_TRANS_INACTIVE, "INACTIVE" }, \
{ XFS_TRANS_INACTIVE, "INACTIVE" }, \
{ XFS_TRANS_CREATE, "CREATE" }, \
{ XFS_TRANS_CREATE, "CREATE" }, \
{ XFS_TRANS_CREATE_TMPFILE, "CREATE_TMPFILE" }, \
{ XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \
{ XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \
{ XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \
{ XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \
{ XFS_TRANS_REMOVE, "REMOVE" }, \
{ XFS_TRANS_REMOVE, "REMOVE" }, \
...
@@ -134,23 +131,23 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
...
@@ -134,23 +131,23 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
{ XFS_TRANS_ATTR_RM, "ATTR_RM" }, \
{ XFS_TRANS_ATTR_RM, "ATTR_RM" }, \
{ XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \
{ XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \
{ XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \
{ XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \
{ XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \
{ XFS_TRANS_SB_CHANGE, "SBCHANGE" }, \
{ XFS_TRANS_DUMMY1, "DUMMY1" }, \
{ XFS_TRANS_DUMMY2, "DUMMY2" }, \
{ XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \
{ XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \
{ XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \
{ XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \
{ XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \
{ XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \
{ XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \
{ XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \
{ XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \
{ XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \
{ XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \
{ XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \
{ XFS_TRANS_SB_UNIT, "SB_UNIT" }, \
{ XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \
{ XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \
{ XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \
{ XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \
{ XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \
{ XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \
{ XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \
{ XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \
{ XFS_TRANS_SWAPEXT, "SWAPEXT" }, \
{ XFS_TRANS_SWAPEXT, "SWAPEXT" }, \
{ XFS_TRANS_SB_COUNT, "SB_COUNT" }, \
{ XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \
{ XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \
{ XFS_TRANS_
DUMMY1, "DUMMY1
" }, \
{ XFS_TRANS_
ICREATE, "ICREATE
" }, \
{ XFS_TRANS_
DUMMY2, "DUMMY2
" }, \
{ XFS_TRANS_
CREATE_TMPFILE, "CREATE_TMPFILE
" }, \
{ XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" }
{ XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" }
/*
/*
...
...
fs/xfs/libxfs/xfs_trans_resv.c
浏览文件 @
465e2def
...
@@ -715,17 +715,6 @@ xfs_calc_clear_agi_bucket_reservation(
...
@@ -715,17 +715,6 @@ xfs_calc_clear_agi_bucket_reservation(
return
xfs_calc_buf_res
(
1
,
mp
->
m_sb
.
sb_sectsize
);
return
xfs_calc_buf_res
(
1
,
mp
->
m_sb
.
sb_sectsize
);
}
}
/*
* Clearing the quotaflags in the superblock.
* the super block for changing quota flags: sector size
*/
STATIC
uint
xfs_calc_qm_sbchange_reservation
(
struct
xfs_mount
*
mp
)
{
return
xfs_calc_buf_res
(
1
,
mp
->
m_sb
.
sb_sectsize
);
}
/*
/*
* Adjusting quota limits.
* Adjusting quota limits.
* the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
* the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
...
@@ -864,9 +853,6 @@ xfs_trans_resv_calc(
...
@@ -864,9 +853,6 @@ xfs_trans_resv_calc(
* The following transactions are logged in logical format with
* The following transactions are logged in logical format with
* a default log count.
* a default log count.
*/
*/
resp
->
tr_qm_sbchange
.
tr_logres
=
xfs_calc_qm_sbchange_reservation
(
mp
);
resp
->
tr_qm_sbchange
.
tr_logcount
=
XFS_DEFAULT_LOG_COUNT
;
resp
->
tr_qm_setqlim
.
tr_logres
=
xfs_calc_qm_setqlim_reservation
(
mp
);
resp
->
tr_qm_setqlim
.
tr_logres
=
xfs_calc_qm_setqlim_reservation
(
mp
);
resp
->
tr_qm_setqlim
.
tr_logcount
=
XFS_DEFAULT_LOG_COUNT
;
resp
->
tr_qm_setqlim
.
tr_logcount
=
XFS_DEFAULT_LOG_COUNT
;
...
...
fs/xfs/libxfs/xfs_trans_resv.h
浏览文件 @
465e2def
...
@@ -56,7 +56,6 @@ struct xfs_trans_resv {
...
@@ -56,7 +56,6 @@ struct xfs_trans_resv {
struct
xfs_trans_res
tr_growrtalloc
;
/* grow realtime allocations */
struct
xfs_trans_res
tr_growrtalloc
;
/* grow realtime allocations */
struct
xfs_trans_res
tr_growrtzero
;
/* grow realtime zeroing */
struct
xfs_trans_res
tr_growrtzero
;
/* grow realtime zeroing */
struct
xfs_trans_res
tr_growrtfree
;
/* grow realtime freeing */
struct
xfs_trans_res
tr_growrtfree
;
/* grow realtime freeing */
struct
xfs_trans_res
tr_qm_sbchange
;
/* change quota flags */
struct
xfs_trans_res
tr_qm_setqlim
;
/* adjust quota limits */
struct
xfs_trans_res
tr_qm_setqlim
;
/* adjust quota limits */
struct
xfs_trans_res
tr_qm_dqalloc
;
/* allocate quota on disk */
struct
xfs_trans_res
tr_qm_dqalloc
;
/* allocate quota on disk */
struct
xfs_trans_res
tr_qm_quotaoff
;
/* turn quota off */
struct
xfs_trans_res
tr_qm_quotaoff
;
/* turn quota off */
...
...
fs/xfs/xfs_fsops.c
浏览文件 @
465e2def
...
@@ -541,7 +541,7 @@ xfs_growfs_data_private(
...
@@ -541,7 +541,7 @@ xfs_growfs_data_private(
saved_error
=
error
;
saved_error
=
error
;
continue
;
continue
;
}
}
xfs_sb_to_disk
(
XFS_BUF_TO_SBP
(
bp
),
&
mp
->
m_sb
,
XFS_SB_ALL_BITS
);
xfs_sb_to_disk
(
XFS_BUF_TO_SBP
(
bp
),
&
mp
->
m_sb
);
error
=
xfs_bwrite
(
bp
);
error
=
xfs_bwrite
(
bp
);
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
...
@@ -756,37 +756,6 @@ xfs_reserve_blocks(
...
@@ -756,37 +756,6 @@ xfs_reserve_blocks(
return
0
;
return
0
;
}
}
/*
* Dump a transaction into the log that contains no real change. This is needed
* to be able to make the log dirty or stamp the current tail LSN into the log
* during the covering operation.
*
* We cannot use an inode here for this - that will push dirty state back up
* into the VFS and then periodic inode flushing will prevent log covering from
* making progress. Hence we log a field in the superblock instead and use a
* synchronous transaction to ensure the superblock is immediately unpinned
* and can be written back.
*/
int
xfs_fs_log_dummy
(
xfs_mount_t
*
mp
)
{
xfs_trans_t
*
tp
;
int
error
;
tp
=
_xfs_trans_alloc
(
mp
,
XFS_TRANS_DUMMY1
,
KM_SLEEP
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_sb
,
0
,
0
);
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
return
error
;
}
/* log the UUID because it is an unchanging field */
xfs_mod_sb
(
tp
,
XFS_SB_UUID
);
xfs_trans_set_sync
(
tp
);
return
xfs_trans_commit
(
tp
,
0
);
}
int
int
xfs_fs_goingdown
(
xfs_fs_goingdown
(
xfs_mount_t
*
mp
,
xfs_mount_t
*
mp
,
...
...
fs/xfs/xfs_log.c
浏览文件 @
465e2def
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "xfs_fsops.h"
#include "xfs_fsops.h"
#include "xfs_cksum.h"
#include "xfs_cksum.h"
#include "xfs_sysfs.h"
#include "xfs_sysfs.h"
#include "xfs_sb.h"
kmem_zone_t
*
xfs_log_ticket_zone
;
kmem_zone_t
*
xfs_log_ticket_zone
;
...
@@ -1290,9 +1291,20 @@ xfs_log_worker(
...
@@ -1290,9 +1291,20 @@ xfs_log_worker(
struct
xfs_mount
*
mp
=
log
->
l_mp
;
struct
xfs_mount
*
mp
=
log
->
l_mp
;
/* dgc: errors ignored - not fatal and nowhere to report them */
/* dgc: errors ignored - not fatal and nowhere to report them */
if
(
xfs_log_need_covered
(
mp
))
if
(
xfs_log_need_covered
(
mp
))
{
xfs_fs_log_dummy
(
mp
);
/*
else
* Dump a transaction into the log that contains no real change.
* This is needed to stamp the current tail LSN into the log
* during the covering operation.
*
* We cannot use an inode here for this - that will push dirty
* state back up into the VFS and then periodic inode flushing
* will prevent log covering from making progress. Hence we
* synchronously log the superblock instead to ensure the
* superblock is immediately unpinned and can be written back.
*/
xfs_sync_sb
(
mp
,
true
);
}
else
xfs_log_force
(
mp
,
0
);
xfs_log_force
(
mp
,
0
);
/* start pushing all the metadata that is currently dirty */
/* start pushing all the metadata that is currently dirty */
...
...
fs/xfs/xfs_mount.c
浏览文件 @
465e2def
...
@@ -408,11 +408,11 @@ xfs_update_alignment(xfs_mount_t *mp)
...
@@ -408,11 +408,11 @@ xfs_update_alignment(xfs_mount_t *mp)
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
;
mp
->
m_update_
flags
|=
XFS_SB_UNIT
;
mp
->
m_update_
sb
=
true
;
}
}
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
;
mp
->
m_update_
flags
|=
XFS_SB_WIDTH
;
mp
->
m_update_
sb
=
true
;
}
}
}
else
{
}
else
{
xfs_warn
(
mp
,
xfs_warn
(
mp
,
...
@@ -583,38 +583,19 @@ int
...
@@ -583,38 +583,19 @@ int
xfs_mount_reset_sbqflags
(
xfs_mount_reset_sbqflags
(
struct
xfs_mount
*
mp
)
struct
xfs_mount
*
mp
)
{
{
int
error
;
struct
xfs_trans
*
tp
;
mp
->
m_qflags
=
0
;
mp
->
m_qflags
=
0
;
/*
/* It is OK to look at sb_qflags in the mount path without m_sb_lock. */
* It is OK to look at sb_qflags here in mount path,
* without m_sb_lock.
*/
if
(
mp
->
m_sb
.
sb_qflags
==
0
)
if
(
mp
->
m_sb
.
sb_qflags
==
0
)
return
0
;
return
0
;
spin_lock
(
&
mp
->
m_sb_lock
);
spin_lock
(
&
mp
->
m_sb_lock
);
mp
->
m_sb
.
sb_qflags
=
0
;
mp
->
m_sb
.
sb_qflags
=
0
;
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
/*
if
(
!
xfs_fs_writable
(
mp
,
SB_FREEZE_WRITE
))
* If the fs is readonly, let the incore superblock run
* with quotas off but don't flush the update out to disk
*/
if
(
mp
->
m_flags
&
XFS_MOUNT_RDONLY
)
return
0
;
return
0
;
tp
=
xfs_trans_alloc
(
mp
,
XFS_TRANS_QM_SBCHANGE
);
return
xfs_sync_sb
(
mp
,
false
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_qm_sbchange
,
0
,
0
);
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
xfs_alert
(
mp
,
"%s: Superblock update failed!"
,
__func__
);
return
error
;
}
xfs_mod_sb
(
tp
,
XFS_SB_QFLAGS
);
return
xfs_trans_commit
(
tp
,
0
);
}
}
__uint64_t
__uint64_t
...
@@ -659,26 +640,25 @@ xfs_mountfs(
...
@@ -659,26 +640,25 @@ xfs_mountfs(
xfs_sb_mount_common
(
mp
,
sbp
);
xfs_sb_mount_common
(
mp
,
sbp
);
/*
/*
* Check for a mismatched features2 values. Older kernels
* Check for a mismatched features2 values. Older kernels
read & wrote
*
read & wrote into the wrong sb offset for sb_features2
*
into the wrong sb offset for sb_features2 on some platforms due to
*
on some platforms due to xfs_sb_t not being 64bit size aligned
*
xfs_sb_t not being 64bit size aligned when sb_features2 was added,
* wh
en sb_features2 was added, which made older superblock
* wh
ich made older superblock reading/writing routines swap it as a
*
reading/writing routines swap it as a
64-bit value.
* 64-bit value.
*
*
* For backwards compatibility, we make both slots equal.
* For backwards compatibility, we make both slots equal.
*
*
* If we detect a mismatched field, we OR the set bits into the
* If we detect a mismatched field, we OR the set bits into the
existing
*
existing features2 field in case it has already been modified; we
*
features2 field in case it has already been modified; we don't want
*
don't want to lose any features. We then update the bad location
*
to lose any features. We then update the bad location with the ORed
*
with the ORed value so that older kernels will see any features2
*
value so that older kernels will see any features2 flags. The
*
flags, and mark the two fields as needing updates once the
*
superblock writeback code ensures the new sb_features2 is copied to
*
transaction subsystem is online
.
*
sb_bad_features2 before it is logged or written to disk
.
*/
*/
if
(
xfs_sb_has_mismatched_features2
(
sbp
))
{
if
(
xfs_sb_has_mismatched_features2
(
sbp
))
{
xfs_warn
(
mp
,
"correcting sb_features alignment problem"
);
xfs_warn
(
mp
,
"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
;
mp
->
m_update_sb
=
true
;
mp
->
m_update_flags
|=
XFS_SB_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
...
@@ -692,17 +672,17 @@ xfs_mountfs(
...
@@ -692,17 +672,17 @@ 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
);
mp
->
m_update_
flags
|=
XFS_SB_FEATURES2
;
mp
->
m_update_
sb
=
true
;
/* 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
)
mp
->
m_update_
flags
|=
XFS_SB_VERSIONNUM
;
mp
->
m_update_
sb
=
true
;
}
}
/* always use v2 inodes by default now */
/* always use v2 inodes by default now */
if
(
!
(
mp
->
m_sb
.
sb_versionnum
&
XFS_SB_VERSION_NLINKBIT
))
{
if
(
!
(
mp
->
m_sb
.
sb_versionnum
&
XFS_SB_VERSION_NLINKBIT
))
{
mp
->
m_sb
.
sb_versionnum
|=
XFS_SB_VERSION_NLINKBIT
;
mp
->
m_sb
.
sb_versionnum
|=
XFS_SB_VERSION_NLINKBIT
;
mp
->
m_update_
flags
|=
XFS_SB_VERSIONNUM
;
mp
->
m_update_
sb
=
true
;
}
}
/*
/*
...
@@ -895,8 +875,8 @@ xfs_mountfs(
...
@@ -895,8 +875,8 @@ xfs_mountfs(
* the next remount into writeable mode. Otherwise we would never
* the next remount into writeable mode. Otherwise we would never
* perform the update e.g. for the root filesystem.
* perform the update e.g. for the root filesystem.
*/
*/
if
(
mp
->
m_update_
flags
&&
!
(
mp
->
m_flags
&
XFS_MOUNT_RDONLY
))
{
if
(
mp
->
m_update_
sb
&&
!
(
mp
->
m_flags
&
XFS_MOUNT_RDONLY
))
{
error
=
xfs_
mount_log_sb
(
mp
,
mp
->
m_update_flags
);
error
=
xfs_
sync_sb
(
mp
,
false
);
if
(
error
)
{
if
(
error
)
{
xfs_warn
(
mp
,
"failed to write sb changes"
);
xfs_warn
(
mp
,
"failed to write sb changes"
);
goto
out_rtunmount
;
goto
out_rtunmount
;
...
@@ -1103,9 +1083,6 @@ xfs_fs_writable(
...
@@ -1103,9 +1083,6 @@ xfs_fs_writable(
int
int
xfs_log_sbcount
(
xfs_mount_t
*
mp
)
xfs_log_sbcount
(
xfs_mount_t
*
mp
)
{
{
xfs_trans_t
*
tp
;
int
error
;
/* allow this to proceed during the freeze sequence... */
/* allow this to proceed during the freeze sequence... */
if
(
!
xfs_fs_writable
(
mp
,
SB_FREEZE_COMPLETE
))
if
(
!
xfs_fs_writable
(
mp
,
SB_FREEZE_COMPLETE
))
return
0
;
return
0
;
...
@@ -1119,17 +1096,7 @@ xfs_log_sbcount(xfs_mount_t *mp)
...
@@ -1119,17 +1096,7 @@ xfs_log_sbcount(xfs_mount_t *mp)
if
(
!
xfs_sb_version_haslazysbcount
(
&
mp
->
m_sb
))
if
(
!
xfs_sb_version_haslazysbcount
(
&
mp
->
m_sb
))
return
0
;
return
0
;
tp
=
_xfs_trans_alloc
(
mp
,
XFS_TRANS_SB_COUNT
,
KM_SLEEP
);
return
xfs_sync_sb
(
mp
,
true
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_sb
,
0
,
0
);
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
return
error
;
}
xfs_mod_sb
(
tp
,
XFS_SB_IFREE
|
XFS_SB_ICOUNT
|
XFS_SB_FDBLOCKS
);
xfs_trans_set_sync
(
tp
);
error
=
xfs_trans_commit
(
tp
,
0
);
return
error
;
}
}
/*
/*
...
@@ -1422,33 +1389,6 @@ xfs_freesb(
...
@@ -1422,33 +1389,6 @@ xfs_freesb(
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
}
}
/*
* Used to log changes to the superblock unit and width fields which could
* be altered by the mount options, as well as any potential sb_features2
* fixup. Only the first superblock is updated.
*/
int
xfs_mount_log_sb
(
xfs_mount_t
*
mp
,
__int64_t
fields
)
{
xfs_trans_t
*
tp
;
int
error
;
ASSERT
(
fields
&
(
XFS_SB_UNIT
|
XFS_SB_WIDTH
|
XFS_SB_UUID
|
XFS_SB_FEATURES2
|
XFS_SB_VERSIONNUM
));
tp
=
xfs_trans_alloc
(
mp
,
XFS_TRANS_SB_UNIT
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_sb
,
0
,
0
);
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
return
error
;
}
xfs_mod_sb
(
tp
,
fields
);
error
=
xfs_trans_commit
(
tp
,
0
);
return
error
;
}
/*
/*
* If the underlying (data/log/rt) device is readonly, there are some
* If the underlying (data/log/rt) device is readonly, there are some
* operations that cannot proceed.
* operations that cannot proceed.
...
...
fs/xfs/xfs_mount.h
浏览文件 @
465e2def
...
@@ -162,8 +162,7 @@ typedef struct xfs_mount {
...
@@ -162,8 +162,7 @@ typedef struct xfs_mount {
struct
delayed_work
m_reclaim_work
;
/* background inode reclaim */
struct
delayed_work
m_reclaim_work
;
/* background inode reclaim */
struct
delayed_work
m_eofblocks_work
;
/* background eof blocks
struct
delayed_work
m_eofblocks_work
;
/* background eof blocks
trimming */
trimming */
__int64_t
m_update_flags
;
/* sb flags we need to update
bool
m_update_sb
;
/* sb needs update in mount */
on the next remount,rw */
int64_t
m_low_space
[
XFS_LOWSP_MAX
];
int64_t
m_low_space
[
XFS_LOWSP_MAX
];
/* low free space thresholds */
/* low free space thresholds */
struct
xfs_kobj
m_kobj
;
struct
xfs_kobj
m_kobj
;
...
@@ -378,7 +377,7 @@ extern void xfs_unmountfs(xfs_mount_t *);
...
@@ -378,7 +377,7 @@ extern void xfs_unmountfs(xfs_mount_t *);
extern
int
xfs_mod_incore_sb
(
xfs_mount_t
*
,
xfs_sb_field_t
,
int64_t
,
int
);
extern
int
xfs_mod_incore_sb
(
xfs_mount_t
*
,
xfs_sb_field_t
,
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
int
xfs_mount_log_sb
(
xfs_mount_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
*
);
...
...
fs/xfs/xfs_qm.c
浏览文件 @
465e2def
...
@@ -714,7 +714,6 @@ STATIC int
...
@@ -714,7 +714,6 @@ STATIC int
xfs_qm_qino_alloc
(
xfs_qm_qino_alloc
(
xfs_mount_t
*
mp
,
xfs_mount_t
*
mp
,
xfs_inode_t
**
ip
,
xfs_inode_t
**
ip
,
__int64_t
sbfields
,
uint
flags
)
uint
flags
)
{
{
xfs_trans_t
*
tp
;
xfs_trans_t
*
tp
;
...
@@ -777,11 +776,6 @@ xfs_qm_qino_alloc(
...
@@ -777,11 +776,6 @@ xfs_qm_qino_alloc(
spin_lock
(
&
mp
->
m_sb_lock
);
spin_lock
(
&
mp
->
m_sb_lock
);
if
(
flags
&
XFS_QMOPT_SBVERSION
)
{
if
(
flags
&
XFS_QMOPT_SBVERSION
)
{
ASSERT
(
!
xfs_sb_version_hasquota
(
&
mp
->
m_sb
));
ASSERT
(
!
xfs_sb_version_hasquota
(
&
mp
->
m_sb
));
ASSERT
((
sbfields
&
(
XFS_SB_VERSIONNUM
|
XFS_SB_UQUOTINO
|
XFS_SB_GQUOTINO
|
XFS_SB_PQUOTINO
|
XFS_SB_QFLAGS
))
==
(
XFS_SB_VERSIONNUM
|
XFS_SB_UQUOTINO
|
XFS_SB_GQUOTINO
|
XFS_SB_PQUOTINO
|
XFS_SB_QFLAGS
));
xfs_sb_version_addquota
(
&
mp
->
m_sb
);
xfs_sb_version_addquota
(
&
mp
->
m_sb
);
mp
->
m_sb
.
sb_uquotino
=
NULLFSINO
;
mp
->
m_sb
.
sb_uquotino
=
NULLFSINO
;
...
@@ -798,7 +792,7 @@ xfs_qm_qino_alloc(
...
@@ -798,7 +792,7 @@ xfs_qm_qino_alloc(
else
else
mp
->
m_sb
.
sb_pquotino
=
(
*
ip
)
->
i_ino
;
mp
->
m_sb
.
sb_pquotino
=
(
*
ip
)
->
i_ino
;
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
xfs_
mod_sb
(
tp
,
sbfields
);
xfs_
log_sb
(
tp
);
if
((
error
=
xfs_trans_commit
(
tp
,
XFS_TRANS_RELEASE_LOG_RES
)))
{
if
((
error
=
xfs_trans_commit
(
tp
,
XFS_TRANS_RELEASE_LOG_RES
)))
{
xfs_alert
(
mp
,
"%s failed (error %d)!"
,
__func__
,
error
);
xfs_alert
(
mp
,
"%s failed (error %d)!"
,
__func__
,
error
);
...
@@ -1451,7 +1445,7 @@ xfs_qm_mount_quotas(
...
@@ -1451,7 +1445,7 @@ xfs_qm_mount_quotas(
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
if
(
sbf
!=
(
mp
->
m_qflags
&
XFS_MOUNT_QUOTA_ALL
))
{
if
(
sbf
!=
(
mp
->
m_qflags
&
XFS_MOUNT_QUOTA_ALL
))
{
if
(
xfs_
qm_write_sb_changes
(
mp
,
XFS_SB_QFLAGS
))
{
if
(
xfs_
sync_sb
(
mp
,
false
))
{
/*
/*
* We could only have been turning quotas off.
* We could only have been turning quotas off.
* We aren't in very good shape actually because
* We aren't in very good shape actually because
...
@@ -1482,7 +1476,6 @@ xfs_qm_init_quotainos(
...
@@ -1482,7 +1476,6 @@ xfs_qm_init_quotainos(
struct
xfs_inode
*
gip
=
NULL
;
struct
xfs_inode
*
gip
=
NULL
;
struct
xfs_inode
*
pip
=
NULL
;
struct
xfs_inode
*
pip
=
NULL
;
int
error
;
int
error
;
__int64_t
sbflags
=
0
;
uint
flags
=
0
;
uint
flags
=
0
;
ASSERT
(
mp
->
m_quotainfo
);
ASSERT
(
mp
->
m_quotainfo
);
...
@@ -1517,9 +1510,6 @@ xfs_qm_init_quotainos(
...
@@ -1517,9 +1510,6 @@ xfs_qm_init_quotainos(
}
}
}
else
{
}
else
{
flags
|=
XFS_QMOPT_SBVERSION
;
flags
|=
XFS_QMOPT_SBVERSION
;
sbflags
|=
(
XFS_SB_VERSIONNUM
|
XFS_SB_UQUOTINO
|
XFS_SB_GQUOTINO
|
XFS_SB_PQUOTINO
|
XFS_SB_QFLAGS
);
}
}
/*
/*
...
@@ -1530,7 +1520,6 @@ xfs_qm_init_quotainos(
...
@@ -1530,7 +1520,6 @@ xfs_qm_init_quotainos(
*/
*/
if
(
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
{
if
(
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
uip
,
error
=
xfs_qm_qino_alloc
(
mp
,
&
uip
,
sbflags
|
XFS_SB_UQUOTINO
,
flags
|
XFS_QMOPT_UQUOTA
);
flags
|
XFS_QMOPT_UQUOTA
);
if
(
error
)
if
(
error
)
goto
error_rele
;
goto
error_rele
;
...
@@ -1539,7 +1528,6 @@ xfs_qm_init_quotainos(
...
@@ -1539,7 +1528,6 @@ xfs_qm_init_quotainos(
}
}
if
(
XFS_IS_GQUOTA_ON
(
mp
)
&&
gip
==
NULL
)
{
if
(
XFS_IS_GQUOTA_ON
(
mp
)
&&
gip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
gip
,
error
=
xfs_qm_qino_alloc
(
mp
,
&
gip
,
sbflags
|
XFS_SB_GQUOTINO
,
flags
|
XFS_QMOPT_GQUOTA
);
flags
|
XFS_QMOPT_GQUOTA
);
if
(
error
)
if
(
error
)
goto
error_rele
;
goto
error_rele
;
...
@@ -1548,7 +1536,6 @@ xfs_qm_init_quotainos(
...
@@ -1548,7 +1536,6 @@ xfs_qm_init_quotainos(
}
}
if
(
XFS_IS_PQUOTA_ON
(
mp
)
&&
pip
==
NULL
)
{
if
(
XFS_IS_PQUOTA_ON
(
mp
)
&&
pip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
pip
,
error
=
xfs_qm_qino_alloc
(
mp
,
&
pip
,
sbflags
|
XFS_SB_PQUOTINO
,
flags
|
XFS_QMOPT_PQUOTA
);
flags
|
XFS_QMOPT_PQUOTA
);
if
(
error
)
if
(
error
)
goto
error_rele
;
goto
error_rele
;
...
@@ -1587,32 +1574,6 @@ xfs_qm_dqfree_one(
...
@@ -1587,32 +1574,6 @@ xfs_qm_dqfree_one(
xfs_qm_dqdestroy
(
dqp
);
xfs_qm_dqdestroy
(
dqp
);
}
}
/*
* Start a transaction and write the incore superblock changes to
* disk. flags parameter indicates which fields have changed.
*/
int
xfs_qm_write_sb_changes
(
xfs_mount_t
*
mp
,
__int64_t
flags
)
{
xfs_trans_t
*
tp
;
int
error
;
tp
=
xfs_trans_alloc
(
mp
,
XFS_TRANS_QM_SBCHANGE
);
error
=
xfs_trans_reserve
(
tp
,
&
M_RES
(
mp
)
->
tr_qm_sbchange
,
0
,
0
);
if
(
error
)
{
xfs_trans_cancel
(
tp
,
0
);
return
error
;
}
xfs_mod_sb
(
tp
,
flags
);
error
=
xfs_trans_commit
(
tp
,
0
);
return
error
;
}
/* --------------- utility functions for vnodeops ---------------- */
/* --------------- utility functions for vnodeops ---------------- */
...
...
fs/xfs/xfs_qm.h
浏览文件 @
465e2def
...
@@ -157,7 +157,6 @@ struct xfs_dquot_acct {
...
@@ -157,7 +157,6 @@ struct xfs_dquot_acct {
#define XFS_QM_RTBWARNLIMIT 5
#define XFS_QM_RTBWARNLIMIT 5
extern
void
xfs_qm_destroy_quotainfo
(
struct
xfs_mount
*
);
extern
void
xfs_qm_destroy_quotainfo
(
struct
xfs_mount
*
);
extern
int
xfs_qm_write_sb_changes
(
struct
xfs_mount
*
,
__int64_t
);
/* dquot stuff */
/* dquot stuff */
extern
void
xfs_qm_dqpurge_all
(
struct
xfs_mount
*
,
uint
);
extern
void
xfs_qm_dqpurge_all
(
struct
xfs_mount
*
,
uint
);
...
...
fs/xfs/xfs_qm_syscalls.c
浏览文件 @
465e2def
...
@@ -92,8 +92,7 @@ xfs_qm_scall_quotaoff(
...
@@ -92,8 +92,7 @@ xfs_qm_scall_quotaoff(
mutex_unlock
(
&
q
->
qi_quotaofflock
);
mutex_unlock
(
&
q
->
qi_quotaofflock
);
/* XXX what to do if error ? Revert back to old vals incore ? */
/* XXX what to do if error ? Revert back to old vals incore ? */
error
=
xfs_qm_write_sb_changes
(
mp
,
XFS_SB_QFLAGS
);
return
xfs_sync_sb
(
mp
,
false
);
return
error
;
}
}
dqtype
=
0
;
dqtype
=
0
;
...
@@ -314,7 +313,6 @@ xfs_qm_scall_quotaon(
...
@@ -314,7 +313,6 @@ xfs_qm_scall_quotaon(
{
{
int
error
;
int
error
;
uint
qf
;
uint
qf
;
__int64_t
sbflags
;
flags
&=
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
);
flags
&=
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
);
/*
/*
...
@@ -322,8 +320,6 @@ xfs_qm_scall_quotaon(
...
@@ -322,8 +320,6 @@ xfs_qm_scall_quotaon(
*/
*/
flags
&=
~
(
XFS_ALL_QUOTA_ACCT
);
flags
&=
~
(
XFS_ALL_QUOTA_ACCT
);
sbflags
=
0
;
if
(
flags
==
0
)
{
if
(
flags
==
0
)
{
xfs_debug
(
mp
,
"%s: zero flags, m_qflags=%x"
,
xfs_debug
(
mp
,
"%s: zero flags, m_qflags=%x"
,
__func__
,
mp
->
m_qflags
);
__func__
,
mp
->
m_qflags
);
...
@@ -370,11 +366,11 @@ xfs_qm_scall_quotaon(
...
@@ -370,11 +366,11 @@ xfs_qm_scall_quotaon(
/*
/*
* There's nothing to change if it's the same.
* There's nothing to change if it's the same.
*/
*/
if
((
qf
&
flags
)
==
flags
&&
sbflags
==
0
)
if
((
qf
&
flags
)
==
flags
)
return
-
EEXIST
;
return
-
EEXIST
;
sbflags
|=
XFS_SB_QFLAGS
;
if
((
error
=
xfs_qm_write_sb_changes
(
mp
,
sbflags
)))
error
=
xfs_sync_sb
(
mp
,
false
);
if
(
error
)
return
error
;
return
error
;
/*
/*
* If we aren't trying to switch on quota enforcement, we are done.
* If we aren't trying to switch on quota enforcement, we are done.
...
@@ -801,7 +797,7 @@ xfs_qm_log_quotaoff(
...
@@ -801,7 +797,7 @@ xfs_qm_log_quotaoff(
mp
->
m_sb
.
sb_qflags
=
(
mp
->
m_qflags
&
~
(
flags
))
&
XFS_MOUNT_QUOTA_ALL
;
mp
->
m_sb
.
sb_qflags
=
(
mp
->
m_qflags
&
~
(
flags
))
&
XFS_MOUNT_QUOTA_ALL
;
spin_unlock
(
&
mp
->
m_sb_lock
);
spin_unlock
(
&
mp
->
m_sb_lock
);
xfs_
mod_sb
(
tp
,
XFS_SB_QFLAGS
);
xfs_
log_sb
(
tp
);
/*
/*
* We have to make sure that the transaction is secure on disk before we
* We have to make sure that the transaction is secure on disk before we
...
...
fs/xfs/xfs_super.c
浏览文件 @
465e2def
...
@@ -1257,13 +1257,13 @@ xfs_fs_remount(
...
@@ -1257,13 +1257,13 @@ xfs_fs_remount(
* If this is the first remount to writeable state we
* If this is the first remount to writeable state we
* might have some superblock changes to update.
* might have some superblock changes to update.
*/
*/
if
(
mp
->
m_update_
flags
)
{
if
(
mp
->
m_update_
sb
)
{
error
=
xfs_
mount_log_sb
(
mp
,
mp
->
m_update_flags
);
error
=
xfs_
sync_sb
(
mp
,
false
);
if
(
error
)
{
if
(
error
)
{
xfs_warn
(
mp
,
"failed to write sb changes"
);
xfs_warn
(
mp
,
"failed to write sb changes"
);
return
error
;
return
error
;
}
}
mp
->
m_update_
flags
=
0
;
mp
->
m_update_
sb
=
false
;
}
}
/*
/*
...
@@ -1293,8 +1293,9 @@ xfs_fs_remount(
...
@@ -1293,8 +1293,9 @@ xfs_fs_remount(
/*
/*
* Second stage of a freeze. The data is already frozen so we only
* Second stage of a freeze. The data is already frozen so we only
* need to take care of the metadata. Once that's done write a dummy
* need to take care of the metadata. Once that's done sync the superblock
* record to dirty the log in case of a crash while frozen.
* to the log to dirty it in case of a crash while frozen. This ensures that we
* will recover the unlinked inode lists on the next mount.
*/
*/
STATIC
int
STATIC
int
xfs_fs_freeze
(
xfs_fs_freeze
(
...
@@ -1304,7 +1305,7 @@ xfs_fs_freeze(
...
@@ -1304,7 +1305,7 @@ xfs_fs_freeze(
xfs_save_resvblks
(
mp
);
xfs_save_resvblks
(
mp
);
xfs_quiesce_attr
(
mp
);
xfs_quiesce_attr
(
mp
);
return
xfs_
fs_log_dummy
(
mp
);
return
xfs_
sync_sb
(
mp
,
true
);
}
}
STATIC
int
STATIC
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录