Skip to content

Commit e4599d4

Browse files
committed
ovl: negate the ofs->share_whiteout boolean
The default common case is that whiteout sharing is enabled. Change to storing the negated no_shared_whiteout state, so we will not need to initialize it. This is the first step towards removing all config and feature initializations out of ovl_fill_super(). Signed-off-by: Amir Goldstein <amir73il@gmail.com>
1 parent f723edb commit e4599d4

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

fs/overlayfs/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
8383
ofs->whiteout = whiteout;
8484
}
8585

86-
if (ofs->share_whiteout) {
86+
if (!ofs->no_shared_whiteout) {
8787
whiteout = ovl_lookup_temp(ofs, workdir);
8888
if (IS_ERR(whiteout))
8989
goto out;
@@ -95,7 +95,7 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
9595
if (err != -EMLINK) {
9696
pr_warn("Failed to link whiteout - disabling whiteout inode sharing(nlink=%u, err=%i)\n",
9797
ofs->whiteout->d_inode->i_nlink, err);
98-
ofs->share_whiteout = false;
98+
ofs->no_shared_whiteout = true;
9999
}
100100
dput(whiteout);
101101
}

fs/overlayfs/ovl_entry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ struct ovl_fs {
8686
/* Did we take the inuse lock? */
8787
bool upperdir_locked;
8888
bool workdir_locked;
89-
bool share_whiteout;
9089
/* Traps in ovl inode cache */
9190
struct inode *workbasedir_trap;
9291
struct inode *workdir_trap;
@@ -95,8 +94,9 @@ struct ovl_fs {
9594
int xino_mode;
9695
/* For allocation of non-persistent inode numbers */
9796
atomic_long_t last_ino;
98-
/* Whiteout dentry cache */
97+
/* Shared whiteout cache */
9998
struct dentry *whiteout;
99+
bool no_shared_whiteout;
100100
/* r/o snapshot of upperdir sb's only taken on volatile mounts */
101101
errseq_t errseq;
102102
};

fs/overlayfs/super.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,9 +1954,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
19541954
if (!cred)
19551955
goto out_err;
19561956

1957-
/* Is there a reason anyone would want not to share whiteouts? */
1958-
ofs->share_whiteout = true;
1959-
19601957
ofs->config.index = ovl_index_def;
19611958
ofs->config.uuid = true;
19621959
ofs->config.nfs_export = ovl_nfs_export_def;

0 commit comments

Comments
 (0)