• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/fs/afs/

Lines Matching refs:vl

36 static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vl,
40 struct afs_cell *cell = vl->cell;
44 _enter("%s,%s", cell->name, vl->vldb.name);
46 down_write(&vl->cell->vl_sem);
54 ret = afs_vl_get_entry_by_name(&addr, key, vl->vldb.name, vldb,
81 up_write(&vl->cell->vl_sem);
90 static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,
96 struct afs_cell *cell = vl->cell;
102 down_write(&vl->cell->vl_sem);
124 vl->upd_busy_cnt++;
125 if (vl->upd_busy_cnt <= 3) {
126 if (vl->upd_busy_cnt > 1) {
136 vl->upd_rej_cnt++;
147 vl->upd_busy_cnt = 0;
151 if (ret < 0 && vl->upd_rej_cnt > 0) {
154 vl->vldb.name);
155 vl->valid = 0;
159 up_write(&vl->cell->vl_sem);
171 struct afs_vlocation *vl;
173 vl = kzalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
174 if (vl) {
175 vl->cell = cell;
176 vl->state = AFS_VL_NEW;
177 atomic_set(&vl->usage, 1);
178 INIT_LIST_HEAD(&vl->link);
179 INIT_LIST_HEAD(&vl->grave);
180 INIT_LIST_HEAD(&vl->update);
181 init_waitqueue_head(&vl->waitq);
182 spin_lock_init(&vl->lock);
183 memcpy(vl->vldb.name, name, namesz);
186 _leave(" = %p", vl);
187 return vl;
193 static int afs_vlocation_update_record(struct afs_vlocation *vl,
203 vl->vldb.name,
204 vl->vldb.vidmask,
205 ntohl(vl->vldb.servers[0].s_addr),
206 vl->vldb.srvtmask[0],
207 ntohl(vl->vldb.servers[1].s_addr),
208 vl->vldb.srvtmask[1],
209 ntohl(vl->vldb.servers[2].s_addr),
210 vl->vldb.srvtmask[2]);
213 vl->vldb.vid[0],
214 vl->vldb.vid[1],
215 vl->vldb.vid[2]);
217 if (vl->vldb.vidmask & AFS_VOL_VTM_RW) {
218 vid = vl->vldb.vid[0];
220 } else if (vl->vldb.vidmask & AFS_VOL_VTM_RO) {
221 vid = vl->vldb.vid[1];
223 } else if (vl->vldb.vidmask & AFS_VOL_VTM_BAK) {
224 vid = vl->vldb.vid[2];
235 ret = afs_vlocation_access_vl_by_id(vl, key, vid, voltype, vldb);
241 vl->vldb.name, vid, vl->cell->name, ret);
254 vl->vldb.name, vid, vl->cell->name);
265 static void afs_vlocation_apply_update(struct afs_vlocation *vl,
277 if (strcmp(vldb->name, vl->vldb.name) != 0)
280 vl->vldb.name, vldb->name);
282 vl->vldb = *vldb;
286 cachefs_update_cookie(vl->cache);
294 static int afs_vlocation_fill_in_record(struct afs_vlocation *vl,
302 ASSERTCMP(vl->valid, ==, 0);
306 /* see if we have an in-cache copy (will set vl->valid if there is) */
311 &vl->cache);
314 if (vl->valid) {
318 ret = afs_vlocation_update_record(vl, key, &vldb);
322 ret = afs_vlocation_access_vl_by_name(vl, key, &vldb);
325 vl->vldb.name, vl->cell->name);
330 afs_vlocation_apply_update(vl, &vldb);
338 void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)
343 vl->update_at = get_seconds() + afs_vlocation_update_timeout;
354 if (vl->update_at <= xvl->update_at)
355 vl->update_at = xvl->update_at + 1;
362 list_add_tail(&vl->update, &afs_vlocation_updates);
378 struct afs_vlocation *vl;
385 if (namesz > sizeof(vl->vldb.name)) {
393 list_for_each_entry(vl, &cell->vl_list, link) {
394 if (vl->vldb.name[namesz] != '\0')
396 if (memcmp(vl->vldb.name, name, namesz) == 0)
402 vl = afs_vlocation_alloc(cell, name, namesz);
403 if (!vl) {
410 list_add_tail(&vl->link, &cell->vl_list);
411 vl->state = AFS_VL_CREATING;
415 ret = afs_vlocation_fill_in_record(vl, key);
418 spin_lock(&vl->lock);
419 vl->state = AFS_VL_VALID;
420 spin_unlock(&vl->lock);
421 wake_up(&vl->waitq);
424 afs_vlocation_queue_for_updates(vl);
430 atomic_inc(&vl->usage);
432 if (!list_empty(&vl->grave)) {
434 list_del_init(&vl->grave);
440 spin_lock(&vl->lock);
441 while (vl->state != AFS_VL_VALID) {
442 afs_vlocation_state_t state = vl->state;
447 vl->state = AFS_VL_CREATING;
448 spin_unlock(&vl->lock);
456 spin_unlock(&vl->lock);
457 ret = wait_event_interruptible(vl->waitq,
458 vl->state == AFS_VL_NEW ||
459 vl->state == AFS_VL_VALID ||
460 vl->state == AFS_VL_NO_VOLUME);
463 spin_lock(&vl->lock);
465 spin_unlock(&vl->lock);
468 _leave(" = %p",vl);
469 return vl;
472 spin_lock(&vl->lock);
473 vl->state = AFS_VL_NEW;
474 spin_unlock(&vl->lock);
475 wake_up(&vl->waitq);
477 ASSERT(vl != NULL);
478 afs_put_vlocation(vl);
486 void afs_put_vlocation(struct afs_vlocation *vl)
488 if (!vl)
491 _enter("%s", vl->vldb.name);
493 ASSERTCMP(atomic_read(&vl->usage), >, 0);
495 if (likely(!atomic_dec_and_test(&vl->usage))) {
501 if (atomic_read(&vl->usage) == 0) {
503 list_move_tail(&vl->grave, &afs_vlocation_graveyard);
504 vl->time_of_death = get_seconds();
509 if (!list_empty(&vl->update)) {
511 list_del_init(&vl->update);
522 static void afs_vlocation_destroy(struct afs_vlocation *vl)
524 _enter("%p", vl);
527 cachefs_relinquish_cookie(vl->cache, 0);
530 afs_put_cell(vl->cell);
531 kfree(vl);
540 struct afs_vlocation *vl;
550 vl = list_entry(afs_vlocation_graveyard.next,
553 _debug("check %p", vl);
556 expiry = vl->time_of_death + afs_vlocation_timeout;
569 spin_lock(&vl->cell->vl_lock);
570 if (atomic_read(&vl->usage) > 0) {
572 list_del_init(&vl->grave);
575 list_move_tail(&vl->grave, &corpses);
576 list_del_init(&vl->link);
578 spin_unlock(&vl->cell->vl_lock);
585 vl = list_entry(corpses.next, struct afs_vlocation, grave);
586 list_del(&vl->grave);
587 afs_vlocation_destroy(vl);
628 struct afs_vlocation *vl, *xvl;
646 vl = list_entry(afs_vlocation_updates.next,
648 if (atomic_read(&vl->usage) > 0)
650 list_del_init(&vl->update);
653 timeout = vl->update_at - now;
662 list_del_init(&vl->update);
663 atomic_inc(&vl->usage);
667 _debug("update %s", vl->vldb.name);
668 vl->state = AFS_VL_UPDATING;
669 vl->upd_rej_cnt = 0;
670 vl->upd_busy_cnt = 0;
672 ret = afs_vlocation_update_record(vl, NULL, &vldb);
673 spin_lock(&vl->lock);
676 afs_vlocation_apply_update(vl, &vldb);
677 vl->state = AFS_VL_VALID;
680 vl->state = AFS_VL_VOLUME_DELETED;
683 vl->state = AFS_VL_UNCERTAIN;
686 spin_unlock(&vl->lock);
687 wake_up(&vl->waitq);
691 vl->update_at = get_seconds() + afs_vlocation_update_timeout;
702 if (vl->update_at <= xvl->update_at)
703 vl->update_at = xvl->update_at + 1;
713 ASSERT(list_empty(&vl->update));
715 list_add_tail(&vl->update, &afs_vlocation_updates);
721 afs_put_vlocation(vl);