diff mbox series

[V2] libceph: introduce new option abort_on_full

Message ID 1544608543-11911-1-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show
Series [V2] libceph: introduce new option abort_on_full | expand

Commit Message

Dongsheng Yang Dec. 12, 2018, 9:55 a.m. UTC
Introduce a new option abort_on_full, default to false. Then
we can get -ENOSPC when the pool is full, or reaches quota.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
---
 fs/ceph/super.c              |  2 +-
 include/linux/ceph/libceph.h |  2 ++
 net/ceph/ceph_common.c       | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

Comments

Chengguang Xu Dec. 12, 2018, 2:06 p.m. UTC | #1
On 12/12/18 5:55 PM, Dongsheng Yang wrote:
> Introduce a new option abort_on_full, default to false. Then
> we can get -ENOSPC when the pool is full, or reaches quota.
>
> Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
> ---
>   fs/ceph/super.c              |  2 +-
>   include/linux/ceph/libceph.h |  2 ++
>   net/ceph/ceph_common.c       | 10 ++++++++++
>   3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index b5ecd6f..3879b2a 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -632,6 +632,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
>   		goto fail;
>   	}
>   
> +	opt->abort_on_full = true;
>   	fsc->client = ceph_create_client(opt, fsc);
>   	if (IS_ERR(fsc->client)) {
>   		err = PTR_ERR(fsc->client);
> @@ -640,7 +641,6 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
>   	opt = NULL; /* fsc->client now owns this */
>   
>   	fsc->client->extra_mon_dispatch = extra_mon_dispatch;
> -	fsc->client->osdc.abort_on_full = true;
>   
>   	if (!fsopt->mds_namespace) {
>   		ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
> diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
> index 68bb09c..96cc054 100644
> --- a/include/linux/ceph/libceph.h
> +++ b/include/linux/ceph/libceph.h
> @@ -51,6 +51,7 @@ struct ceph_options {
>   	unsigned long osd_idle_ttl;		/* jiffies */
>   	unsigned long osd_keepalive_timeout;	/* jiffies */
>   	unsigned long osd_request_timeout;	/* jiffies */
> +	bool abort_on_full;

If it's just a bool option, maybe a flag bit is a better choice.


Thanks,
Chengguang


>   
>   	/*
>   	 * any type that can't be simply compared or doesn't need need
> @@ -72,6 +73,7 @@ struct ceph_options {
>   #define CEPH_OSD_KEEPALIVE_DEFAULT	msecs_to_jiffies(5 * 1000)
>   #define CEPH_OSD_IDLE_TTL_DEFAULT	msecs_to_jiffies(60 * 1000)
>   #define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0  /* no timeout */
> +#define CEPH_OSDC_ABORT_ON_FULL_DEFAULT false
>   
>   #define CEPH_MONC_HUNT_INTERVAL		msecs_to_jiffies(3 * 1000)
>   #define CEPH_MONC_PING_INTERVAL		msecs_to_jiffies(10 * 1000)
> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
> index 87afb9e..e86ce76 100644
> --- a/net/ceph/ceph_common.c
> +++ b/net/ceph/ceph_common.c
> @@ -255,6 +255,7 @@ enum {
>   	Opt_nocephx_sign_messages,
>   	Opt_tcp_nodelay,
>   	Opt_notcp_nodelay,
> +	Opt_abort_on_full,
>   };
>   
>   static match_table_t opt_tokens = {
> @@ -280,6 +281,7 @@ enum {
>   	{Opt_nocephx_sign_messages, "nocephx_sign_messages"},
>   	{Opt_tcp_nodelay, "tcp_nodelay"},
>   	{Opt_notcp_nodelay, "notcp_nodelay"},
> +	{Opt_abort_on_full, "abort_on_full"},
>   	{-1, NULL}
>   };
>   
> @@ -369,6 +371,7 @@ struct ceph_options *
>   	opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
>   	opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
>   	opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
> +	opt->abort_on_full = CEPH_OSDC_ABORT_ON_FULL_DEFAULT;
>   
>   	/* get mon ip(s) */
>   	/* ip1[:port1][,ip2[:port2]...] */
> @@ -535,6 +538,10 @@ struct ceph_options *
>   			opt->flags &= ~CEPH_OPT_TCP_NODELAY;
>   			break;
>   
> +		case Opt_abort_on_full:
> +			opt->abort_on_full = true;
> +			break;
> +
>   		default:
>   			BUG_ON(token);
>   		}
> @@ -587,6 +594,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
>   	if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT)
>   		seq_printf(m, "osd_request_timeout=%d,",
>   			   jiffies_to_msecs(opt->osd_request_timeout) / 1000);
> +	if (opt->abort_on_full != CEPH_OSDC_ABORT_ON_FULL_DEFAULT)
> +		seq_puts(m, "abort_on_full,");
>   
>   	/* drop redundant comma */
>   	if (m->count != pos)
> @@ -653,6 +662,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
>   	if (err < 0)
>   		goto fail_monc;
>   
> +	client->osdc.abort_on_full = opt->abort_on_full;
>   	return client;
>   
>   fail_monc:
Dongsheng Yang Dec. 13, 2018, 1:15 a.m. UTC | #2
On 12/12/2018 10:06 PM, cgxu519 wrote:
>
> On 12/12/18 5:55 PM, Dongsheng Yang wrote:
>> Introduce a new option abort_on_full, default to false. Then
>> we can get -ENOSPC when the pool is full, or reaches quota.
>>
>> Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
>> ---
>>   fs/ceph/super.c              |  2 +-
>>   include/linux/ceph/libceph.h |  2 ++
>>   net/ceph/ceph_common.c       | 10 ++++++++++
>>   3 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index b5ecd6f..3879b2a 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -632,6 +632,7 @@ static struct ceph_fs_client 
>> *create_fs_client(struct ceph_mount_options *fsopt,
>>           goto fail;
>>       }
>>   +    opt->abort_on_full = true;
>>       fsc->client = ceph_create_client(opt, fsc);
>>       if (IS_ERR(fsc->client)) {
>>           err = PTR_ERR(fsc->client);
>> @@ -640,7 +641,6 @@ static struct ceph_fs_client 
>> *create_fs_client(struct ceph_mount_options *fsopt,
>>       opt = NULL; /* fsc->client now owns this */
>>         fsc->client->extra_mon_dispatch = extra_mon_dispatch;
>> -    fsc->client->osdc.abort_on_full = true;
>>         if (!fsopt->mds_namespace) {
>>           ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
>> diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
>> index 68bb09c..96cc054 100644
>> --- a/include/linux/ceph/libceph.h
>> +++ b/include/linux/ceph/libceph.h
>> @@ -51,6 +51,7 @@ struct ceph_options {
>>       unsigned long osd_idle_ttl;        /* jiffies */
>>       unsigned long osd_keepalive_timeout;    /* jiffies */
>>       unsigned long osd_request_timeout;    /* jiffies */
>> +    bool abort_on_full;
>
> If it's just a bool option, maybe a flag bit is a better choice.

True.

Thanx
>
>
> Thanks,
> Chengguang
>
>
>>         /*
>>        * any type that can't be simply compared or doesn't need need
>> @@ -72,6 +73,7 @@ struct ceph_options {
>>   #define CEPH_OSD_KEEPALIVE_DEFAULT    msecs_to_jiffies(5 * 1000)
>>   #define CEPH_OSD_IDLE_TTL_DEFAULT    msecs_to_jiffies(60 * 1000)
>>   #define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0  /* no timeout */
>> +#define CEPH_OSDC_ABORT_ON_FULL_DEFAULT false
>>     #define CEPH_MONC_HUNT_INTERVAL        msecs_to_jiffies(3 * 1000)
>>   #define CEPH_MONC_PING_INTERVAL        msecs_to_jiffies(10 * 1000)
>> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
>> index 87afb9e..e86ce76 100644
>> --- a/net/ceph/ceph_common.c
>> +++ b/net/ceph/ceph_common.c
>> @@ -255,6 +255,7 @@ enum {
>>       Opt_nocephx_sign_messages,
>>       Opt_tcp_nodelay,
>>       Opt_notcp_nodelay,
>> +    Opt_abort_on_full,
>>   };
>>     static match_table_t opt_tokens = {
>> @@ -280,6 +281,7 @@ enum {
>>       {Opt_nocephx_sign_messages, "nocephx_sign_messages"},
>>       {Opt_tcp_nodelay, "tcp_nodelay"},
>>       {Opt_notcp_nodelay, "notcp_nodelay"},
>> +    {Opt_abort_on_full, "abort_on_full"},
>>       {-1, NULL}
>>   };
>>   @@ -369,6 +371,7 @@ struct ceph_options *
>>       opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
>>       opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
>>       opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
>> +    opt->abort_on_full = CEPH_OSDC_ABORT_ON_FULL_DEFAULT;
>>         /* get mon ip(s) */
>>       /* ip1[:port1][,ip2[:port2]...] */
>> @@ -535,6 +538,10 @@ struct ceph_options *
>>               opt->flags &= ~CEPH_OPT_TCP_NODELAY;
>>               break;
>>   +        case Opt_abort_on_full:
>> +            opt->abort_on_full = true;
>> +            break;
>> +
>>           default:
>>               BUG_ON(token);
>>           }
>> @@ -587,6 +594,8 @@ int ceph_print_client_options(struct seq_file *m, 
>> struct ceph_client *client)
>>       if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT)
>>           seq_printf(m, "osd_request_timeout=%d,",
>>                  jiffies_to_msecs(opt->osd_request_timeout) / 1000);
>> +    if (opt->abort_on_full != CEPH_OSDC_ABORT_ON_FULL_DEFAULT)
>> +        seq_puts(m, "abort_on_full,");
>>         /* drop redundant comma */
>>       if (m->count != pos)
>> @@ -653,6 +662,7 @@ struct ceph_client *ceph_create_client(struct 
>> ceph_options *opt, void *private)
>>       if (err < 0)
>>           goto fail_monc;
>>   +    client->osdc.abort_on_full = opt->abort_on_full;
>>       return client;
>>     fail_monc:
>
>
diff mbox series

Patch

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index b5ecd6f..3879b2a 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -632,6 +632,7 @@  static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 		goto fail;
 	}
 
+	opt->abort_on_full = true;
 	fsc->client = ceph_create_client(opt, fsc);
 	if (IS_ERR(fsc->client)) {
 		err = PTR_ERR(fsc->client);
@@ -640,7 +641,6 @@  static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 	opt = NULL; /* fsc->client now owns this */
 
 	fsc->client->extra_mon_dispatch = extra_mon_dispatch;
-	fsc->client->osdc.abort_on_full = true;
 
 	if (!fsopt->mds_namespace) {
 		ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 68bb09c..96cc054 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -51,6 +51,7 @@  struct ceph_options {
 	unsigned long osd_idle_ttl;		/* jiffies */
 	unsigned long osd_keepalive_timeout;	/* jiffies */
 	unsigned long osd_request_timeout;	/* jiffies */
+	bool abort_on_full;
 
 	/*
 	 * any type that can't be simply compared or doesn't need need
@@ -72,6 +73,7 @@  struct ceph_options {
 #define CEPH_OSD_KEEPALIVE_DEFAULT	msecs_to_jiffies(5 * 1000)
 #define CEPH_OSD_IDLE_TTL_DEFAULT	msecs_to_jiffies(60 * 1000)
 #define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0  /* no timeout */
+#define CEPH_OSDC_ABORT_ON_FULL_DEFAULT false
 
 #define CEPH_MONC_HUNT_INTERVAL		msecs_to_jiffies(3 * 1000)
 #define CEPH_MONC_PING_INTERVAL		msecs_to_jiffies(10 * 1000)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 87afb9e..e86ce76 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -255,6 +255,7 @@  enum {
 	Opt_nocephx_sign_messages,
 	Opt_tcp_nodelay,
 	Opt_notcp_nodelay,
+	Opt_abort_on_full,
 };
 
 static match_table_t opt_tokens = {
@@ -280,6 +281,7 @@  enum {
 	{Opt_nocephx_sign_messages, "nocephx_sign_messages"},
 	{Opt_tcp_nodelay, "tcp_nodelay"},
 	{Opt_notcp_nodelay, "notcp_nodelay"},
+	{Opt_abort_on_full, "abort_on_full"},
 	{-1, NULL}
 };
 
@@ -369,6 +371,7 @@  struct ceph_options *
 	opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
 	opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
 	opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
+	opt->abort_on_full = CEPH_OSDC_ABORT_ON_FULL_DEFAULT;
 
 	/* get mon ip(s) */
 	/* ip1[:port1][,ip2[:port2]...] */
@@ -535,6 +538,10 @@  struct ceph_options *
 			opt->flags &= ~CEPH_OPT_TCP_NODELAY;
 			break;
 
+		case Opt_abort_on_full:
+			opt->abort_on_full = true;
+			break;
+
 		default:
 			BUG_ON(token);
 		}
@@ -587,6 +594,8 @@  int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
 	if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT)
 		seq_printf(m, "osd_request_timeout=%d,",
 			   jiffies_to_msecs(opt->osd_request_timeout) / 1000);
+	if (opt->abort_on_full != CEPH_OSDC_ABORT_ON_FULL_DEFAULT)
+		seq_puts(m, "abort_on_full,");
 
 	/* drop redundant comma */
 	if (m->count != pos)
@@ -653,6 +662,7 @@  struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
 	if (err < 0)
 		goto fail_monc;
 
+	client->osdc.abort_on_full = opt->abort_on_full;
 	return client;
 
 fail_monc: