aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode_item.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-05-19 17:46:40 -0400
committerDave Chinner <david@fromorbit.com>2014-05-19 17:46:40 -0400
commit263997a6842b27a49f42bd795c5dd12242917b22 (patch)
tree200787e719da8e4e91a04d1235e47538aa4b85eb /fs/xfs/xfs_inode_item.c
parent32bf1deae15b67839a2f0cb233254125be73fc78 (diff)
xfs: turn NLINK feature on by default
mkfs has turned on the XFS_SB_VERSION_NLINKBIT feature bit by default since November 2007. It's about time we simply made the kernel code turn it on by default and so always convert v1 inodes to v2 inodes when reading them in from disk or allocating them. This This removes needless version checks and modification when bumping link counts on inodes, and will take code out of a few common code paths. text data bss dec hex filename 783251 100867 616 884734 d7ffe fs/xfs/xfs.o.orig 782664 100867 616 884147 d7db3 fs/xfs/xfs.o.patched Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_inode_item.c')
-rw-r--r--fs/xfs/xfs_inode_item.c32
1 files changed, 2 insertions, 30 deletions
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 */
154STATIC void
155xfs_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
176STATIC void 148STATIC void
177xfs_inode_item_format_data_fork( 149xfs_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));