Whamcloud - gitweb
LU-8626 hsm: count the number of started requests of each type 77/28677/9
authorQuentin Bouget <quentin.bouget@cea.fr>
Thu, 24 Aug 2017 11:16:04 +0000 (13:16 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 17 Dec 2017 06:18:45 +0000 (06:18 +0000)
Add counters in the coordinator to keep track of how many started hsm
requests of each type (ARCHIVE, RESTORE, REMOVE) the coordinator is
managing. There is no counter for CANCEL requests as the coordinator
does not keep track of them like it does for the other requests.

Test-Parameters: trivial testlist=sanity-hsm
Signed-off-by: Quentin Bouget <quentin.bouget@cea.fr>
Change-Id: I0c1e9881f2f6a4f005dfc3545b1b51714eb91b7b
Reviewed-on: https://review.whamcloud.com/28677
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Stephan Thiell <sthiell@stanford.edu>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_coordinator.c
lustre/mdt/mdt_hsm_cdt_requests.c
lustre/mdt/mdt_internal.h

index 53abb99..ac99386 100644 (file)
@@ -1072,6 +1072,9 @@ static int mdt_hsm_cdt_start(struct mdt_device *mdt)
        /* cdt_last_cookie is protected by cdt_llog_lock */
        cdt->cdt_last_cookie = ktime_get_real_seconds();
        atomic_set(&cdt->cdt_request_count, 0);
+       atomic_set(&cdt->cdt_archive_count, 0);
+       atomic_set(&cdt->cdt_restore_count, 0);
+       atomic_set(&cdt->cdt_remove_count, 0);
        cdt->cdt_user_request_mask = (1UL << HSMA_RESTORE);
        cdt->cdt_group_request_mask = (1UL << HSMA_RESTORE);
        cdt->cdt_other_request_mask = (1UL << HSMA_RESTORE);
index 60872ed..29a638d 100644 (file)
@@ -382,6 +382,17 @@ int mdt_cdt_add_request(struct coordinator *cdt, struct cdt_agent_req *car)
 
        mdt_hsm_agent_update_statistics(cdt, 0, 0, 1, &car->car_uuid);
 
+       switch (car->car_hai->hai_action) {
+       case HSMA_ARCHIVE:
+               atomic_inc(&cdt->cdt_archive_count);
+               break;
+       case HSMA_RESTORE:
+               atomic_inc(&cdt->cdt_restore_count);
+               break;
+       case HSMA_REMOVE:
+               atomic_inc(&cdt->cdt_remove_count);
+               break;
+       }
        atomic_inc(&cdt->cdt_request_count);
 
        RETURN(0);
@@ -427,6 +438,18 @@ int mdt_cdt_remove_request(struct coordinator *cdt, __u64 cookie)
        list_del(&car->car_request_list);
        up_write(&cdt->cdt_request_lock);
 
+       switch (car->car_hai->hai_action) {
+       case HSMA_ARCHIVE:
+               atomic_dec(&cdt->cdt_archive_count);
+               break;
+       case HSMA_RESTORE:
+               atomic_dec(&cdt->cdt_restore_count);
+               break;
+       case HSMA_REMOVE:
+               atomic_dec(&cdt->cdt_remove_count);
+               break;
+       }
+
        /* Drop reference from cdt_request_list. */
        mdt_cdt_put_request(car);
 
index fdc42bc..10c7123 100644 (file)
@@ -156,8 +156,12 @@ struct coordinator {
                                                       * specified */
        __u64                    cdt_max_requests;    /**< max count of started
                                                       * requests */
-       atomic_t                 cdt_request_count;   /**< current count of
-                                                      * started requests */
+       /** Current count of active requests */
+       atomic_t                 cdt_request_count;   /** total */
+       atomic_t                 cdt_archive_count;
+       atomic_t                 cdt_restore_count;
+       atomic_t                 cdt_remove_count;
+
        /* started requests (struct cdt_agent_req:car_cookie_hash)
         * indexed by cookie */
        struct cfs_hash         *cdt_request_cookie_hash;