Whamcloud - gitweb
LU-7038 obdclass: lu_site_purge() to handle purge-all 05/18505/2
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Thu, 18 Feb 2016 20:14:09 +0000 (23:14 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 13 Mar 2016 06:25:40 +0000 (06:25 +0000)
if the callers wants to purge all objects, then scanning
should start from the first bucket.

Change-Id: I9f75ff0bd10e1d501e7c790b03ef6a73819a96d1
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/18505
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/lu_object.c

index c478d51..6c82855 100644 (file)
@@ -357,7 +357,7 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr)
        struct cfs_hash_bd            bd2;
        struct list_head         dispose;
        int                      did_sth;
        struct cfs_hash_bd            bd2;
        struct list_head         dispose;
        int                      did_sth;
-       unsigned int             start;
+       unsigned int             start = 0;
         int                      count;
         int                      bnr;
        unsigned int             i;
         int                      count;
         int                      bnr;
        unsigned int             i;
@@ -370,7 +370,8 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr)
          * Under LRU list lock, scan LRU list and move unreferenced objects to
          * the dispose list, removing them from LRU and hash table.
          */
          * Under LRU list lock, scan LRU list and move unreferenced objects to
          * the dispose list, removing them from LRU and hash table.
          */
-        start = s->ls_purge_start;
+       if (nr != ~0)
+               start = s->ls_purge_start;
        bnr = (nr == ~0) ? -1 : nr / (int)CFS_HASH_NBKT(s->ls_obj_hash) + 1;
  again:
        /*
        bnr = (nr == ~0) ? -1 : nr / (int)CFS_HASH_NBKT(s->ls_obj_hash) + 1;
  again:
        /*