diff mbox

[v2] ceph: minor cleanups of showing options

Message ID 1517925261-50747-1-git-send-email-cgxu519@icloud.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu Feb. 6, 2018, 1:54 p.m. UTC
Minor cleanups of showing options for mount and client.

Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
---
Changes since v1:
- Do not change comma seqence in ceph_print_client_options()
 because there is another caller from different path.

 fs/ceph/super.c        | 13 ++-----------
 net/ceph/ceph_common.c |  3 +++
 2 files changed, 5 insertions(+), 11 deletions(-)

Comments

Ilya Dryomov Feb. 12, 2018, 3:58 p.m. UTC | #1
On Tue, Feb 6, 2018 at 2:54 PM, Chengguang Xu <cgxu519@icloud.com> wrote:
> Minor cleanups of showing options for mount and client.
>
> Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
> ---
> Changes since v1:
> - Do not change comma seqence in ceph_print_client_options()
>  because there is another caller from different path.
>
>  fs/ceph/super.c        | 13 ++-----------
>  net/ceph/ceph_common.c |  3 +++
>  2 files changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index bfc85b2..7f1e212 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -489,21 +489,12 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>  {
>         struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
>         struct ceph_mount_options *fsopt = fsc->mount_options;
> -       size_t pos;
>         int ret;
>
> -       /* a comma between MNT/MS and client options */
> -       seq_putc(m, ',');
> -       pos = m->count;
> -
>         ret = ceph_print_client_options(m, fsc->client);
>         if (ret)
>                 return ret;
>
> -       /* retract our comma if no client options */
> -       if (m->count == pos)
> -               m->count--;
> -
>         if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT)
>                 seq_puts(m, ",dirstat");
>         if ((fsopt->flags & CEPH_MOUNT_OPT_RBYTES))
> @@ -514,7 +505,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>                 seq_puts(m, ",nodcache");
>         if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
>                 if (fsopt->fscache_uniq)
> -                       seq_printf(m, ",fsc=%s", fsopt->fscache_uniq);
> +                       seq_show_option(m, "fsc", fsopt->fscache_uniq);
>                 else
>                         seq_puts(m, ",fsc");
>         }
> @@ -529,7 +520,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>  #endif
>
>         if (fsopt->mds_namespace)
> -               seq_printf(m, ",mds_namespace=%s", fsopt->mds_namespace);
> +               seq_show_option(m, "mds_namespace", fsopt->mds_namespace);
>         if (fsopt->wsize)
>                 seq_printf(m, ",wsize=%d", fsopt->wsize);
>         if (fsopt->rsize != CEPH_MAX_READ_SIZE)

I don't think changing the way commas work is worth it.  If you resend
just the seq_printf -> seq_show_option bits, I'll take that patch.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chengguang Xu Feb. 13, 2018, 1:38 a.m. UTC | #2
Hi Ilya

I’ve resent patch and changed the title properly.


Thanks,
Chengguang.



> 在 2018年2月12日,下午11:58,Ilya Dryomov <idryomov@gmail.com> 写道:
> 
> On Tue, Feb 6, 2018 at 2:54 PM, Chengguang Xu <cgxu519@icloud.com> wrote:
>> Minor cleanups of showing options for mount and client.
>> 
>> Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
>> ---
>> Changes since v1:
>> - Do not change comma seqence in ceph_print_client_options()
>> because there is another caller from different path.
>> 
>> fs/ceph/super.c        | 13 ++-----------
>> net/ceph/ceph_common.c |  3 +++
>> 2 files changed, 5 insertions(+), 11 deletions(-)
>> 
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index bfc85b2..7f1e212 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -489,21 +489,12 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>> {
>>        struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
>>        struct ceph_mount_options *fsopt = fsc->mount_options;
>> -       size_t pos;
>>        int ret;
>> 
>> -       /* a comma between MNT/MS and client options */
>> -       seq_putc(m, ',');
>> -       pos = m->count;
>> -
>>        ret = ceph_print_client_options(m, fsc->client);
>>        if (ret)
>>                return ret;
>> 
>> -       /* retract our comma if no client options */
>> -       if (m->count == pos)
>> -               m->count--;
>> -
>>        if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT)
>>                seq_puts(m, ",dirstat");
>>        if ((fsopt->flags & CEPH_MOUNT_OPT_RBYTES))
>> @@ -514,7 +505,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>>                seq_puts(m, ",nodcache");
>>        if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
>>                if (fsopt->fscache_uniq)
>> -                       seq_printf(m, ",fsc=%s", fsopt->fscache_uniq);
>> +                       seq_show_option(m, "fsc", fsopt->fscache_uniq);
>>                else
>>                        seq_puts(m, ",fsc");
>>        }
>> @@ -529,7 +520,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
>> #endif
>> 
>>        if (fsopt->mds_namespace)
>> -               seq_printf(m, ",mds_namespace=%s", fsopt->mds_namespace);
>> +               seq_show_option(m, "mds_namespace", fsopt->mds_namespace);
>>        if (fsopt->wsize)
>>                seq_printf(m, ",wsize=%d", fsopt->wsize);
>>        if (fsopt->rsize != CEPH_MAX_READ_SIZE)
> 
> I don't think changing the way commas work is worth it.  If you resend
> just the seq_printf -> seq_show_option bits, I'll take that patch.
> 
> Thanks,
> 
>                Ilya
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index bfc85b2..7f1e212 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -489,21 +489,12 @@  static int ceph_show_options(struct seq_file *m, struct dentry *root)
 {
 	struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
 	struct ceph_mount_options *fsopt = fsc->mount_options;
-	size_t pos;
 	int ret;
 
-	/* a comma between MNT/MS and client options */
-	seq_putc(m, ',');
-	pos = m->count;
-
 	ret = ceph_print_client_options(m, fsc->client);
 	if (ret)
 		return ret;
 
-	/* retract our comma if no client options */
-	if (m->count == pos)
-		m->count--;
-
 	if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT)
 		seq_puts(m, ",dirstat");
 	if ((fsopt->flags & CEPH_MOUNT_OPT_RBYTES))
@@ -514,7 +505,7 @@  static int ceph_show_options(struct seq_file *m, struct dentry *root)
 		seq_puts(m, ",nodcache");
 	if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) {
 		if (fsopt->fscache_uniq)
-			seq_printf(m, ",fsc=%s", fsopt->fscache_uniq);
+			seq_show_option(m, "fsc", fsopt->fscache_uniq);
 		else
 			seq_puts(m, ",fsc");
 	}
@@ -529,7 +520,7 @@  static int ceph_show_options(struct seq_file *m, struct dentry *root)
 #endif
 
 	if (fsopt->mds_namespace)
-		seq_printf(m, ",mds_namespace=%s", fsopt->mds_namespace);
+		seq_show_option(m, "mds_namespace", fsopt->mds_namespace);
 	if (fsopt->wsize)
 		seq_printf(m, ",wsize=%d", fsopt->wsize);
 	if (fsopt->rsize != CEPH_MAX_READ_SIZE)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index cdb5b69..3f30636 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -545,6 +545,9 @@  int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
 	struct ceph_options *opt = client->options;
 	size_t pos = m->count;
 
+	if (m->count)
+		seq_putc(m, ',');
+
 	if (opt->name) {
 		seq_puts(m, "name=");
 		seq_escape(m, opt->name, ", \t\n\\");