Commit 07ed016c authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Bernhard Thoben
Browse files

ANDROID: sdcardfs: Add option to drop unused dentries



This adds the nocache mount option, which will cause sdcardfs to always
drop dentries that are not in use, preventing cached entries from
holding on to lower dentries, which could  cause strange behavior when
bypassing the sdcardfs layer and directly changing the lower fs.

Change-Id: I70268584a20b989ae8cfdd278a2e4fa1605217fb
Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
[basilgello: imply 5dd43fe0853d27266768781a530d2862dff76170 ]
Signed-Off-By: default avatarVasyl Gello <vasek.gello@gmail.com>
parent 86ff9278
......@@ -181,9 +181,10 @@ static void sdcardfs_canonical_path(const struct path *path,
sdcardfs_get_real_lower(path->dentry, actual_path);
}
static int sdcardfs_d_delete(const struct dentry * dentry)
/* 1 = delete, 0 = cache */
static int sdcardfs_d_delete(const struct dentry *d)
{
return dentry->d_inode && !S_ISDIR(dentry->d_inode->i_mode);
return SDCARDFS_SB(d->d_sb)->options.nocache ? 1 : 0;
}
const struct dentry_operations sdcardfs_ci_dops = {
......
......@@ -34,6 +34,7 @@ enum {
Opt_reserved_mb,
Opt_gid_derivation,
Opt_default_normal,
Opt_nocache,
Opt_unshared_obb,
Opt_err,
};
......@@ -50,6 +51,7 @@ static const match_table_t sdcardfs_tokens = {
{Opt_default_normal, "default_normal"},
{Opt_unshared_obb, "unshared_obb"},
{Opt_reserved_mb, "reserved_mb=%u"},
{Opt_nocache, "nocache"},
{Opt_err, NULL}
};
......@@ -73,6 +75,7 @@ static int parse_options(struct super_block *sb, char *options, int silent,
/* by default, gid derivation is off */
opts->gid_derivation = false;
opts->default_normal = false;
opts->nocache = false;
*debug = 0;
......@@ -130,6 +133,9 @@ static int parse_options(struct super_block *sb, char *options, int silent,
case Opt_default_normal:
opts->default_normal = true;
break;
case Opt_nocache:
opts->nocache = true;
break;
case Opt_unshared_obb:
opts->unshared_obb = true;
break;
......
......@@ -198,6 +198,7 @@ struct sdcardfs_mount_options {
bool default_normal;
bool unshared_obb;
unsigned int reserved_mb;
bool nocache;
};
struct sdcardfs_vfsmount_options {
......
......@@ -311,6 +311,8 @@ static int sdcardfs_show_options(struct vfsmount *mnt, struct seq_file *m,
seq_puts(m, ",default_normal");
if (opts->reserved_mb != 0)
seq_printf(m, ",reserved=%uMB", opts->reserved_mb);
if (opts->nocache)
seq_printf(m, ",nocache");
if (opts->unshared_obb)
seq_printf(m, ",unshared_obb");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment