Re: [PATCH] ceph: trigger the reclaim work once there has enough pending caps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/26/19 6:01 PM, Xiubo Li wrote:
On 2019/11/26 17:49, Yan, Zheng wrote:
On Tue, Nov 26, 2019 at 4:57 PM <xiubli@xxxxxxxxxx> wrote:
From: Xiubo Li <xiubli@xxxxxxxxxx>

The nr in ceph_reclaim_caps_nr() is very possibly larger than 1,
so we may miss it and the reclaim work couldn't triggered as expected.

Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
  fs/ceph/mds_client.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 08b70b5ee05e..547ffe16f91c 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2020,7 +2020,7 @@ void ceph_reclaim_caps_nr(struct ceph_mds_client *mdsc, int nr)
         if (!nr)
                 return;
         val = atomic_add_return(nr, &mdsc->cap_reclaim_pending);
-       if (!(val % CEPH_CAPS_PER_RELEASE)) {
+       if (val / CEPH_CAPS_PER_RELEASE) {
                 atomic_set(&mdsc->cap_reclaim_pending, 0);
                 ceph_queue_cap_reclaim_work(mdsc);
         }
this will call ceph_queue_cap_reclaim_work too frequently

No it won't, the '/' here equals to '>=' and then the "mdsc->cap_reclaim_pending" will be reset and it will increase from 0 again.

It will make sure that only when "mdsc->cap_reclaim_pending >= CEPH_CAPS_PER_RELEASE" will call the work queue.

Work does not get executed immediately. call ceph_queue_cap_reclaim_work() when val == CEPH_CAPS_PER_RELEASE is enough. There is no point to call it too frequently



--
2.21.0







[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux