@@ -253,9 +253,12 @@ void v9fs_set_netfs_context(struct inode *inode)
253253}
254254
255255int v9fs_init_inode (struct v9fs_session_info * v9ses ,
256- struct inode * inode , umode_t mode , dev_t rdev )
256+ struct inode * inode , struct p9_qid * qid , umode_t mode , dev_t rdev )
257257{
258258 int err = 0 ;
259+ struct v9fs_inode * v9inode = V9FS_I (inode );
260+
261+ memcpy (& v9inode -> qid , qid , sizeof (struct p9_qid ));
259262
260263 inode_init_owner (& nop_mnt_idmap , inode , NULL , mode );
261264 inode -> i_blocks = 0 ;
@@ -354,80 +357,40 @@ void v9fs_evict_inode(struct inode *inode)
354357#endif
355358}
356359
357- static int v9fs_test_inode (struct inode * inode , void * data )
358- {
359- int umode ;
360- dev_t rdev ;
361- struct v9fs_inode * v9inode = V9FS_I (inode );
362- struct p9_wstat * st = (struct p9_wstat * )data ;
363- struct v9fs_session_info * v9ses = v9fs_inode2v9ses (inode );
364-
365- umode = p9mode2unixmode (v9ses , st , & rdev );
366- /* don't match inode of different type */
367- if (inode_wrong_type (inode , umode ))
368- return 0 ;
369-
370- /* compare qid details */
371- if (memcmp (& v9inode -> qid .version ,
372- & st -> qid .version , sizeof (v9inode -> qid .version )))
373- return 0 ;
374-
375- if (v9inode -> qid .type != st -> qid .type )
376- return 0 ;
377-
378- if (v9inode -> qid .path != st -> qid .path )
379- return 0 ;
380- return 1 ;
381- }
382-
383- static int v9fs_test_new_inode (struct inode * inode , void * data )
384- {
385- return 0 ;
386- }
387-
388- static int v9fs_set_inode (struct inode * inode , void * data )
389- {
390- struct v9fs_inode * v9inode = V9FS_I (inode );
391- struct p9_wstat * st = (struct p9_wstat * )data ;
392-
393- memcpy (& v9inode -> qid , & st -> qid , sizeof (st -> qid ));
394- return 0 ;
395- }
396-
397- static struct inode * v9fs_qid_iget (struct super_block * sb ,
398- struct p9_qid * qid ,
399- struct p9_wstat * st ,
400- int new )
360+ struct inode * v9fs_fid_iget (struct super_block * sb , struct p9_fid * fid )
401361{
402362 dev_t rdev ;
403363 int retval ;
404364 umode_t umode ;
405365 struct inode * inode ;
366+ struct p9_wstat * st ;
406367 struct v9fs_session_info * v9ses = sb -> s_fs_info ;
407- int (* test )(struct inode * inode , void * data );
408-
409- if (new )
410- test = v9fs_test_new_inode ;
411- else
412- test = v9fs_test_inode ;
413368
414- inode = iget5_locked (sb , QID2INO (qid ), test , v9fs_set_inode , st );
415- if (!inode )
369+ inode = iget_locked (sb , QID2INO (& fid -> qid ));
370+ if (unlikely ( !inode ) )
416371 return ERR_PTR (- ENOMEM );
417372 if (!(inode -> i_state & I_NEW ))
418373 return inode ;
374+
419375 /*
420376 * initialize the inode with the stat info
421377 * FIXME!! we may need support for stale inodes
422378 * later.
423379 */
424- inode -> i_ino = QID2INO (qid );
380+ st = p9_client_stat (fid );
381+ if (IS_ERR (st )) {
382+ retval = PTR_ERR (st );
383+ goto error ;
384+ }
385+
425386 umode = p9mode2unixmode (v9ses , st , & rdev );
426- retval = v9fs_init_inode (v9ses , inode , umode , rdev );
387+ retval = v9fs_init_inode (v9ses , inode , & fid -> qid , umode , rdev );
388+ v9fs_stat2inode (st , inode , sb , 0 );
389+ p9stat_free (st );
390+ kfree (st );
427391 if (retval )
428392 goto error ;
429393
430- v9fs_stat2inode (st , inode , sb , 0 );
431394 v9fs_set_netfs_context (inode );
432395 v9fs_cache_inode_get_cookie (inode );
433396 unlock_new_inode (inode );
@@ -438,23 +401,6 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
438401
439402}
440403
441- struct inode *
442- v9fs_inode_from_fid (struct v9fs_session_info * v9ses , struct p9_fid * fid ,
443- struct super_block * sb , int new )
444- {
445- struct p9_wstat * st ;
446- struct inode * inode = NULL ;
447-
448- st = p9_client_stat (fid );
449- if (IS_ERR (st ))
450- return ERR_CAST (st );
451-
452- inode = v9fs_qid_iget (sb , & st -> qid , st , new );
453- p9stat_free (st );
454- kfree (st );
455- return inode ;
456- }
457-
458404/**
459405 * v9fs_at_to_dotl_flags- convert Linux specific AT flags to
460406 * plan 9 AT flag.
@@ -601,7 +547,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
601547 /*
602548 * instantiate inode and assign the unopened fid to the dentry
603549 */
604- inode = v9fs_get_new_inode_from_fid (v9ses , fid , dir -> i_sb );
550+ inode = v9fs_get_inode_from_fid (v9ses , fid , dir -> i_sb );
605551 if (IS_ERR (inode )) {
606552 err = PTR_ERR (inode );
607553 p9_debug (P9_DEBUG_VFS ,
@@ -729,10 +675,8 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
729675 inode = NULL ;
730676 else if (IS_ERR (fid ))
731677 inode = ERR_CAST (fid );
732- else if (v9ses -> cache & (CACHE_META |CACHE_LOOSE ))
733- inode = v9fs_get_inode_from_fid (v9ses , fid , dir -> i_sb );
734678 else
735- inode = v9fs_get_new_inode_from_fid (v9ses , fid , dir -> i_sb );
679+ inode = v9fs_get_inode_from_fid (v9ses , fid , dir -> i_sb );
736680 /*
737681 * If we had a rename on the server and a parallel lookup
738682 * for the new name, then make sure we instantiate with
0 commit comments