Skip to contentSkip to conversation

ceph: remove CEPH_MOUNT_OPT_FSCACHE flag

PATCH In review [email protected] 2 participants 3 messages Feb 12, 2020 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: remove CEPH_MOUNT_OPT_FSCACHE flag

From: Xiubo Li <[email protected]>

Since we can figure out whether the fscache is enabled or not by using the fscache_uniq and this flag is redundant.

---
 fs/ceph/super.c | 9 +++------
 fs/ceph/super.h | 9 ++++-----
 2 files changed, 7 insertions(+), 11 deletions(-)
fs/ceph/super.c +3 -6
index 48f86eb82b9b..8df506dd9039 100644
@@ -383,10 +383,7 @@ static int ceph_parse_mount_param(struct fs_context *fc,
 #ifdef CONFIG_CEPH_FSCACHE
 		kfree(fsopt->fscache_uniq);
 		fsopt->fscache_uniq = NULL;
-		if (result.negated) {
-			fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
-		} else {
-			fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
+		if (!result.negated) {
 			fsopt->fscache_uniq = param->string;
 			param->string = NULL;
 		}
@@ -605,7 +602,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
 		seq_puts(m, ",nodcache");
 	if (fsopt->flags & CEPH_MOUNT_OPT_INO32)
 		seq_puts(m, ",ino32");
-	if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
+	if (fsopt->fscache_uniq) {
 		seq_show_option(m, "fsc", fsopt->fscache_uniq);
 	}
 	if (fsopt->flags & CEPH_MOUNT_OPT_NOPOOLPERM)
@@ -969,7 +966,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
 			goto out;
 
 		/* setup fscache */
-		if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
+		if (fsc->mount_options->fscache_uniq) {
 			err = ceph_fscache_register_fs(fsc, fc);
 			if (err < 0)
 				goto out;
fs/ceph/super.h +4 -5
index ebc25072b19b..ad44b98f3c3b 100644
@@ -38,11 +38,10 @@
 #define CEPH_MOUNT_OPT_NOASYNCREADDIR  (1<<7) /* no dcache readdir */
 #define CEPH_MOUNT_OPT_INO32           (1<<8) /* 32 bit inos */
 #define CEPH_MOUNT_OPT_DCACHE          (1<<9) /* use dcache for readdir etc */
-#define CEPH_MOUNT_OPT_FSCACHE         (1<<10) /* use fscache */
-#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<11) /* no pool permission check */
-#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<12) /* mount waits if no mds is up */
-#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<13) /* no root dir quota in statfs */
-#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<14) /* don't use RADOS 'copy-from' op */
+#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<10) /* no pool permission check */
+#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<11) /* mount waits if no mds is up */
+#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<12) /* no root dir quota in statfs */
+#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<13) /* don't use RADOS 'copy-from' op */
 
 #define CEPH_MOUNT_OPT_DEFAULT			\
 	(CEPH_MOUNT_OPT_DCACHE |		\
Signature · 1 line
2.21.0
maintainer
#1 lore raw
Quoted 56 lines · On Wed, Feb 12, 2020 at 9:24 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

Since we can figure out whether the fscache is enabled or not by using the fscache_uniq and this flag is redundant.

---
 fs/ceph/super.c | 9 +++------
 fs/ceph/super.h | 9 ++++-----
 2 files changed, 7 insertions(+), 11 deletions(-)
fs/ceph/super.c +3 -6
index 48f86eb82b9b..8df506dd9039 100644
@@ -383,10 +383,7 @@ static int ceph_parse_mount_param(struct fs_context *fc,
 #ifdef CONFIG_CEPH_FSCACHE
                kfree(fsopt->fscache_uniq);
                fsopt->fscache_uniq = NULL;
-               if (result.negated) {
-                       fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
-               } else {
-                       fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
+               if (!result.negated) {
                        fsopt->fscache_uniq = param->string;
                        param->string = NULL;
                }
@@ -605,7 +602,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
                seq_puts(m, ",nodcache");
        if (fsopt->flags & CEPH_MOUNT_OPT_INO32)
                seq_puts(m, ",ino32");
-       if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
+       if (fsopt->fscache_uniq) {
                seq_show_option(m, "fsc", fsopt->fscache_uniq);
        }
        if (fsopt->flags & CEPH_MOUNT_OPT_NOPOOLPERM)
@@ -969,7 +966,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
                        goto out;
 
                /* setup fscache */
-               if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
+               if (fsc->mount_options->fscache_uniq) {
                        err = ceph_fscache_register_fs(fsc, fc);
                        if (err < 0)
                                goto out;
fs/ceph/super.h +0 -2
index ebc25072b19b..ad44b98f3c3b 100644
@@ -38,11 +38,10 @@
 #define CEPH_MOUNT_OPT_NOASYNCREADDIR  (1<<7) /* no dcache readdir */
 #define CEPH_MOUNT_OPT_INO32           (1<<8) /* 32 bit inos */
 #define CEPH_MOUNT_OPT_DCACHE          (1<<9) /* use dcache for readdir etc */
-#define CEPH_MOUNT_OPT_FSCACHE         (1<<10) /* use fscache */
-#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<11) /* no pool permission check */

fs/ceph/super.h line 47

Quoted 10 lines
fs/ceph/super.h +4 -3
-#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<12) /* mount waits if no mds is up */
-#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<13) /* no root dir quota in statfs */
-#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<14) /* don't use RADOS 'copy-from' op */
+#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<10) /* no pool permission check */
+#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<11) /* mount waits if no mds is up */
+#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<12) /* no root dir quota in statfs */
+#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<13) /* don't use RADOS 'copy-from' op */
 
 #define CEPH_MOUNT_OPT_DEFAULT                 \
        (CEPH_MOUNT_OPT_DCACHE |                \

Hi Xiubo,

Did you test this both with and without supplying a uniquifier (i.e. both "-o fsc=<uniquifier>" and "-o fsc" cases? I'm pretty sure this breaks "-o fsc" case...

Thanks,

Ilya

author
#2 lore raw
Quoted 64 lines · Ilya Dryomov
Quoted 63 lines · On Wed, Feb 12, 2020 at 9:24 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

Since we can figure out whether the fscache is enabled or not by using the fscache_uniq and this flag is redundant.

---
  fs/ceph/super.c | 9 +++------
  fs/ceph/super.h | 9 ++++-----
  2 files changed, 7 insertions(+), 11 deletions(-)
fs/ceph/super.c +3 -6
index 48f86eb82b9b..8df506dd9039 100644
@@ -383,10 +383,7 @@ static int ceph_parse_mount_param(struct fs_context *fc,
  #ifdef CONFIG_CEPH_FSCACHE
                 kfree(fsopt->fscache_uniq);
                 fsopt->fscache_uniq = NULL;
-               if (result.negated) {
-                       fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
-               } else {
-                       fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
+               if (!result.negated) {
                         fsopt->fscache_uniq = param->string;
                         param->string = NULL;
                 }
@@ -605,7 +602,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
                 seq_puts(m, ",nodcache");
         if (fsopt->flags & CEPH_MOUNT_OPT_INO32)
                 seq_puts(m, ",ino32");
-       if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
+       if (fsopt->fscache_uniq) {
                 seq_show_option(m, "fsc", fsopt->fscache_uniq);
         }
         if (fsopt->flags & CEPH_MOUNT_OPT_NOPOOLPERM)
@@ -969,7 +966,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
                         goto out;
 
                 /* setup fscache */
-               if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
+               if (fsc->mount_options->fscache_uniq) {
                         err = ceph_fscache_register_fs(fsc, fc);
                         if (err < 0)
                                 goto out;
fs/ceph/super.h +4 -5
index ebc25072b19b..ad44b98f3c3b 100644
@@ -38,11 +38,10 @@
  #define CEPH_MOUNT_OPT_NOASYNCREADDIR  (1<<7) /* no dcache readdir */
  #define CEPH_MOUNT_OPT_INO32           (1<<8) /* 32 bit inos */
  #define CEPH_MOUNT_OPT_DCACHE          (1<<9) /* use dcache for readdir etc */
-#define CEPH_MOUNT_OPT_FSCACHE         (1<<10) /* use fscache */
-#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<11) /* no pool permission check */
-#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<12) /* mount waits if no mds is up */
-#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<13) /* no root dir quota in statfs */
-#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<14) /* don't use RADOS 'copy-from' op */
+#define CEPH_MOUNT_OPT_NOPOOLPERM      (1<<10) /* no pool permission check */
+#define CEPH_MOUNT_OPT_MOUNTWAIT       (1<<11) /* mount waits if no mds is up */
+#define CEPH_MOUNT_OPT_NOQUOTADF       (1<<12) /* no root dir quota in statfs */
+#define CEPH_MOUNT_OPT_NOCOPYFROM      (1<<13) /* don't use RADOS 'copy-from' op */
 
Quoted 7 lines

fs/ceph/super.h line 47

Quoted 2 lines
fs/ceph/super.h +0 -0
  #define CEPH_MOUNT_OPT_DEFAULT                 \
         (CEPH_MOUNT_OPT_DCACHE |                \

Hi Xiubo,

Did you test this both with and without supplying a uniquifier (i.e. both "-o fsc=<uniquifier>" and "-o fsc" cases? I'm pretty sure this breaks "-o fsc" case...

Yeah, it seems will.

Thanks,

BRs

Quoted 4 lines

Thanks,

Ilya