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
Kirill Smelkov
linux
Commits
b70f14e1
Commit
b70f14e1
authored
May 20, 2014
by
Dave Chinner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xfs-feature-bit-cleanup' into for-next
Conflicts: fs/xfs/xfs_inode.c
parents
0d907a3b
ab3e57b5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
327 deletions
+101
-327
fs/xfs/xfs_dir2.c
fs/xfs/xfs_dir2.c
+1
-1
fs/xfs/xfs_fsops.c
fs/xfs/xfs_fsops.c
+2
-7
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_ialloc.c
+1
-3
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.c
+11
-100
fs/xfs/xfs_inode.h
fs/xfs/xfs_inode.h
+0
-1
fs/xfs/xfs_inode_buf.c
fs/xfs/xfs_inode_buf.c
+8
-9
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_inode_item.c
+2
-30
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_ioctl.c
+1
-8
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+6
-0
fs/xfs/xfs_sb.c
fs/xfs/xfs_sb.c
+2
-10
fs/xfs/xfs_sb.h
fs/xfs/xfs_sb.h
+67
-158
No files found.
fs/xfs/xfs_dir2.c
View file @
b70f14e1
...
...
@@ -92,7 +92,7 @@ xfs_dir_mount(
int
nodehdr_size
;
ASSERT
(
xfs_sb_version_hasdirv2
(
&
mp
->
m_sb
)
);
ASSERT
(
mp
->
m_sb
.
sb_versionnum
&
XFS_SB_VERSION_DIRV2BIT
);
ASSERT
((
1
<<
(
mp
->
m_sb
.
sb_blocklog
+
mp
->
m_sb
.
sb_dirblklog
))
<=
XFS_MAX_BLOCKSIZE
);
...
...
fs/xfs/xfs_fsops.c
View file @
b70f14e1
...
...
@@ -74,23 +74,18 @@ xfs_fs_geometry(
}
if
(
new_version
>=
3
)
{
geo
->
version
=
XFS_FSOP_GEOM_VERSION
;
geo
->
flags
=
geo
->
flags
=
XFS_FSOP_GEOM_FLAGS_NLINK
|
XFS_FSOP_GEOM_FLAGS_DIRV2
|
(
xfs_sb_version_hasattr
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_ATTR
:
0
)
|
(
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_NLINK
:
0
)
|
(
xfs_sb_version_hasquota
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_QUOTA
:
0
)
|
(
xfs_sb_version_hasalign
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_IALIGN
:
0
)
|
(
xfs_sb_version_hasdalign
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_DALIGN
:
0
)
|
(
xfs_sb_version_hasshared
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_SHARED
:
0
)
|
(
xfs_sb_version_hasextflgbit
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_EXTFLG
:
0
)
|
(
xfs_sb_version_hasdirv2
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_DIRV2
:
0
)
|
(
xfs_sb_version_hassector
(
&
mp
->
m_sb
)
?
XFS_FSOP_GEOM_FLAGS_SECTOR
:
0
)
|
(
xfs_sb_version_hasasciici
(
&
mp
->
m_sb
)
?
...
...
fs/xfs/xfs_ialloc.c
View file @
b70f14e1
...
...
@@ -280,10 +280,8 @@ xfs_ialloc_inode_init(
if
(
tp
)
xfs_icreate_log
(
tp
,
agno
,
agbno
,
mp
->
m_ialloc_inos
,
mp
->
m_sb
.
sb_inodesize
,
length
,
gen
);
}
else
if
(
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
))
}
else
version
=
2
;
else
version
=
1
;
for
(
j
=
0
;
j
<
nbufs
;
j
++
)
{
/*
...
...
fs/xfs/xfs_inode.c
View file @
b70f14e1
...
...
@@ -681,6 +681,14 @@ xfs_ialloc(
return
error
;
ASSERT
(
ip
!=
NULL
);
/*
* We always convert v1 inodes to v2 now - we only support filesystems
* with >= v2 inode capability, so there is no reason for ever leaving
* an inode in v1 format.
*/
if
(
ip
->
i_d
.
di_version
==
1
)
ip
->
i_d
.
di_version
=
2
;
ip
->
i_d
.
di_mode
=
mode
;
ip
->
i_d
.
di_onlink
=
0
;
ip
->
i_d
.
di_nlink
=
nlink
;
...
...
@@ -690,27 +698,6 @@ xfs_ialloc(
xfs_set_projid
(
ip
,
prid
);
memset
(
&
(
ip
->
i_d
.
di_pad
[
0
]),
0
,
sizeof
(
ip
->
i_d
.
di_pad
));
/*
* If the superblock version is up to where we support new format
* inodes and this is currently an old format inode, then change
* the inode version number now. This way we only do the conversion
* here rather than here and in the flush/logging code.
*/
if
(
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
)
&&
ip
->
i_d
.
di_version
==
1
)
{
ip
->
i_d
.
di_version
=
2
;
/*
* We've already zeroed the old link count, the projid field,
* and the pad field.
*/
}
/*
* Project ids won't be stored on disk if we are using a version 1 inode.
*/
if
((
prid
!=
0
)
&&
(
ip
->
i_d
.
di_version
==
1
))
xfs_bump_ino_vers2
(
tp
,
ip
);
if
(
pip
&&
XFS_INHERIT_GID
(
pip
))
{
ip
->
i_d
.
di_gid
=
pip
->
i_d
.
di_gid
;
if
((
pip
->
i_d
.
di_mode
&
S_ISGID
)
&&
S_ISDIR
(
mode
))
{
...
...
@@ -1055,40 +1042,6 @@ xfs_droplink(
return
error
;
}
/*
* This gets called when the inode's version needs to be changed from 1 to 2.
* Currently this happens when the nlink field overflows the old 16-bit value
* or when chproj is called to change the project for the first time.
* As a side effect the superblock version will also get rev'd
* to contain the NLINK bit.
*/
void
xfs_bump_ino_vers2
(
xfs_trans_t
*
tp
,
xfs_inode_t
*
ip
)
{
xfs_mount_t
*
mp
;
ASSERT
(
xfs_isilocked
(
ip
,
XFS_ILOCK_EXCL
));
ASSERT
(
ip
->
i_d
.
di_version
==
1
);
ip
->
i_d
.
di_version
=
2
;
ip
->
i_d
.
di_onlink
=
0
;
memset
(
&
(
ip
->
i_d
.
di_pad
[
0
]),
0
,
sizeof
(
ip
->
i_d
.
di_pad
));
mp
=
tp
->
t_mountp
;
if
(
!
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
))
{
spin_lock
(
&
mp
->
m_sb_lock
);
if
(
!
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
))
{
xfs_sb_version_addnlink
(
&
mp
->
m_sb
);
spin_unlock
(
&
mp
->
m_sb_lock
);
xfs_mod_sb
(
tp
,
XFS_SB_VERSIONNUM
);
}
else
{
spin_unlock
(
&
mp
->
m_sb_lock
);
}
}
/* Caller must log the inode */
}
/*
* Increment the link count on an inode & log the change.
*/
...
...
@@ -1099,22 +1052,10 @@ xfs_bumplink(
{
xfs_trans_ichgtime
(
tp
,
ip
,
XFS_ICHGTIME_CHG
);
ASSERT
(
ip
->
i_d
.
di_version
>
1
);
ASSERT
(
ip
->
i_d
.
di_nlink
>
0
||
(
VFS_I
(
ip
)
->
i_state
&
I_LINKABLE
));
ip
->
i_d
.
di_nlink
++
;
inc_nlink
(
VFS_I
(
ip
));
if
((
ip
->
i_d
.
di_version
==
1
)
&&
(
ip
->
i_d
.
di_nlink
>
XFS_MAXLINK_1
))
{
/*
* The inode has increased its number of links beyond
* what can fit in an old format inode. It now needs
* to be converted to a version 2 inode with a 32 bit
* link count. If this is the first inode in the file
* system to do this, then we need to bump the superblock
* version number as well.
*/
xfs_bump_ino_vers2
(
tp
,
ip
);
}
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
return
0
;
}
...
...
@@ -3249,6 +3190,7 @@ xfs_iflush_int(
ASSERT
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
||
ip
->
i_d
.
di_nextents
>
XFS_IFORK_MAXEXT
(
ip
,
XFS_DATA_FORK
));
ASSERT
(
iip
!=
NULL
&&
iip
->
ili_fields
!=
0
);
ASSERT
(
ip
->
i_d
.
di_version
>
1
);
/* set *dip = inode's place in the buffer */
dip
=
(
xfs_dinode_t
*
)
xfs_buf_offset
(
bp
,
ip
->
i_imap
.
im_boffset
);
...
...
@@ -3309,7 +3251,7 @@ xfs_iflush_int(
}
/*
* Inode item log recovery for v
1/v
2 inodes are dependent on the
* Inode item log recovery for v2 inodes are dependent on the
* di_flushiter count for correct sequencing. We bump the flush
* iteration count so we can detect flushes which postdate a log record
* during recovery. This is redundant as we now log every change and
...
...
@@ -3332,37 +3274,6 @@ xfs_iflush_int(
if
(
ip
->
i_d
.
di_flushiter
==
DI_MAX_FLUSH
)
ip
->
i_d
.
di_flushiter
=
0
;
/*
* If this is really an old format inode and the superblock version
* has not been updated to support only new format inodes, then
* convert back to the old inode format. If the superblock version
* has been updated, then make the conversion permanent.
*/
ASSERT
(
ip
->
i_d
.
di_version
==
1
||
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
));
if
(
ip
->
i_d
.
di_version
==
1
)
{
if
(
!
xfs_sb_version_hasnlink
(
&
mp
->
m_sb
))
{
/*
* Convert it back.
*/
ASSERT
(
ip
->
i_d
.
di_nlink
<=
XFS_MAXLINK_1
);
dip
->
di_onlink
=
cpu_to_be16
(
ip
->
i_d
.
di_nlink
);
}
else
{
/*
* The superblock version has already been bumped,
* so just make the conversion to the new inode
* format permanent.
*/
ip
->
i_d
.
di_version
=
2
;
dip
->
di_version
=
2
;
ip
->
i_d
.
di_onlink
=
0
;
dip
->
di_onlink
=
0
;
memset
(
&
(
ip
->
i_d
.
di_pad
[
0
]),
0
,
sizeof
(
ip
->
i_d
.
di_pad
));
memset
(
&
(
dip
->
di_pad
[
0
]),
0
,
sizeof
(
dip
->
di_pad
));
ASSERT
(
xfs_get_projid
(
ip
)
==
0
);
}
}
xfs_iflush_fork
(
ip
,
dip
,
iip
,
XFS_DATA_FORK
);
if
(
XFS_IFORK_Q
(
ip
))
xfs_iflush_fork
(
ip
,
dip
,
iip
,
XFS_ATTR_FORK
);
...
...
fs/xfs/xfs_inode.h
View file @
b70f14e1
...
...
@@ -377,7 +377,6 @@ int xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t,
struct
xfs_inode
**
,
int
*
);
int
xfs_droplink
(
struct
xfs_trans
*
,
struct
xfs_inode
*
);
int
xfs_bumplink
(
struct
xfs_trans
*
,
struct
xfs_inode
*
);
void
xfs_bump_ino_vers2
(
struct
xfs_trans
*
,
struct
xfs_inode
*
);
/* from xfs_file.c */
int
xfs_zero_eof
(
struct
xfs_inode
*
,
xfs_off_t
,
xfs_fsize_t
);
...
...
fs/xfs/xfs_inode_buf.c
View file @
b70f14e1
...
...
@@ -437,17 +437,16 @@ xfs_iread(
}
/*
* The inode format changed when we moved the link count and
* made it 32 bits long. If this is an old format inode,
* convert it in memory to look like a new one. If it gets
* flushed to disk we will convert back before flushing or
* logging it. We zero out the new projid field and the old link
* count field. We'll handle clearing the pad field (the remains
* of the old uuid field) when we actually convert the inode to
* the new format. We don't change the version number so that we
* can distinguish this from a real new format inode.
* Automatically convert version 1 inode formats in memory to version 2
* inode format. If the inode is modified, it will get logged and
* rewritten as a version 2 inode. We can do this because we set the
* superblock feature bit for v2 inodes unconditionally during mount
* and it means the reast of the code can assume the inode version is 2
* or higher.
*/
if
(
ip
->
i_d
.
di_version
==
1
)
{
ip
->
i_d
.
di_version
=
2
;
memset
(
&
(
ip
->
i_d
.
di_pad
[
0
]),
0
,
sizeof
(
ip
->
i_d
.
di_pad
));
ip
->
i_d
.
di_nlink
=
ip
->
i_d
.
di_onlink
;
ip
->
i_d
.
di_onlink
=
0
;
xfs_set_projid
(
ip
,
0
);
...
...
fs/xfs/xfs_inode_item.c
View file @
b70f14e1
...
...
@@ -145,34 +145,6 @@ xfs_inode_item_size(
xfs_inode_item_attr_fork_size
(
iip
,
nvecs
,
nbytes
);
}
/*
* If this is a v1 format inode, then we need to log it as such. This means
* that we have to copy the link count from the new field to the old. We
* don't have to worry about the new fields, because nothing trusts them as
* long as the old inode version number is there.
*/
STATIC
void
xfs_inode_item_format_v1_inode
(
struct
xfs_inode
*
ip
)
{
if
(
!
xfs_sb_version_hasnlink
(
&
ip
->
i_mount
->
m_sb
))
{
/*
* Convert it back.
*/
ASSERT
(
ip
->
i_d
.
di_nlink
<=
XFS_MAXLINK_1
);
ip
->
i_d
.
di_onlink
=
ip
->
i_d
.
di_nlink
;
}
else
{
/*
* The superblock version has already been bumped,
* so just make the conversion to the new inode
* format permanent.
*/
ip
->
i_d
.
di_version
=
2
;
ip
->
i_d
.
di_onlink
=
0
;
memset
(
&
(
ip
->
i_d
.
di_pad
[
0
]),
0
,
sizeof
(
ip
->
i_d
.
di_pad
));
}
}
STATIC
void
xfs_inode_item_format_data_fork
(
struct
xfs_inode_log_item
*
iip
,
...
...
@@ -370,6 +342,8 @@ xfs_inode_item_format(
struct
xfs_inode_log_format
*
ilf
;
struct
xfs_log_iovec
*
vecp
=
NULL
;
ASSERT
(
ip
->
i_d
.
di_version
>
1
);
ilf
=
xlog_prepare_iovec
(
lv
,
&
vecp
,
XLOG_REG_TYPE_IFORMAT
);
ilf
->
ilf_type
=
XFS_LI_INODE
;
ilf
->
ilf_ino
=
ip
->
i_ino
;
...
...
@@ -380,8 +354,6 @@ xfs_inode_item_format(
ilf
->
ilf_size
=
2
;
/* format + core */
xlog_finish_iovec
(
lv
,
vecp
,
sizeof
(
struct
xfs_inode_log_format
));
if
(
ip
->
i_d
.
di_version
==
1
)
xfs_inode_item_format_v1_inode
(
ip
);
xlog_copy_iovec
(
lv
,
&
vecp
,
XLOG_REG_TYPE_ICORE
,
&
ip
->
i_d
,
xfs_icdinode_size
(
ip
->
i_d
.
di_version
));
...
...
fs/xfs/xfs_ioctl.c
View file @
b70f14e1
...
...
@@ -1228,15 +1228,8 @@ xfs_ioctl_setattr(
olddquot
=
xfs_qm_vop_chown
(
tp
,
ip
,
&
ip
->
i_pdquot
,
pdqp
);
}
ASSERT
(
ip
->
i_d
.
di_version
>
1
);
xfs_set_projid
(
ip
,
fa
->
fsx_projid
);
/*
* We may have to rev the inode as well as
* the superblock version number since projids didn't
* exist before DINODE_VERSION_2 and SB_VERSION_NLINK.
*/
if
(
ip
->
i_d
.
di_version
==
1
)
xfs_bump_ino_vers2
(
tp
,
ip
);
}
}
...
...
fs/xfs/xfs_mount.c
View file @
b70f14e1
...
...
@@ -697,6 +697,12 @@ xfs_mountfs(
mp
->
m_update_flags
|=
XFS_SB_VERSIONNUM
;
}
/* 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
;
}
/*
* Check if sb_agblocks is aligned at stripe boundary
* If sb_agblocks is NOT aligned turn off m_dalign since
...
...
fs/xfs/xfs_sb.c
View file @
b70f14e1
...
...
@@ -291,7 +291,8 @@ xfs_mount_validate_sb(
(
sbp
->
sb_imax_pct
>
100
/* zero sb_imax_pct is valid */
)
||
sbp
->
sb_dblocks
==
0
||
sbp
->
sb_dblocks
>
XFS_MAX_DBLOCKS
(
sbp
)
||
sbp
->
sb_dblocks
<
XFS_MIN_DBLOCKS
(
sbp
)))
{
sbp
->
sb_dblocks
<
XFS_MIN_DBLOCKS
(
sbp
)
||
sbp
->
sb_shared_vn
!=
0
))
{
xfs_notice
(
mp
,
"SB sanity check failed"
);
return
XFS_ERROR
(
EFSCORRUPTED
);
}
...
...
@@ -333,15 +334,6 @@ xfs_mount_validate_sb(
xfs_warn
(
mp
,
"Offline file system operation in progress!"
);
return
XFS_ERROR
(
EFSCORRUPTED
);
}
/*
* Version 1 directory format has never worked on Linux.
*/
if
(
unlikely
(
!
xfs_sb_version_hasdirv2
(
sbp
)))
{
xfs_warn
(
mp
,
"file system using version 1 directory format"
);
return
XFS_ERROR
(
ENOSYS
);
}
return
0
;
}
...
...
fs/xfs/xfs_sb.h
View file @
b70f14e1
This diff is collapsed.
Click to expand it.
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