Whamcloud - gitweb
minor change for debug msg.
[fs/lustre-release.git] / lustre / mds / commit_confd.c
1
2
3 void commit_add(struct )
4 {
5         struct obd_import *import = commit_uuid2import(rec->  uuid);
6
7         if (!import) {
8                 CERROR("unaware of OST UUID %s - dorpping\n", rec-> uuid);
9                 EXIT;
10                 return;
11         }
12
13         spin_lock(&import->llcconf_lock);
14         list_add(&rec->  &import);
15         spin_unlock(&import->llcconf_lock);
16         EXIT;
17         return;
18 }
19
20 void commit_confd_conf_import(struct obd_import *import,
21                               struct llog_commit_confirm_daemon *lccd)
22 {
23         struct list_head *tmp, *save;
24
25
26         list_for_each_safe(&import->import_cc_list, tmp, save) {
27                 struct llog_canceld_ctxt *cd;
28
29                 if (atomic_read(import->import_cc_count) <=
30                     lccd->llcconf_lowwater)
31                         break;
32
33                 cd = list_entry(tmp, struct llog_canceld_ctxt *, llcconf_entry);
34                 atomic_dec(&import->import_cc_count);
35                 commit_confd_add_and_fire(cd);
36         }
37         EXIT;
38         return;
39 }
40
41
42 int commit_confd_main(void *data)
43 {
44         struct llog_commit_confirm_daemon *lccd = data;
45
46         while (1) {
47                 /* something has happened */
48                 event_wait();
49
50                 if (lccd->flags & LCCD_STOP)
51                         break;
52
53
54                 /* lock llccd imporlist */
55                 spin_lock(&lccd->llcconf_lock);
56                 list_for_each_safe(&lccd->llcconf_list,   ) {
57                         struct obd_import *import;
58                         import = list_entry(&lccd->llcconf_list,
59                                             struct obd_import,
60                                             import_entry);
61                         get_import(import);
62                         spin_unlock(&lccd->llcconf_lock);
63                         if (atomic_read(import->import_cc_count) >
64                             lccd->llcconf_highwater)
65                                 commit_confd_conf_import(import);
66                         put_import(import);
67                         spin_lock(&lccd->llcconf_lock);
68
69                 }
70                 spin_unlock(&lccd->llcconf_lock);
71
72         }
73
74         lccd->flags = LCCD_STOPPED;
75         RETURN(0);
76 }