Lines Matching refs:vnode

35 static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key)  in afs_inode_init_from_status()  argument
37 struct inode *inode = AFS_VNODE_TO_I(vnode); in afs_inode_init_from_status()
40 vnode->status.type, in afs_inode_init_from_status()
41 vnode->status.nlink, in afs_inode_init_from_status()
42 (unsigned long long) vnode->status.size, in afs_inode_init_from_status()
43 vnode->status.data_version, in afs_inode_init_from_status()
44 vnode->status.mode); in afs_inode_init_from_status()
46 read_seqlock_excl(&vnode->cb_lock); in afs_inode_init_from_status()
48 afs_update_inode_from_status(vnode, &vnode->status, NULL, in afs_inode_init_from_status()
51 switch (vnode->status.type) { in afs_inode_init_from_status()
53 inode->i_mode = S_IFREG | vnode->status.mode; in afs_inode_init_from_status()
59 inode->i_mode = S_IFDIR | vnode->status.mode; in afs_inode_init_from_status()
66 if ((vnode->status.mode & 0777) == 0644) { in afs_inode_init_from_status()
69 set_bit(AFS_VNODE_MOUNTPOINT, &vnode->flags); in afs_inode_init_from_status()
76 inode->i_mode = S_IFLNK | vnode->status.mode; in afs_inode_init_from_status()
84 read_sequnlock_excl(&vnode->cb_lock); in afs_inode_init_from_status()
89 vnode->invalid_before = vnode->status.data_version; in afs_inode_init_from_status()
91 read_sequnlock_excl(&vnode->cb_lock); in afs_inode_init_from_status()
98 int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode) in afs_fetch_status() argument
104 vnode->volume->name, in afs_fetch_status()
105 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique, in afs_fetch_status()
106 vnode->flags); in afs_fetch_status()
109 if (afs_begin_vnode_operation(&fc, vnode, key)) { in afs_fetch_status()
111 fc.cb_break = afs_calc_vnode_cb_break(vnode); in afs_fetch_status()
115 afs_check_for_remote_deletion(&fc, fc.vnode); in afs_fetch_status()
116 afs_vnode_commit_status(&fc, vnode, fc.cb_break); in afs_fetch_status()
131 return inode->i_ino == data->fid.vnode && in afs_iget5_test()
151 struct afs_vnode *vnode = AFS_FS_I(inode); in afs_iget5_set() local
153 inode->i_ino = data->fid.vnode; in afs_iget5_set()
155 vnode->fid = data->fid; in afs_iget5_set()
156 vnode->volume = data->volume; in afs_iget5_set()
169 struct afs_vnode *vnode; in afs_iget_pseudo_dir() local
181 data.fid.vnode = 1; in afs_iget_pseudo_dir()
184 data.fid.vnode = atomic_inc_return(&afs_autocell_ino); in afs_iget_pseudo_dir()
188 inode = iget5_locked(sb, data.fid.vnode, in afs_iget_pseudo_dir()
197 inode, inode->i_ino, data.fid.vid, data.fid.vnode, in afs_iget_pseudo_dir()
200 vnode = AFS_FS_I(inode); in afs_iget_pseudo_dir()
223 set_bit(AFS_VNODE_PSEUDODIR, &vnode->flags); in afs_iget_pseudo_dir()
225 set_bit(AFS_VNODE_MOUNTPOINT, &vnode->flags); in afs_iget_pseudo_dir()
238 static void afs_get_inode_cache(struct afs_vnode *vnode) in afs_get_inode_cache() argument
248 if (vnode->status.type == AFS_FTYPE_DIR) { in afs_get_inode_cache()
249 vnode->cache = NULL; in afs_get_inode_cache()
253 key.vnode_id = vnode->fid.vnode; in afs_get_inode_cache()
254 key.unique = vnode->fid.unique; in afs_get_inode_cache()
257 aux.data_version = vnode->status.data_version; in afs_get_inode_cache()
259 vnode->cache = fscache_acquire_cookie(vnode->volume->cache, in afs_get_inode_cache()
263 vnode, vnode->status.size, true); in afs_get_inode_cache()
276 struct afs_vnode *vnode; in afs_iget() local
280 _enter(",{%x:%u.%u},,", fid->vid, fid->vnode, fid->unique); in afs_iget()
285 inode = iget5_locked(sb, fid->vnode, afs_iget5_test, afs_iget5_set, in afs_iget()
293 inode, fid->vid, fid->vnode, fid->unique); in afs_iget()
295 vnode = AFS_FS_I(inode); in afs_iget()
305 ret = afs_fetch_status(vnode, key, true); in afs_iget()
310 memcpy(&vnode->status, status, sizeof(vnode->status)); in afs_iget()
315 vnode->cb_version = 0; in afs_iget()
316 vnode->cb_type = 0; in afs_iget()
317 vnode->cb_expires_at = 0; in afs_iget()
319 vnode->cb_version = cb->version; in afs_iget()
320 vnode->cb_type = cb->type; in afs_iget()
321 vnode->cb_expires_at = cb->expiry; in afs_iget()
322 vnode->cb_interest = afs_get_cb_interest(cbi); in afs_iget()
323 set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); in afs_iget()
326 vnode->cb_expires_at += ktime_get_real_seconds(); in afs_iget()
329 ret = afs_inode_init_from_status(vnode, key); in afs_iget()
333 afs_get_inode_cache(vnode); in afs_iget()
336 clear_bit(AFS_VNODE_UNSET, &vnode->flags); in afs_iget()
339 _leave(" = %p [CB { v=%u t=%u }]", inode, vnode->cb_version, vnode->cb_type); in afs_iget()
353 void afs_zap_data(struct afs_vnode *vnode) in afs_zap_data() argument
355 _enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode); in afs_zap_data()
358 fscache_invalidate(vnode->cache); in afs_zap_data()
364 if (S_ISREG(vnode->vfs_inode.i_mode)) in afs_zap_data()
365 invalidate_remote_inode(&vnode->vfs_inode); in afs_zap_data()
367 invalidate_inode_pages2(vnode->vfs_inode.i_mapping); in afs_zap_data()
379 int afs_validate(struct afs_vnode *vnode, struct key *key) in afs_validate() argument
386 vnode->fid.vid, vnode->fid.vnode, vnode->flags, in afs_validate()
393 read_seqlock_excl(&vnode->cb_lock); in afs_validate()
395 if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { in afs_validate()
396 if (vnode->cb_s_break != vnode->cb_interest->server->cb_s_break || in afs_validate()
397 vnode->cb_v_break != vnode->volume->cb_v_break) { in afs_validate()
398 vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; in afs_validate()
399 vnode->cb_v_break = vnode->volume->cb_v_break; in afs_validate()
401 } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { in afs_validate()
403 } else if (vnode->cb_expires_at - 10 <= now) { in afs_validate()
408 } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { in afs_validate()
411 vnode->cb_v_break = vnode->volume->cb_v_break; in afs_validate()
415 read_sequnlock_excl(&vnode->cb_lock); in afs_validate()
417 if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) in afs_validate()
418 clear_nlink(&vnode->vfs_inode); in afs_validate()
423 down_write(&vnode->validate_lock); in afs_validate()
429 if (!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { in afs_validate()
431 ret = afs_fetch_status(vnode, key, false); in afs_validate()
434 set_bit(AFS_VNODE_DELETED, &vnode->flags); in afs_validate()
439 _debug("new promise [fl=%lx]", vnode->flags); in afs_validate()
442 if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { in afs_validate()
450 if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) in afs_validate()
451 afs_zap_data(vnode); in afs_validate()
452 up_write(&vnode->validate_lock); in afs_validate()
458 up_write(&vnode->validate_lock); in afs_validate()
470 struct afs_vnode *vnode = AFS_FS_I(inode); in afs_getattr() local
476 if (vnode->volume && in afs_getattr()
478 !test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { in afs_getattr()
479 key = afs_request_key(vnode->volume->cell); in afs_getattr()
482 ret = afs_validate(vnode, key); in afs_getattr()
489 read_seqbegin_or_lock(&vnode->cb_lock, &seq); in afs_getattr()
491 } while (need_seqretry(&vnode->cb_lock, seq)); in afs_getattr()
493 done_seqretry(&vnode->cb_lock, seq); in afs_getattr()
515 struct afs_vnode *vnode; in afs_evict_inode() local
517 vnode = AFS_FS_I(inode); in afs_evict_inode()
520 vnode->fid.vid, in afs_evict_inode()
521 vnode->fid.vnode, in afs_evict_inode()
522 vnode->fid.unique); in afs_evict_inode()
526 ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode); in afs_evict_inode()
531 if (vnode->cb_interest) { in afs_evict_inode()
532 afs_put_cb_interest(afs_i2net(inode), vnode->cb_interest); in afs_evict_inode()
533 vnode->cb_interest = NULL; in afs_evict_inode()
536 while (!list_empty(&vnode->wb_keys)) { in afs_evict_inode()
537 struct afs_wb_key *wbk = list_entry(vnode->wb_keys.next, in afs_evict_inode()
547 aux.data_version = vnode->status.data_version; in afs_evict_inode()
548 fscache_relinquish_cookie(vnode->cache, &aux, in afs_evict_inode()
549 test_bit(AFS_VNODE_DELETED, &vnode->flags)); in afs_evict_inode()
550 vnode->cache = NULL; in afs_evict_inode()
554 afs_prune_wb_keys(vnode); in afs_evict_inode()
555 afs_put_permits(rcu_access_pointer(vnode->permit_cache)); in afs_evict_inode()
556 key_put(vnode->lock_key); in afs_evict_inode()
557 vnode->lock_key = NULL; in afs_evict_inode()
567 struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); in afs_setattr() local
572 vnode->fid.vid, vnode->fid.vnode, dentry, in afs_setattr()
582 if (S_ISREG(vnode->vfs_inode.i_mode)) in afs_setattr()
583 filemap_write_and_wait(vnode->vfs_inode.i_mapping); in afs_setattr()
588 key = afs_request_key(vnode->volume->cell); in afs_setattr()
596 if (afs_begin_vnode_operation(&fc, vnode, key)) { in afs_setattr()
598 fc.cb_break = afs_calc_vnode_cb_break(vnode); in afs_setattr()
602 afs_check_for_remote_deletion(&fc, fc.vnode); in afs_setattr()
603 afs_vnode_commit_status(&fc, vnode, fc.cb_break); in afs_setattr()