Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
465e2def
Commit
465e2def
authored
Jan 22, 2015
by
Dave Chinner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xfs-sb-logging-rework' into for-next
Conflicts: fs/xfs/xfs_mount.c
parents
6bcf0939
074e427b
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
226 additions
and
416 deletions
+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
No files found.
fs/xfs/libxfs/xfs_attr_leaf.c
View file @
465e2def
...
...
@@ -403,7 +403,7 @@ xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
))
{
xfs_sb_version_addattr2
(
&
mp
->
m_sb
);
spin_unlock
(
&
mp
->
m_sb_lock
);
xfs_
mod_sb
(
tp
,
XFS_SB_VERSIONNUM
|
XFS_SB_FEATURES2
);
xfs_
log_sb
(
tp
);
}
else
spin_unlock
(
&
mp
->
m_sb_lock
);
}
...
...
fs/xfs/libxfs/xfs_bmap.c
View file @
465e2def
...
...
@@ -1221,22 +1221,20 @@ xfs_bmap_add_attrfork(
goto
bmap_cancel
;
if
(
!
xfs_sb_version_hasattr
(
&
mp
->
m_sb
)
||
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
))
{
__int64_t
sbfields
=
0
;
bool
log_sb
=
false
;
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
;
log_sb
=
true
;
}
if
(
!
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
version
==
2
)
{
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
);
xfs_mod_sb
(
tp
,
sbfields
);
}
else
spin_unlock
(
&
mp
->
m_sb_lock
);
if
(
log_sb
)
xfs_log_sb
(
tp
);
}
error
=
xfs_bmap_finish
(
&
tp
,
&
flist
,
&
committed
);
...
...
fs/xfs/libxfs/xfs_format.h
View file @
465e2def
...
...
@@ -151,10 +151,13 @@ typedef struct xfs_sb {
__uint32_t
sb_features2
;
/* additional feature bits */
/*
* bad features2 field as a result of failing to pad the sb
* structure to 64 bits. Some machines will be using this field
* for features2 bits. Easiest just to mark it bad and not use
* it for anything else.
* bad features2 field as a result of failing to pad the sb structure to
* 64 bits. Some machines will be using this field for features2 bits.
* Easiest just to mark it bad and not use 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
;
...
...
@@ -453,13 +456,11 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
{
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
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
)
{
sbp
->
sb_features2
&=
~
XFS_SB_VERSION2_ATTR2BIT
;
sbp
->
sb_bad_features2
&=
~
XFS_SB_VERSION2_ATTR2BIT
;
if
(
!
sbp
->
sb_features2
)
sbp
->
sb_versionnum
&=
~
XFS_SB_VERSION_MOREBITSBIT
;
}
...
...
@@ -475,7 +476,6 @@ static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
{
sbp
->
sb_versionnum
|=
XFS_SB_VERSION_MOREBITSBIT
;
sbp
->
sb_features2
|=
XFS_SB_VERSION2_PROJID32BIT
;
sbp
->
sb_bad_features2
|=
XFS_SB_VERSION2_PROJID32BIT
;
}
/*
...
...
fs/xfs/libxfs/xfs_sb.c
View file @
465e2def
This diff is collapsed.
Click to expand it.
fs/xfs/libxfs/xfs_sb.h
View file @
465e2def
...
...
@@ -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
int
xfs_initialize_perag_data
(
struct
xfs_mount
*
,
xfs_agnumber_t
);
extern
void
xfs_sb_calc_crc
(
struct
xfs_buf
*
);
extern
void
xfs_mod_sb
(
struct
xfs_trans
*
,
__int64_t
);
extern
void
xfs_sb_mount_common
(
struct
xfs_mount
*
,
struct
xfs_sb
*
);
extern
void
xfs_sb_from_disk
(
struct
xfs_sb
*
,
struct
xfs_dsb
*
);
extern
void
xfs_sb_to_disk
(
struct
xfs_dsb
*
,
struct
xfs_sb
*
,
__int64_t
);
extern
void
xfs_sb_calc_crc
(
struct
xfs_buf
*
bp
);
extern
void
xfs_log_sb
(
struct
xfs_trans
*
tp
);
extern
int
xfs_sync_sb
(
struct
xfs_mount
*
mp
,
bool
wait
);
extern
void
xfs_sb_mount_common
(
struct
xfs_mount
*
mp
,
struct
xfs_sb
*
sbp
);
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
);
#endif
/* __XFS_SB_H__ */
fs/xfs/libxfs/xfs_shared.h
View file @
465e2def
...
...
@@ -82,7 +82,7 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
#define XFS_TRANS_ATTR_RM 23
#define XFS_TRANS_ATTR_FLAG 24
#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
* trans_type[] in xlog_recover_print_trans_head()
...
...
@@ -95,17 +95,15 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
#define XFS_TRANS_QM_DQCLUSTER 32
#define XFS_TRANS_QM_QINOCREATE 33
#define XFS_TRANS_QM_QUOTAOFF_END 34
#define XFS_TRANS_SB_UNIT 35
#define XFS_TRANS_FSYNC_TS 36
#define XFS_TRANS_GROWFSRT_ALLOC 37
#define XFS_TRANS_GROWFSRT_ZERO 38
#define XFS_TRANS_GROWFSRT_FREE 39
#define XFS_TRANS_SWAPEXT 40
#define XFS_TRANS_SB_COUNT 41
#define XFS_TRANS_CHECKPOINT 42
#define XFS_TRANS_ICREATE 43
#define XFS_TRANS_CREATE_TMPFILE 44
#define XFS_TRANS_TYPE_MAX 44
#define XFS_TRANS_FSYNC_TS 35
#define XFS_TRANS_GROWFSRT_ALLOC 36
#define XFS_TRANS_GROWFSRT_ZERO 37
#define XFS_TRANS_GROWFSRT_FREE 38
#define XFS_TRANS_SWAPEXT 39
#define XFS_TRANS_CHECKPOINT 40
#define XFS_TRANS_ICREATE 41
#define XFS_TRANS_CREATE_TMPFILE 42
#define XFS_TRANS_TYPE_MAX 43
/* new transaction types need to be reflected in xfs_logprint(8) */
#define XFS_TRANS_TYPES \
...
...
@@ -113,7 +111,6 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
{ XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \
{ XFS_TRANS_INACTIVE, "INACTIVE" }, \
{ XFS_TRANS_CREATE, "CREATE" }, \
{ XFS_TRANS_CREATE_TMPFILE, "CREATE_TMPFILE" }, \
{ XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \
{ XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \
{ XFS_TRANS_REMOVE, "REMOVE" }, \
...
...
@@ -134,23 +131,23 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
{ XFS_TRANS_ATTR_RM, "ATTR_RM" }, \
{ XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \
{ 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_DQALLOC, "QM_DQALLOC" }, \
{ XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \
{ XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \
{ XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \
{ XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \
{ XFS_TRANS_SB_UNIT, "SB_UNIT" }, \
{ XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \
{ XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \
{ XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \
{ XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \
{ XFS_TRANS_SWAPEXT, "SWAPEXT" }, \
{ XFS_TRANS_SB_COUNT, "SB_COUNT" }, \
{ XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \
{ XFS_TRANS_
DUMMY1, "DUMMY1
" }, \
{ XFS_TRANS_
DUMMY2, "DUMMY2
" }, \
{ XFS_TRANS_
ICREATE, "ICREATE
" }, \
{ XFS_TRANS_
CREATE_TMPFILE, "CREATE_TMPFILE
" }, \
{ XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" }
/*
...
...
fs/xfs/libxfs/xfs_trans_resv.c
View file @
465e2def
...
...
@@ -715,17 +715,6 @@ xfs_calc_clear_agi_bucket_reservation(
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.
* the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
...
...
@@ -864,9 +853,6 @@ xfs_trans_resv_calc(
* The following transactions are logged in logical format with
* 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_logcount
=
XFS_DEFAULT_LOG_COUNT
;
...
...
fs/xfs/libxfs/xfs_trans_resv.h
View file @
465e2def
...
...
@@ -56,7 +56,6 @@ struct xfs_trans_resv {
struct
xfs_trans_res
tr_growrtalloc
;
/* grow realtime allocations */
struct
xfs_trans_res
tr_growrtzero
;
/* grow realtime zeroing */
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_dqalloc
;
/* allocate quota on disk */
struct
xfs_trans_res
tr_qm_quotaoff
;
/* turn quota off */
...
...
fs/xfs/xfs_fsops.c
View file @
465e2def
...
...
@@ -541,7 +541,7 @@ xfs_growfs_data_private(
saved_error
=
error
;
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
);
xfs_buf_relse
(
bp
);
...
...
@@ -756,37 +756,6 @@ xfs_reserve_blocks(
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
xfs_fs_goingdown
(
xfs_mount_t
*
mp
,
...
...
fs/xfs/xfs_log.c
View file @
465e2def
...
...
@@ -33,6 +33,7 @@
#include "xfs_fsops.h"
#include "xfs_cksum.h"
#include "xfs_sysfs.h"
#include "xfs_sb.h"
kmem_zone_t
*
xfs_log_ticket_zone
;
...
...
@@ -1290,9 +1291,20 @@ xfs_log_worker(
struct
xfs_mount
*
mp
=
log
->
l_mp
;
/* dgc: errors ignored - not fatal and nowhere to report them */
if
(
xfs_log_need_covered
(
mp
))
xfs_fs_log_dummy
(
mp
);
else
if
(
xfs_log_need_covered
(
mp
))
{
/*
* 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
);
/* start pushing all the metadata that is currently dirty */
...
...
fs/xfs/xfs_mount.c
View file @
465e2def
...
...
@@ -408,11 +408,11 @@ xfs_update_alignment(xfs_mount_t *mp)
if
(
xfs_sb_version_hasdalign
(
sbp
))
{
if
(
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
)
{
sbp
->
sb_width
=
mp
->
m_swidth
;
mp
->
m_update_
flags
|=
XFS_SB_WIDTH
;
mp
->
m_update_
sb
=
true
;
}
}
else
{
xfs_warn
(
mp
,
...
...
@@ -583,38 +583,19 @@ int
xfs_mount_reset_sbqflags
(
struct
xfs_mount
*
mp
)
{
int
error
;
struct
xfs_trans
*
tp
;
mp
->
m_qflags
=
0
;
/*
* It is OK to look at sb_qflags here in mount path,
* without m_sb_lock.
*/
/* It is OK to look at sb_qflags in the mount path without m_sb_lock. */
if
(
mp
->
m_sb
.
sb_qflags
==
0
)
return
0
;
spin_lock
(
&
mp
->
m_sb_lock
);
mp
->
m_sb
.
sb_qflags
=
0
;
spin_unlock
(
&
mp
->
m_sb_lock
);
/*
* 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
)
if
(
!
xfs_fs_writable
(
mp
,
SB_FREEZE_WRITE
))
return
0
;
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
);
xfs_alert
(
mp
,
"%s: Superblock update failed!"
,
__func__
);
return
error
;
}
xfs_mod_sb
(
tp
,
XFS_SB_QFLAGS
);
return
xfs_trans_commit
(
tp
,
0
);
return
xfs_sync_sb
(
mp
,
false
);
}
__uint64_t
...
...
@@ -659,26 +640,25 @@ xfs_mountfs(
xfs_sb_mount_common
(
mp
,
sbp
);
/*
* Check for a mismatched features2 values. Older kernels
*
read & wrote into the wrong sb offset for sb_features2
*
on some platforms due to xfs_sb_t not being 64bit size aligned
* wh
en sb_features2 was added, which made older superblock
*
reading/writing routines swap it as a
64-bit value.
* Check for a mismatched features2 values. Older kernels
read & wrote
*
into the wrong sb offset for sb_features2 on some platforms due to
*
xfs_sb_t not being 64bit size aligned when sb_features2 was added,
* wh
ich made older superblock reading/writing routines swap it as a
* 64-bit value.
*
* For backwards compatibility, we make both slots equal.
*
* If we detect a mismatched field, we OR the set bits into the
*
existing features2 field in case it has already been modified; we
*
don't want to lose any features. We then update the bad location
*
with the ORed value so that older kernels will see any features2
*
flags, and mark the two fields as needing updates once the
*
transaction subsystem is online
.
* If we detect a mismatched field, we OR the set bits into the
existing
*
features2 field in case it has already been modified; we don't want
*
to lose any features. We then update the bad location with the ORed
*
value so that older kernels will see any features2 flags. The
*
superblock writeback code ensures the new sb_features2 is copied to
*
sb_bad_features2 before it is logged or written to disk
.
*/
if
(
xfs_sb_has_mismatched_features2
(
sbp
))
{
xfs_warn
(
mp
,
"correcting sb_features alignment problem"
);
sbp
->
sb_features2
|=
sbp
->
sb_bad_features2
;
sbp
->
sb_bad_features2
=
sbp
->
sb_features2
;
mp
->
m_update_flags
|=
XFS_SB_FEATURES2
;
mp
->
m_update_sb
=
true
;
/*
* Re-check for ATTR2 in case it was found in bad_features2
...
...
@@ -692,17 +672,17 @@ xfs_mountfs(
if
(
xfs_sb_version_hasattr2
(
&
mp
->
m_sb
)
&&
(
mp
->
m_flags
&
XFS_MOUNT_NOATTR2
))
{
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 */
if
(
!
sbp
->
sb_features2
)
mp
->
m_update_
flags
|=
XFS_SB_VERSIONNUM
;
mp
->
m_update_
sb
=
true
;
}
/* always use v2 inodes by default now */
if
(
!
(
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(
* the next remount into writeable mode. Otherwise we would never
* perform the update e.g. for the root filesystem.
*/
if
(
mp
->
m_update_
flags
&&
!
(
mp
->
m_flags
&
XFS_MOUNT_RDONLY
))
{
error
=
xfs_
mount_log_sb
(
mp
,
mp
->
m_update_flags
);
if
(
mp
->
m_update_
sb
&&
!
(
mp
->
m_flags
&
XFS_MOUNT_RDONLY
))
{
error
=
xfs_
sync_sb
(
mp
,
false
);
if
(
error
)
{
xfs_warn
(
mp
,
"failed to write sb changes"
);
goto
out_rtunmount
;
...
...
@@ -1103,9 +1083,6 @@ xfs_fs_writable(
int
xfs_log_sbcount
(
xfs_mount_t
*
mp
)
{
xfs_trans_t
*
tp
;
int
error
;
/* allow this to proceed during the freeze sequence... */
if
(
!
xfs_fs_writable
(
mp
,
SB_FREEZE_COMPLETE
))
return
0
;
...
...
@@ -1119,17 +1096,7 @@ xfs_log_sbcount(xfs_mount_t *mp)
if
(
!
xfs_sb_version_haslazysbcount
(
&
mp
->
m_sb
))
return
0
;
tp
=
_xfs_trans_alloc
(
mp
,
XFS_TRANS_SB_COUNT
,
KM_SLEEP
);
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
;
return
xfs_sync_sb
(
mp
,
true
);
}
/*
...
...
@@ -1422,33 +1389,6 @@ xfs_freesb(
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
* operations that cannot proceed.
...
...
fs/xfs/xfs_mount.h
View file @
465e2def
...
...
@@ -162,8 +162,7 @@ typedef struct xfs_mount {
struct
delayed_work
m_reclaim_work
;
/* background inode reclaim */
struct
delayed_work
m_eofblocks_work
;
/* background eof blocks
trimming */
__int64_t
m_update_flags
;
/* sb flags we need to update
on the next remount,rw */
bool
m_update_sb
;
/* sb needs update in mount */
int64_t
m_low_space
[
XFS_LOWSP_MAX
];
/* low free space thresholds */
struct
xfs_kobj
m_kobj
;
...
...
@@ -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_batch
(
xfs_mount_t
*
,
xfs_mod_sb_t
*
,
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
int
xfs_readsb
(
xfs_mount_t
*
,
int
);
extern
void
xfs_freesb
(
xfs_mount_t
*
);
...
...
fs/xfs/xfs_qm.c
View file @
465e2def
...
...
@@ -714,7 +714,6 @@ STATIC int
xfs_qm_qino_alloc
(
xfs_mount_t
*
mp
,
xfs_inode_t
**
ip
,
__int64_t
sbfields
,
uint
flags
)
{
xfs_trans_t
*
tp
;
...
...
@@ -777,11 +776,6 @@ xfs_qm_qino_alloc(
spin_lock
(
&
mp
->
m_sb_lock
);
if
(
flags
&
XFS_QMOPT_SBVERSION
)
{
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
);
mp
->
m_sb
.
sb_uquotino
=
NULLFSINO
;
...
...
@@ -798,7 +792,7 @@ xfs_qm_qino_alloc(
else
mp
->
m_sb
.
sb_pquotino
=
(
*
ip
)
->
i_ino
;
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
)))
{
xfs_alert
(
mp
,
"%s failed (error %d)!"
,
__func__
,
error
);
...
...
@@ -1451,7 +1445,7 @@ xfs_qm_mount_quotas(
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
))
{
if
(
xfs_
sync_sb
(
mp
,
false
))
{
/*
* We could only have been turning quotas off.
* We aren't in very good shape actually because
...
...
@@ -1482,7 +1476,6 @@ xfs_qm_init_quotainos(
struct
xfs_inode
*
gip
=
NULL
;
struct
xfs_inode
*
pip
=
NULL
;
int
error
;
__int64_t
sbflags
=
0
;
uint
flags
=
0
;
ASSERT
(
mp
->
m_quotainfo
);
...
...
@@ -1517,9 +1510,6 @@ xfs_qm_init_quotainos(
}
}
else
{
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(
*/
if
(
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
uip
,
sbflags
|
XFS_SB_UQUOTINO
,
flags
|
XFS_QMOPT_UQUOTA
);
if
(
error
)
goto
error_rele
;
...
...
@@ -1539,7 +1528,6 @@ xfs_qm_init_quotainos(
}
if
(
XFS_IS_GQUOTA_ON
(
mp
)
&&
gip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
gip
,
sbflags
|
XFS_SB_GQUOTINO
,
flags
|
XFS_QMOPT_GQUOTA
);
if
(
error
)
goto
error_rele
;
...
...
@@ -1548,7 +1536,6 @@ xfs_qm_init_quotainos(
}
if
(
XFS_IS_PQUOTA_ON
(
mp
)
&&
pip
==
NULL
)
{
error
=
xfs_qm_qino_alloc
(
mp
,
&
pip
,
sbflags
|
XFS_SB_PQUOTINO
,
flags
|
XFS_QMOPT_PQUOTA
);
if
(
error
)
goto
error_rele
;
...
...
@@ -1587,32 +1574,6 @@ xfs_qm_dqfree_one(
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 ---------------- */
...
...
fs/xfs/xfs_qm.h
View file @
465e2def
...
...
@@ -157,7 +157,6 @@ struct xfs_dquot_acct {
#define XFS_QM_RTBWARNLIMIT 5
extern
void
xfs_qm_destroy_quotainfo
(
struct
xfs_mount
*
);
extern
int
xfs_qm_write_sb_changes
(
struct
xfs_mount
*
,
__int64_t
);
/* dquot stuff */
extern
void
xfs_qm_dqpurge_all
(
struct
xfs_mount
*
,
uint
);
...
...
fs/xfs/xfs_qm_syscalls.c
View file @
465e2def
...
...
@@ -92,8 +92,7 @@ xfs_qm_scall_quotaoff(
mutex_unlock
(
&
q
->
qi_quotaofflock
);
/* XXX what to do if error ? Revert back to old vals incore ? */
error
=
xfs_qm_write_sb_changes
(
mp
,
XFS_SB_QFLAGS
);
return
error
;
return
xfs_sync_sb
(
mp
,
false
);
}
dqtype
=
0
;
...
...
@@ -314,7 +313,6 @@ xfs_qm_scall_quotaon(
{
int
error
;
uint
qf
;
__int64_t
sbflags
;
flags
&=
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
);
/*
...
...
@@ -322,8 +320,6 @@ xfs_qm_scall_quotaon(
*/
flags
&=
~
(
XFS_ALL_QUOTA_ACCT
);
sbflags
=
0
;
if
(
flags
==
0
)
{
xfs_debug
(
mp
,
"%s: zero flags, m_qflags=%x"
,
__func__
,
mp
->
m_qflags
);
...
...
@@ -370,11 +366,11 @@ xfs_qm_scall_quotaon(
/*
* There's nothing to change if it's the same.
*/
if
((
qf
&
flags
)
==
flags
&&
sbflags
==
0
)
if
((
qf
&
flags
)
==
flags
)
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
;
/*
* If we aren't trying to switch on quota enforcement, we are done.
...
...
@@ -801,7 +797,7 @@ xfs_qm_log_quotaoff(
mp
->
m_sb
.
sb_qflags
=
(
mp
->
m_qflags
&
~
(
flags
))
&
XFS_MOUNT_QUOTA_ALL
;
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
...
...
fs/xfs/xfs_super.c
View file @
465e2def
...
...
@@ -1257,13 +1257,13 @@ xfs_fs_remount(
* 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
(
mp
->
m_update_
sb
)
{
error
=
xfs_
sync_sb
(
mp
,
false
);
if
(
error
)
{
xfs_warn
(
mp
,
"failed to write sb changes"
);
return
error
;
}
mp
->
m_update_
flags
=
0
;
mp
->
m_update_
sb
=
false
;
}
/*
...
...
@@ -1293,8 +1293,9 @@ xfs_fs_remount(
/*
* 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
* record to dirty the log in case of a crash while frozen.
* need to take care of the metadata. Once that's done sync the superblock
* 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
xfs_fs_freeze
(
...
...
@@ -1304,7 +1305,7 @@ xfs_fs_freeze(
xfs_save_resvblks
(
mp
);
xfs_quiesce_attr
(
mp
);
return
xfs_
fs_log_dummy
(
mp
);
return
xfs_
sync_sb
(
mp
,
true
);
}
STATIC
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment