diff options
author | Dave Chinner <david@fromorbit.com> | 2014-05-19 18:57:02 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-05-19 18:57:02 -0400 |
commit | b70f14e1ffbb47369b1cc2cdf558c3468ae9e484 (patch) | |
tree | cccbdd2422a7338a8185eb83493ffac3bb4ddaa9 /fs/xfs | |
parent | 0d907a3bb4a77cffebebd17c323e898048301aa3 (diff) | |
parent | ab3e57b53f549ad51cbdf85e846ca4eaf0f3be30 (diff) |
Merge branch 'xfs-feature-bit-cleanup' into for-next
Conflicts:
fs/xfs/xfs_inode.c
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_dir2.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_fsops.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 111 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_buf.c | 17 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 32 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_sb.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_sb.h | 225 |
11 files changed, 101 insertions, 327 deletions
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index e365c98c0f1e..93fcebd5edd2 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -92,7 +92,7 @@ xfs_dir_mount( | |||
92 | int nodehdr_size; | 92 | int nodehdr_size; |
93 | 93 | ||
94 | 94 | ||
95 | ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb)); | 95 | ASSERT(mp->m_sb.sb_versionnum & XFS_SB_VERSION_DIRV2BIT); |
96 | ASSERT((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <= | 96 | ASSERT((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <= |
97 | XFS_MAX_BLOCKSIZE); | 97 | XFS_MAX_BLOCKSIZE); |
98 | 98 | ||
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 3445ead7c1fc..97886a74e073 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -74,23 +74,18 @@ xfs_fs_geometry( | |||
74 | } | 74 | } |
75 | if (new_version >= 3) { | 75 | if (new_version >= 3) { |
76 | geo->version = XFS_FSOP_GEOM_VERSION; | 76 | geo->version = XFS_FSOP_GEOM_VERSION; |
77 | geo->flags = | 77 | geo->flags = XFS_FSOP_GEOM_FLAGS_NLINK | |
78 | XFS_FSOP_GEOM_FLAGS_DIRV2 | | ||
78 | (xfs_sb_version_hasattr(&mp->m_sb) ? | 79 | (xfs_sb_version_hasattr(&mp->m_sb) ? |
79 | XFS_FSOP_GEOM_FLAGS_ATTR : 0) | | 80 | XFS_FSOP_GEOM_FLAGS_ATTR : 0) | |
80 | (xfs_sb_version_hasnlink(&mp->m_sb) ? | ||
81 | XFS_FSOP_GEOM_FLAGS_NLINK : 0) | | ||
82 | (xfs_sb_version_hasquota(&mp->m_sb) ? | 81 | (xfs_sb_version_hasquota(&mp->m_sb) ? |
83 | XFS_FSOP_GEOM_FLAGS_QUOTA : 0) | | 82 | XFS_FSOP_GEOM_FLAGS_QUOTA : 0) | |
84 | (xfs_sb_version_hasalign(&mp->m_sb) ? | 83 | (xfs_sb_version_hasalign(&mp->m_sb) ? |
85 | XFS_FSOP_GEOM_FLAGS_IALIGN : 0) | | 84 | XFS_FSOP_GEOM_FLAGS_IALIGN : 0) | |
86 | (xfs_sb_version_hasdalign(&mp->m_sb) ? | 85 | (xfs_sb_version_hasdalign(&mp->m_sb) ? |
87 | XFS_FSOP_GEOM_FLAGS_DALIGN : 0) | | 86 | XFS_FSOP_GEOM_FLAGS_DALIGN : 0) | |
88 | (xfs_sb_version_hasshared(&mp->m_sb) ? | ||
89 | XFS_FSOP_GEOM_FLAGS_SHARED : 0) | | ||
90 | (xfs_sb_version_hasextflgbit(&mp->m_sb) ? | 87 | (xfs_sb_version_hasextflgbit(&mp->m_sb) ? |
91 | XFS_FSOP_GEOM_FLAGS_EXTFLG : 0) | | 88 | XFS_FSOP_GEOM_FLAGS_EXTFLG : 0) | |
92 | (xfs_sb_version_hasdirv2(&mp->m_sb) ? | ||
93 | XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) | | ||
94 | (xfs_sb_version_hassector(&mp->m_sb) ? | 89 | (xfs_sb_version_hassector(&mp->m_sb) ? |
95 | XFS_FSOP_GEOM_FLAGS_SECTOR : 0) | | 90 | XFS_FSOP_GEOM_FLAGS_SECTOR : 0) | |
96 | (xfs_sb_version_hasasciici(&mp->m_sb) ? | 91 | (xfs_sb_version_hasasciici(&mp->m_sb) ? |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 1313df7ff0d8..e8dfaf039232 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -280,10 +280,8 @@ xfs_ialloc_inode_init( | |||
280 | if (tp) | 280 | if (tp) |
281 | xfs_icreate_log(tp, agno, agbno, mp->m_ialloc_inos, | 281 | xfs_icreate_log(tp, agno, agbno, mp->m_ialloc_inos, |
282 | mp->m_sb.sb_inodesize, length, gen); | 282 | mp->m_sb.sb_inodesize, length, gen); |
283 | } else if (xfs_sb_version_hasnlink(&mp->m_sb)) | 283 | } else |
284 | version = 2; | 284 | version = 2; |
285 | else | ||
286 | version = 1; | ||
287 | 285 | ||
288 | for (j = 0; j < nbufs; j++) { | 286 | for (j = 0; j < nbufs; j++) { |
289 | /* | 287 | /* |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6d6b44a508f9..a6115fe1ac94 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -681,6 +681,14 @@ xfs_ialloc( | |||
681 | return error; | 681 | return error; |
682 | ASSERT(ip != NULL); | 682 | ASSERT(ip != NULL); |
683 | 683 | ||
684 | /* | ||
685 | * We always convert v1 inodes to v2 now - we only support filesystems | ||
686 | * with >= v2 inode capability, so there is no reason for ever leaving | ||
687 | * an inode in v1 format. | ||
688 | */ | ||
689 | if (ip->i_d.di_version == 1) | ||
690 | ip->i_d.di_version = 2; | ||
691 | |||
684 | ip->i_d.di_mode = mode; | 692 | ip->i_d.di_mode = mode; |
685 | ip->i_d.di_onlink = 0; | 693 | ip->i_d.di_onlink = 0; |
686 | ip->i_d.di_nlink = nlink; | 694 | ip->i_d.di_nlink = nlink; |
@@ -690,27 +698,6 @@ xfs_ialloc( | |||
690 | xfs_set_projid(ip, prid); | 698 | xfs_set_projid(ip, prid); |
691 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | 699 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); |
692 | 700 | ||
693 | /* | ||
694 | * If the superblock version is up to where we support new format | ||
695 | * inodes and this is currently an old format inode, then change | ||
696 | * the inode version number now. This way we only do the conversion | ||
697 | * here rather than here and in the flush/logging code. | ||
698 | */ | ||
699 | if (xfs_sb_version_hasnlink(&mp->m_sb) && | ||
700 | ip->i_d.di_version == 1) { | ||
701 | ip->i_d.di_version = 2; | ||
702 | /* | ||
703 | * We've already zeroed the old link count, the projid field, | ||
704 | * and the pad field. | ||
705 | */ | ||
706 | } | ||
707 | |||
708 | /* | ||
709 | * Project ids won't be stored on disk if we are using a version 1 inode. | ||
710 | */ | ||
711 | if ((prid != 0) && (ip->i_d.di_version == 1)) | ||
712 | xfs_bump_ino_vers2(tp, ip); | ||
713 | |||
714 | if (pip && XFS_INHERIT_GID(pip)) { | 701 | if (pip && XFS_INHERIT_GID(pip)) { |
715 | ip->i_d.di_gid = pip->i_d.di_gid; | 702 | ip->i_d.di_gid = pip->i_d.di_gid; |
716 | if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) { | 703 | if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) { |
@@ -1056,40 +1043,6 @@ xfs_droplink( | |||
1056 | } | 1043 | } |
1057 | 1044 | ||
1058 | /* | 1045 | /* |
1059 | * This gets called when the inode's version needs to be changed from 1 to 2. | ||
1060 | * Currently this happens when the nlink field overflows the old 16-bit value | ||
1061 | * or when chproj is called to change the project for the first time. | ||
1062 | * As a side effect the superblock version will also get rev'd | ||
1063 | * to contain the NLINK bit. | ||
1064 | */ | ||
1065 | void | ||
1066 | xfs_bump_ino_vers2( | ||
1067 | xfs_trans_t *tp, | ||
1068 | xfs_inode_t *ip) | ||
1069 | { | ||
1070 | xfs_mount_t *mp; | ||
1071 | |||
1072 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | ||
1073 | ASSERT(ip->i_d.di_version == 1); | ||
1074 | |||
1075 | ip->i_d.di_version = 2; | ||
1076 | ip->i_d.di_onlink = 0; | ||
1077 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
1078 | mp = tp->t_mountp; | ||
1079 | if (!xfs_sb_version_hasnlink(&mp->m_sb)) { | ||
1080 | spin_lock(&mp->m_sb_lock); | ||
1081 | if (!xfs_sb_version_hasnlink(&mp->m_sb)) { | ||
1082 | xfs_sb_version_addnlink(&mp->m_sb); | ||
1083 | spin_unlock(&mp->m_sb_lock); | ||
1084 | xfs_mod_sb(tp, XFS_SB_VERSIONNUM); | ||
1085 | } else { | ||
1086 | spin_unlock(&mp->m_sb_lock); | ||
1087 | } | ||
1088 | } | ||
1089 | /* Caller must log the inode */ | ||
1090 | } | ||
1091 | |||
1092 | /* | ||
1093 | * Increment the link count on an inode & log the change. | 1046 | * Increment the link count on an inode & log the change. |
1094 | */ | 1047 | */ |
1095 | int | 1048 | int |
@@ -1099,22 +1052,10 @@ xfs_bumplink( | |||
1099 | { | 1052 | { |
1100 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); | 1053 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); |
1101 | 1054 | ||
1055 | ASSERT(ip->i_d.di_version > 1); | ||
1102 | ASSERT(ip->i_d.di_nlink > 0 || (VFS_I(ip)->i_state & I_LINKABLE)); | 1056 | ASSERT(ip->i_d.di_nlink > 0 || (VFS_I(ip)->i_state & I_LINKABLE)); |
1103 | ip->i_d.di_nlink++; | 1057 | ip->i_d.di_nlink++; |
1104 | inc_nlink(VFS_I(ip)); | 1058 | inc_nlink(VFS_I(ip)); |
1105 | if ((ip->i_d.di_version == 1) && | ||
1106 | (ip->i_d.di_nlink > XFS_MAXLINK_1)) { | ||
1107 | /* | ||
1108 | * The inode has increased its number of links beyond | ||
1109 | * what can fit in an old format inode. It now needs | ||
1110 | * to be converted to a version 2 inode with a 32 bit | ||
1111 | * link count. If this is the first inode in the file | ||
1112 | * system to do this, then we need to bump the superblock | ||
1113 | * version number as well. | ||
1114 | */ | ||
1115 | xfs_bump_ino_vers2(tp, ip); | ||
1116 | } | ||
1117 | |||
1118 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 1059 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
1119 | return 0; | 1060 | return 0; |
1120 | } | 1061 | } |
@@ -3249,6 +3190,7 @@ xfs_iflush_int( | |||
3249 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || | 3190 | ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || |
3250 | ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); | 3191 | ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); |
3251 | ASSERT(iip != NULL && iip->ili_fields != 0); | 3192 | ASSERT(iip != NULL && iip->ili_fields != 0); |
3193 | ASSERT(ip->i_d.di_version > 1); | ||
3252 | 3194 | ||
3253 | /* set *dip = inode's place in the buffer */ | 3195 | /* set *dip = inode's place in the buffer */ |
3254 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset); | 3196 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset); |
@@ -3309,7 +3251,7 @@ xfs_iflush_int( | |||
3309 | } | 3251 | } |
3310 | 3252 | ||
3311 | /* | 3253 | /* |
3312 | * Inode item log recovery for v1/v2 inodes are dependent on the | 3254 | * Inode item log recovery for v2 inodes are dependent on the |
3313 | * di_flushiter count for correct sequencing. We bump the flush | 3255 | * di_flushiter count for correct sequencing. We bump the flush |
3314 | * iteration count so we can detect flushes which postdate a log record | 3256 | * iteration count so we can detect flushes which postdate a log record |
3315 | * during recovery. This is redundant as we now log every change and | 3257 | * during recovery. This is redundant as we now log every change and |
@@ -3332,37 +3274,6 @@ xfs_iflush_int( | |||
3332 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) | 3274 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) |
3333 | ip->i_d.di_flushiter = 0; | 3275 | ip->i_d.di_flushiter = 0; |
3334 | 3276 | ||
3335 | /* | ||
3336 | * If this is really an old format inode and the superblock version | ||
3337 | * has not been updated to support only new format inodes, then | ||
3338 | * convert back to the old inode format. If the superblock version | ||
3339 | * has been updated, then make the conversion permanent. | ||
3340 | */ | ||
3341 | ASSERT(ip->i_d.di_version == 1 || xfs_sb_version_hasnlink(&mp->m_sb)); | ||
3342 | if (ip->i_d.di_version == 1) { | ||
3343 | if (!xfs_sb_version_hasnlink(&mp->m_sb)) { | ||
3344 | /* | ||
3345 | * Convert it back. | ||
3346 | */ | ||
3347 | ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); | ||
3348 | dip->di_onlink = cpu_to_be16(ip->i_d.di_nlink); | ||
3349 | } else { | ||
3350 | /* | ||
3351 | * The superblock version has already been bumped, | ||
3352 | * so just make the conversion to the new inode | ||
3353 | * format permanent. | ||
3354 | */ | ||
3355 | ip->i_d.di_version = 2; | ||
3356 | dip->di_version = 2; | ||
3357 | ip->i_d.di_onlink = 0; | ||
3358 | dip->di_onlink = 0; | ||
3359 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
3360 | memset(&(dip->di_pad[0]), 0, | ||
3361 | sizeof(dip->di_pad)); | ||
3362 | ASSERT(xfs_get_projid(ip) == 0); | ||
3363 | } | ||
3364 | } | ||
3365 | |||
3366 | xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); | 3277 | xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); |
3367 | if (XFS_IFORK_Q(ip)) | 3278 | if (XFS_IFORK_Q(ip)) |
3368 | xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); | 3279 | xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 13aea548206c..f72bffa67266 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -377,7 +377,6 @@ int xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t, | |||
377 | struct xfs_inode **, int *); | 377 | struct xfs_inode **, int *); |
378 | int xfs_droplink(struct xfs_trans *, struct xfs_inode *); | 378 | int xfs_droplink(struct xfs_trans *, struct xfs_inode *); |
379 | int xfs_bumplink(struct xfs_trans *, struct xfs_inode *); | 379 | int xfs_bumplink(struct xfs_trans *, struct xfs_inode *); |
380 | void xfs_bump_ino_vers2(struct xfs_trans *, struct xfs_inode *); | ||
381 | 380 | ||
382 | /* from xfs_file.c */ | 381 | /* from xfs_file.c */ |
383 | int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t); | 382 | int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t); |
diff --git a/fs/xfs/xfs_inode_buf.c b/fs/xfs/xfs_inode_buf.c index 24e993996bdc..cb35ae41d4a1 100644 --- a/fs/xfs/xfs_inode_buf.c +++ b/fs/xfs/xfs_inode_buf.c | |||
@@ -437,17 +437,16 @@ xfs_iread( | |||
437 | } | 437 | } |
438 | 438 | ||
439 | /* | 439 | /* |
440 | * The inode format changed when we moved the link count and | 440 | * Automatically convert version 1 inode formats in memory to version 2 |
441 | * made it 32 bits long. If this is an old format inode, | 441 | * inode format. If the inode is modified, it will get logged and |
442 | * convert it in memory to look like a new one. If it gets | 442 | * rewritten as a version 2 inode. We can do this because we set the |
443 | * flushed to disk we will convert back before flushing or | 443 | * superblock feature bit for v2 inodes unconditionally during mount |
444 | * logging it. We zero out the new projid field and the old link | 444 | * and it means the reast of the code can assume the inode version is 2 |
445 | * count field. We'll handle clearing the pad field (the remains | 445 | * or higher. |
446 | * of the old uuid field) when we actually convert the inode to | ||
447 | * the new format. We don't change the version number so that we | ||
448 | * can distinguish this from a real new format inode. | ||
449 | */ | 446 | */ |
450 | if (ip->i_d.di_version == 1) { | 447 | if (ip->i_d.di_version == 1) { |
448 | ip->i_d.di_version = 2; | ||
449 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
451 | ip->i_d.di_nlink = ip->i_d.di_onlink; | 450 | ip->i_d.di_nlink = ip->i_d.di_onlink; |
452 | ip->i_d.di_onlink = 0; | 451 | ip->i_d.di_onlink = 0; |
453 | xfs_set_projid(ip, 0); | 452 | xfs_set_projid(ip, 0); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 686889b4a1e5..a640137b3573 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -145,34 +145,6 @@ xfs_inode_item_size( | |||
145 | xfs_inode_item_attr_fork_size(iip, nvecs, nbytes); | 145 | xfs_inode_item_attr_fork_size(iip, nvecs, nbytes); |
146 | } | 146 | } |
147 | 147 | ||
148 | /* | ||
149 | * If this is a v1 format inode, then we need to log it as such. This means | ||
150 | * that we have to copy the link count from the new field to the old. We | ||
151 | * don't have to worry about the new fields, because nothing trusts them as | ||
152 | * long as the old inode version number is there. | ||
153 | */ | ||
154 | STATIC void | ||
155 | xfs_inode_item_format_v1_inode( | ||
156 | struct xfs_inode *ip) | ||
157 | { | ||
158 | if (!xfs_sb_version_hasnlink(&ip->i_mount->m_sb)) { | ||
159 | /* | ||
160 | * Convert it back. | ||
161 | */ | ||
162 | ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); | ||
163 | ip->i_d.di_onlink = ip->i_d.di_nlink; | ||
164 | } else { | ||
165 | /* | ||
166 | * The superblock version has already been bumped, | ||
167 | * so just make the conversion to the new inode | ||
168 | * format permanent. | ||
169 | */ | ||
170 | ip->i_d.di_version = 2; | ||
171 | ip->i_d.di_onlink = 0; | ||
172 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | STATIC void | 148 | STATIC void |
177 | xfs_inode_item_format_data_fork( | 149 | xfs_inode_item_format_data_fork( |
178 | struct xfs_inode_log_item *iip, | 150 | struct xfs_inode_log_item *iip, |
@@ -370,6 +342,8 @@ xfs_inode_item_format( | |||
370 | struct xfs_inode_log_format *ilf; | 342 | struct xfs_inode_log_format *ilf; |
371 | struct xfs_log_iovec *vecp = NULL; | 343 | struct xfs_log_iovec *vecp = NULL; |
372 | 344 | ||
345 | ASSERT(ip->i_d.di_version > 1); | ||
346 | |||
373 | ilf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_IFORMAT); | 347 | ilf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_IFORMAT); |
374 | ilf->ilf_type = XFS_LI_INODE; | 348 | ilf->ilf_type = XFS_LI_INODE; |
375 | ilf->ilf_ino = ip->i_ino; | 349 | ilf->ilf_ino = ip->i_ino; |
@@ -380,8 +354,6 @@ xfs_inode_item_format( | |||
380 | ilf->ilf_size = 2; /* format + core */ | 354 | ilf->ilf_size = 2; /* format + core */ |
381 | xlog_finish_iovec(lv, vecp, sizeof(struct xfs_inode_log_format)); | 355 | xlog_finish_iovec(lv, vecp, sizeof(struct xfs_inode_log_format)); |
382 | 356 | ||
383 | if (ip->i_d.di_version == 1) | ||
384 | xfs_inode_item_format_v1_inode(ip); | ||
385 | xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ICORE, | 357 | xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ICORE, |
386 | &ip->i_d, | 358 | &ip->i_d, |
387 | xfs_icdinode_size(ip->i_d.di_version)); | 359 | xfs_icdinode_size(ip->i_d.di_version)); |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 2d8f4fdf07f9..55724c8b204b 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -1228,15 +1228,8 @@ xfs_ioctl_setattr( | |||
1228 | olddquot = xfs_qm_vop_chown(tp, ip, | 1228 | olddquot = xfs_qm_vop_chown(tp, ip, |
1229 | &ip->i_pdquot, pdqp); | 1229 | &ip->i_pdquot, pdqp); |
1230 | } | 1230 | } |
1231 | ASSERT(ip->i_d.di_version > 1); | ||
1231 | xfs_set_projid(ip, fa->fsx_projid); | 1232 | xfs_set_projid(ip, fa->fsx_projid); |
1232 | |||
1233 | /* | ||
1234 | * We may have to rev the inode as well as | ||
1235 | * the superblock version number since projids didn't | ||
1236 | * exist before DINODE_VERSION_2 and SB_VERSION_NLINK. | ||
1237 | */ | ||
1238 | if (ip->i_d.di_version == 1) | ||
1239 | xfs_bump_ino_vers2(tp, ip); | ||
1240 | } | 1233 | } |
1241 | 1234 | ||
1242 | } | 1235 | } |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 944f3d9456a8..3f097825eff3 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -697,6 +697,12 @@ xfs_mountfs( | |||
697 | mp->m_update_flags |= XFS_SB_VERSIONNUM; | 697 | mp->m_update_flags |= XFS_SB_VERSIONNUM; |
698 | } | 698 | } |
699 | 699 | ||
700 | /* always use v2 inodes by default now */ | ||
701 | if (!(mp->m_sb.sb_versionnum & XFS_SB_VERSION_NLINKBIT)) { | ||
702 | mp->m_sb.sb_versionnum |= XFS_SB_VERSION_NLINKBIT; | ||
703 | mp->m_update_flags |= XFS_SB_VERSIONNUM; | ||
704 | } | ||
705 | |||
700 | /* | 706 | /* |
701 | * Check if sb_agblocks is aligned at stripe boundary | 707 | * Check if sb_agblocks is aligned at stripe boundary |
702 | * If sb_agblocks is NOT aligned turn off m_dalign since | 708 | * If sb_agblocks is NOT aligned turn off m_dalign since |
diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c index 8baf61afae1d..c3453b11f563 100644 --- a/fs/xfs/xfs_sb.c +++ b/fs/xfs/xfs_sb.c | |||
@@ -291,7 +291,8 @@ xfs_mount_validate_sb( | |||
291 | (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */) || | 291 | (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */) || |
292 | sbp->sb_dblocks == 0 || | 292 | sbp->sb_dblocks == 0 || |
293 | sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) || | 293 | sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) || |
294 | sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))) { | 294 | sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp) || |
295 | sbp->sb_shared_vn != 0)) { | ||
295 | xfs_notice(mp, "SB sanity check failed"); | 296 | xfs_notice(mp, "SB sanity check failed"); |
296 | return XFS_ERROR(EFSCORRUPTED); | 297 | return XFS_ERROR(EFSCORRUPTED); |
297 | } | 298 | } |
@@ -333,15 +334,6 @@ xfs_mount_validate_sb( | |||
333 | xfs_warn(mp, "Offline file system operation in progress!"); | 334 | xfs_warn(mp, "Offline file system operation in progress!"); |
334 | return XFS_ERROR(EFSCORRUPTED); | 335 | return XFS_ERROR(EFSCORRUPTED); |
335 | } | 336 | } |
336 | |||
337 | /* | ||
338 | * Version 1 directory format has never worked on Linux. | ||
339 | */ | ||
340 | if (unlikely(!xfs_sb_version_hasdirv2(sbp))) { | ||
341 | xfs_warn(mp, "file system using version 1 directory format"); | ||
342 | return XFS_ERROR(ENOSYS); | ||
343 | } | ||
344 | |||
345 | return 0; | 337 | return 0; |
346 | } | 338 | } |
347 | 339 | ||
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h index 950d1ea058b2..c43c2d609a24 100644 --- a/fs/xfs/xfs_sb.h +++ b/fs/xfs/xfs_sb.h | |||
@@ -36,8 +36,6 @@ struct xfs_trans; | |||
36 | #define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */ | 36 | #define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */ |
37 | #define XFS_SB_VERSION_NUMBITS 0x000f | 37 | #define XFS_SB_VERSION_NUMBITS 0x000f |
38 | #define XFS_SB_VERSION_ALLFBITS 0xfff0 | 38 | #define XFS_SB_VERSION_ALLFBITS 0xfff0 |
39 | #define XFS_SB_VERSION_SASHFBITS 0xf000 | ||
40 | #define XFS_SB_VERSION_REALFBITS 0x0ff0 | ||
41 | #define XFS_SB_VERSION_ATTRBIT 0x0010 | 39 | #define XFS_SB_VERSION_ATTRBIT 0x0010 |
42 | #define XFS_SB_VERSION_NLINKBIT 0x0020 | 40 | #define XFS_SB_VERSION_NLINKBIT 0x0020 |
43 | #define XFS_SB_VERSION_QUOTABIT 0x0040 | 41 | #define XFS_SB_VERSION_QUOTABIT 0x0040 |
@@ -50,24 +48,15 @@ struct xfs_trans; | |||
50 | #define XFS_SB_VERSION_DIRV2BIT 0x2000 | 48 | #define XFS_SB_VERSION_DIRV2BIT 0x2000 |
51 | #define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */ | 49 | #define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */ |
52 | #define XFS_SB_VERSION_MOREBITSBIT 0x8000 | 50 | #define XFS_SB_VERSION_MOREBITSBIT 0x8000 |
53 | #define XFS_SB_VERSION_OKSASHFBITS \ | 51 | |
54 | (XFS_SB_VERSION_EXTFLGBIT | \ | 52 | /* |
55 | XFS_SB_VERSION_DIRV2BIT | \ | 53 | * Supported feature bit list is just all bits in the versionnum field because |
56 | XFS_SB_VERSION_BORGBIT) | 54 | * we've used them all up and understand them all. Except, of course, for the |
57 | #define XFS_SB_VERSION_OKREALFBITS \ | 55 | * shared superblock bit, which nobody knows what it does and so is unsupported. |
58 | (XFS_SB_VERSION_ATTRBIT | \ | 56 | */ |
59 | XFS_SB_VERSION_NLINKBIT | \ | 57 | #define XFS_SB_VERSION_OKBITS \ |
60 | XFS_SB_VERSION_QUOTABIT | \ | 58 | ((XFS_SB_VERSION_NUMBITS | XFS_SB_VERSION_ALLFBITS) & \ |
61 | XFS_SB_VERSION_ALIGNBIT | \ | 59 | ~XFS_SB_VERSION_SHAREDBIT) |
62 | XFS_SB_VERSION_DALIGNBIT | \ | ||
63 | XFS_SB_VERSION_SHAREDBIT | \ | ||
64 | XFS_SB_VERSION_LOGV2BIT | \ | ||
65 | XFS_SB_VERSION_SECTORBIT | \ | ||
66 | XFS_SB_VERSION_MOREBITSBIT) | ||
67 | #define XFS_SB_VERSION_OKREALBITS \ | ||
68 | (XFS_SB_VERSION_NUMBITS | \ | ||
69 | XFS_SB_VERSION_OKREALFBITS | \ | ||
70 | XFS_SB_VERSION_OKSASHFBITS) | ||
71 | 60 | ||
72 | /* | 61 | /* |
73 | * There are two words to hold XFS "feature" bits: the original | 62 | * There are two words to hold XFS "feature" bits: the original |
@@ -76,7 +65,6 @@ struct xfs_trans; | |||
76 | * | 65 | * |
77 | * These defines represent bits in sb_features2. | 66 | * These defines represent bits in sb_features2. |
78 | */ | 67 | */ |
79 | #define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ | ||
80 | #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 | 68 | #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 |
81 | #define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ | 69 | #define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ |
82 | #define XFS_SB_VERSION2_RESERVED4BIT 0x00000004 | 70 | #define XFS_SB_VERSION2_RESERVED4BIT 0x00000004 |
@@ -86,16 +74,11 @@ struct xfs_trans; | |||
86 | #define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */ | 74 | #define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */ |
87 | #define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */ | 75 | #define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */ |
88 | 76 | ||
89 | #define XFS_SB_VERSION2_OKREALFBITS \ | 77 | #define XFS_SB_VERSION2_OKBITS \ |
90 | (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ | 78 | (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ |
91 | XFS_SB_VERSION2_ATTR2BIT | \ | 79 | XFS_SB_VERSION2_ATTR2BIT | \ |
92 | XFS_SB_VERSION2_PROJID32BIT | \ | 80 | XFS_SB_VERSION2_PROJID32BIT | \ |
93 | XFS_SB_VERSION2_FTYPE) | 81 | XFS_SB_VERSION2_FTYPE) |
94 | #define XFS_SB_VERSION2_OKSASHFBITS \ | ||
95 | (0) | ||
96 | #define XFS_SB_VERSION2_OKREALBITS \ | ||
97 | (XFS_SB_VERSION2_OKREALFBITS | \ | ||
98 | XFS_SB_VERSION2_OKSASHFBITS ) | ||
99 | 82 | ||
100 | /* | 83 | /* |
101 | * Superblock - in core version. Must match the ondisk version below. | 84 | * Superblock - in core version. Must match the ondisk version below. |
@@ -345,214 +328,140 @@ typedef enum { | |||
345 | 328 | ||
346 | #define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) | 329 | #define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) |
347 | 330 | ||
348 | static inline int xfs_sb_good_version(xfs_sb_t *sbp) | ||
349 | { | ||
350 | /* We always support version 1-3 */ | ||
351 | if (sbp->sb_versionnum >= XFS_SB_VERSION_1 && | ||
352 | sbp->sb_versionnum <= XFS_SB_VERSION_3) | ||
353 | return 1; | ||
354 | |||
355 | /* We support version 4 if all feature bits are supported */ | ||
356 | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) { | ||
357 | if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || | ||
358 | ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && | ||
359 | (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) | ||
360 | return 0; | ||
361 | |||
362 | if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN) | ||
363 | return 0; | ||
364 | return 1; | ||
365 | } | ||
366 | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) | ||
367 | return 1; | ||
368 | |||
369 | return 0; | ||
370 | } | ||
371 | |||
372 | /* | 331 | /* |
373 | * Detect a mismatched features2 field. Older kernels read/wrote | 332 | * The first XFS version we support is a v4 superblock with V2 directories. |
374 | * this into the wrong slot, so to be safe we keep them in sync. | ||
375 | */ | 333 | */ |
376 | static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp) | 334 | static inline bool xfs_sb_good_v4_features(struct xfs_sb *sbp) |
377 | { | 335 | { |
378 | return (sbp->sb_bad_features2 != sbp->sb_features2); | 336 | if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) |
379 | } | 337 | return false; |
380 | 338 | ||
381 | static inline unsigned xfs_sb_version_tonew(unsigned v) | 339 | /* check for unknown features in the fs */ |
382 | { | 340 | if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) || |
383 | if (v == XFS_SB_VERSION_1) | 341 | ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && |
384 | return XFS_SB_VERSION_4; | 342 | (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS))) |
343 | return false; | ||
385 | 344 | ||
386 | if (v == XFS_SB_VERSION_2) | 345 | return true; |
387 | return XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT; | ||
388 | |||
389 | return XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT | | ||
390 | XFS_SB_VERSION_NLINKBIT; | ||
391 | } | 346 | } |
392 | 347 | ||
393 | static inline unsigned xfs_sb_version_toold(unsigned v) | 348 | static inline bool xfs_sb_good_version(struct xfs_sb *sbp) |
394 | { | 349 | { |
395 | if (v & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) | 350 | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) |
396 | return 0; | 351 | return true; |
397 | if (v & XFS_SB_VERSION_NLINKBIT) | 352 | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) |
398 | return XFS_SB_VERSION_3; | 353 | return xfs_sb_good_v4_features(sbp); |
399 | if (v & XFS_SB_VERSION_ATTRBIT) | 354 | return false; |
400 | return XFS_SB_VERSION_2; | ||
401 | return XFS_SB_VERSION_1; | ||
402 | } | ||
403 | |||
404 | static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp) | ||
405 | { | ||
406 | return sbp->sb_versionnum == XFS_SB_VERSION_2 || | ||
407 | sbp->sb_versionnum == XFS_SB_VERSION_3 || | ||
408 | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | ||
409 | (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT)); | ||
410 | } | 355 | } |
411 | 356 | ||
412 | static inline void xfs_sb_version_addattr(xfs_sb_t *sbp) | 357 | /* |
358 | * Detect a mismatched features2 field. Older kernels read/wrote | ||
359 | * this into the wrong slot, so to be safe we keep them in sync. | ||
360 | */ | ||
361 | static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp) | ||
413 | { | 362 | { |
414 | if (sbp->sb_versionnum == XFS_SB_VERSION_1) | 363 | return sbp->sb_bad_features2 != sbp->sb_features2; |
415 | sbp->sb_versionnum = XFS_SB_VERSION_2; | ||
416 | else if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4) | ||
417 | sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT; | ||
418 | else | ||
419 | sbp->sb_versionnum = XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT; | ||
420 | } | 364 | } |
421 | 365 | ||
422 | static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp) | 366 | static inline bool xfs_sb_version_hasattr(struct xfs_sb *sbp) |
423 | { | 367 | { |
424 | return sbp->sb_versionnum == XFS_SB_VERSION_3 || | 368 | return (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT); |
425 | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | ||
426 | (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)); | ||
427 | } | 369 | } |
428 | 370 | ||
429 | static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp) | 371 | static inline void xfs_sb_version_addattr(struct xfs_sb *sbp) |
430 | { | 372 | { |
431 | if (sbp->sb_versionnum <= XFS_SB_VERSION_2) | 373 | sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT; |
432 | sbp->sb_versionnum = XFS_SB_VERSION_3; | ||
433 | else | ||
434 | sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT; | ||
435 | } | 374 | } |
436 | 375 | ||
437 | static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp) | 376 | static inline bool xfs_sb_version_hasquota(struct xfs_sb *sbp) |
438 | { | 377 | { |
439 | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | 378 | return (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT); |
440 | (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT); | ||
441 | } | 379 | } |
442 | 380 | ||
443 | static inline void xfs_sb_version_addquota(xfs_sb_t *sbp) | 381 | static inline void xfs_sb_version_addquota(struct xfs_sb *sbp) |
444 | { | 382 | { |
445 | if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4) | 383 | sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT; |
446 | sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT; | ||
447 | else | ||
448 | sbp->sb_versionnum = xfs_sb_version_tonew(sbp->sb_versionnum) | | ||
449 | XFS_SB_VERSION_QUOTABIT; | ||
450 | } | 384 | } |
451 | 385 | ||
452 | static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp) | 386 | static inline bool xfs_sb_version_hasalign(struct xfs_sb *sbp) |
453 | { | 387 | { |
454 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 388 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 || |
455 | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | ||
456 | (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)); | 389 | (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)); |
457 | } | 390 | } |
458 | 391 | ||
459 | static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp) | 392 | static inline bool xfs_sb_version_hasdalign(struct xfs_sb *sbp) |
460 | { | 393 | { |
461 | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | 394 | return (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); |
462 | (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); | ||
463 | } | 395 | } |
464 | 396 | ||
465 | static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp) | 397 | static inline bool xfs_sb_version_haslogv2(struct xfs_sb *sbp) |
466 | { | 398 | { |
467 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | 399 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 || |
468 | (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT); | 400 | (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT); |
469 | } | 401 | } |
470 | 402 | ||
471 | static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp) | 403 | static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp) |
472 | { | 404 | { |
473 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 405 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 || |
474 | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | 406 | (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT); |
475 | (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)); | ||
476 | } | 407 | } |
477 | 408 | ||
478 | static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp) | 409 | static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp) |
479 | { | 410 | { |
480 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 411 | return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT); |
481 | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | ||
482 | (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)); | ||
483 | } | 412 | } |
484 | 413 | ||
485 | static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp) | 414 | static inline bool xfs_sb_version_hasasciici(struct xfs_sb *sbp) |
486 | { | 415 | { |
487 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 416 | return (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT); |
488 | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | ||
489 | (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)); | ||
490 | } | 417 | } |
491 | 418 | ||
492 | static inline int xfs_sb_version_hassector(xfs_sb_t *sbp) | 419 | static inline bool xfs_sb_version_hasmorebits(struct xfs_sb *sbp) |
493 | { | 420 | { |
494 | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | 421 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 || |
495 | (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT); | 422 | (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT); |
496 | } | ||
497 | |||
498 | static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp) | ||
499 | { | ||
500 | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | ||
501 | (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT); | ||
502 | } | ||
503 | |||
504 | static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp) | ||
505 | { | ||
506 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | ||
507 | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | ||
508 | (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)); | ||
509 | } | 423 | } |
510 | 424 | ||
511 | /* | 425 | /* |
512 | * sb_features2 bit version macros. | 426 | * sb_features2 bit version macros. |
513 | * | ||
514 | * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro: | ||
515 | * | ||
516 | * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) | ||
517 | * ((xfs_sb_version_hasmorebits(sbp) && | ||
518 | * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) | ||
519 | */ | 427 | */ |
520 | 428 | static inline bool xfs_sb_version_haslazysbcount(struct xfs_sb *sbp) | |
521 | static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp) | ||
522 | { | 429 | { |
523 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 430 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || |
524 | (xfs_sb_version_hasmorebits(sbp) && | 431 | (xfs_sb_version_hasmorebits(sbp) && |
525 | (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)); | 432 | (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)); |
526 | } | 433 | } |
527 | 434 | ||
528 | static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp) | 435 | static inline bool xfs_sb_version_hasattr2(struct xfs_sb *sbp) |
529 | { | 436 | { |
530 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 437 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || |
531 | (xfs_sb_version_hasmorebits(sbp) && | 438 | (xfs_sb_version_hasmorebits(sbp) && |
532 | (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT)); | 439 | (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT)); |
533 | } | 440 | } |
534 | 441 | ||
535 | static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) | 442 | static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp) |
536 | { | 443 | { |
537 | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | 444 | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; |
538 | sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; | 445 | sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; |
446 | sbp->sb_bad_features2 |= XFS_SB_VERSION2_ATTR2BIT; | ||
539 | } | 447 | } |
540 | 448 | ||
541 | static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp) | 449 | static inline void xfs_sb_version_removeattr2(struct xfs_sb *sbp) |
542 | { | 450 | { |
543 | sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; | 451 | sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; |
452 | sbp->sb_bad_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; | ||
544 | if (!sbp->sb_features2) | 453 | if (!sbp->sb_features2) |
545 | sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT; | 454 | sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT; |
546 | } | 455 | } |
547 | 456 | ||
548 | static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) | 457 | static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp) |
549 | { | 458 | { |
550 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | 459 | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || |
551 | (xfs_sb_version_hasmorebits(sbp) && | 460 | (xfs_sb_version_hasmorebits(sbp) && |
552 | (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); | 461 | (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); |
553 | } | 462 | } |
554 | 463 | ||
555 | static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) | 464 | static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp) |
556 | { | 465 | { |
557 | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | 466 | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; |
558 | sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; | 467 | sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; |
@@ -625,12 +534,12 @@ xfs_sb_has_incompat_log_feature( | |||
625 | /* | 534 | /* |
626 | * V5 superblock specific feature checks | 535 | * V5 superblock specific feature checks |
627 | */ | 536 | */ |
628 | static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp) | 537 | static inline int xfs_sb_version_hascrc(struct xfs_sb *sbp) |
629 | { | 538 | { |
630 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; | 539 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; |
631 | } | 540 | } |
632 | 541 | ||
633 | static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp) | 542 | static inline int xfs_sb_version_has_pquotino(struct xfs_sb *sbp) |
634 | { | 543 | { |
635 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; | 544 | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; |
636 | } | 545 | } |