[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOi1vP8_x7gEGaKvKMKdGSCzs2OSJNeXPZ_KVLqdg051wpZfYA@mail.gmail.com>
Date: Tue, 29 Jun 2021 12:14:37 +0200
From: Ilya Dryomov <idryomov@...il.com>
To: Luis Henriques <lhenriques@...e.de>
Cc: Jeff Layton <jlayton@...nel.org>,
Ceph Development <ceph-devel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v2 1/2] ceph: allow schedule_delayed() callers to set
delay for workqueue
On Tue, Jun 29, 2021 at 11:47 AM Luis Henriques <lhenriques@...e.de> wrote:
>
> Allow schedule_delayed() callers to explicitly set the delay value instead
> of defaulting to a 5 secs value.
>
> Signed-off-by: Luis Henriques <lhenriques@...e.de>
> ---
> fs/ceph/mds_client.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e5af591d3bd4..08c76bf57fb1 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4502,13 +4502,18 @@ void inc_session_sequence(struct ceph_mds_session *s)
> }
>
> /*
> - * delayed work -- periodically trim expired leases, renew caps with mds
> + * delayed work -- periodically trim expired leases, renew caps with mds. If
> + * the @delay parameter is set to 0 or if it's more than 5 secs, the default
> + * workqueue delay value of 5 secs will be used.
> */
> -static void schedule_delayed(struct ceph_mds_client *mdsc)
> +static void schedule_delayed(struct ceph_mds_client *mdsc, unsigned long delay)
> {
> - int delay = 5;
> - unsigned hz = round_jiffies_relative(HZ * delay);
> - schedule_delayed_work(&mdsc->delayed_work, hz);
> + unsigned long max_delay = round_jiffies_relative(HZ * 5);
> +
> + /* 5 secs default delay */
> + if (!delay || (delay > max_delay))
> + delay = max_delay;
> + schedule_delayed_work(&mdsc->delayed_work, delay);
Hi Luis,
Is there a reason to not round the non-default delay? Does it need to
be precise?
Thanks,
Ilya
Powered by blists - more mailing lists