Whamcloud - gitweb
b=3986
authoralex <alex>
Thu, 29 Jul 2004 09:07:47 +0000 (09:07 +0000)
committeralex <alex>
Thu, 29 Jul 2004 09:07:47 +0000 (09:07 +0000)
r=adilger

- we can't initialize few groups in parallel because
  filter_read_group_internal() reallocates bunch of
  global-per-obd structures. so, here is simple patch
  to serialize it. indeed, this isn's very scalable
  to hundreds of MDSs, but I think it's enough for a
  while. tested on mountain and my home cluster

lustre/include/linux/obd.h
lustre/obdfilter/filter.c

index a1fa34c..ec030ca 100644 (file)
@@ -184,11 +184,12 @@ struct filter_obd {
         struct vfsmount     *fo_vfsmnt;
 
         int                    fo_group_count;
-        struct dentry         *fo_dentry_O; /* the "O"bject directory dentry */
-        struct dentry         **fo_groups;   /* dentries for each group dir */
-        struct filter_subdirs *fo_subdirs;  /* subdir array per group */
-        __u64                 *fo_last_objids; // per-group last created objid
+        struct dentry         *fo_dentry_O;     /* the "O"bject directory dentry */
+        struct dentry         **fo_groups;      /* dentries for each group dir */
+        struct filter_subdirs *fo_subdirs;      /* subdir array per group */
+        __u64                 *fo_last_objids;  /* per-group last created objid */
         struct file          **fo_last_objid_files;
+        struct semaphore     fo_init_lock;      /* group initialization lock */
 
         spinlock_t           fo_objidlock; /* protect fo_lastobjid increment */
         spinlock_t           fo_translock; /* protect fsd_last_rcvd increment */
index 16edf27..78e0eb1 100644 (file)
@@ -733,8 +733,10 @@ static int filter_read_groups(struct obd_device *obd, int last_group,
                               int create)
 {
         struct filter_obd *filter = &obd->u.filter;
-        int old_count = filter->fo_group_count, group = old_count, rc = 0;
+        int old_count, group, rc = 0;
 
+        down(&filter->fo_init_lock);
+        old_count = filter->fo_group_count;
         for (group = old_count; group <= last_group; group++) {
                 if (group == 0)
                         continue; /* no group zero */
@@ -743,6 +745,7 @@ static int filter_read_groups(struct obd_device *obd, int last_group,
                 if (rc != 0)
                         break;
         }
+        up(&filter->fo_init_lock);
         return rc;
 }
 
@@ -1377,11 +1380,11 @@ int filter_common_setup(struct obd_device *obd, obd_count len,
         if (rc)
                 GOTO(err_mntput, rc);
 
+        sema_init(&filter->fo_init_lock, 1);
         rc = filter_prep(obd);
         if (rc)
                 GOTO(err_mntput, rc);
 
-
         filter->fo_destroy_in_progress = 0;
         sema_init(&filter->fo_create_lock, 1);