Changeset 77492 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Feb 28, 2019 1:55:50 AM (6 years ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r77138 r77492 378 378 0, /* uid */ 379 379 (int)grp_vboxsf->gr_gid, /* gid */ 380 0,/* ttl */380 -1, /* ttl */ 381 381 0770, /* dmode, owner and group "vboxsf" have full access */ 382 382 0770, /* fmode, owner and group "vboxsf" have full access */ … … 1473 1473 MntInfo.signature[2] = VBSF_MOUNT_SIGNATURE_BYTE_2; 1474 1474 MntInfo.length = sizeof(MntInfo); 1475 MntInfo.ttl = MntOpts.uid = -1; 1475 1476 MntInfo.uid = MntOpts.uid = 0; 1476 1477 MntInfo.gid = MntOpts.gid = gidMount; -
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77458 r77492 414 414 goto fail0; 415 415 416 /** @todo call host directly and avoid unnecessary copying here. */ 416 417 err = sf_stat(__func__, sf_g, path, &fsinfo, 1); 417 418 if (err) { … … 449 450 } 450 451 452 sf_new_i->path = path; 451 453 SET_INODE_INFO(inode, sf_new_i); 452 sf_init_inode(sf_g, inode, &fsinfo); 453 sf_new_i->path = path; 454 sf_init_inode(inode, sf_new_i, &fsinfo, sf_g); 454 455 455 456 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25) 456 457 unlock_new_inode(inode); 457 458 #endif 458 } 459 460 sf_i->force_restat = 0; 461 dentry->d_time = jiffies; 459 sf_dentry_chain_increase_parent_ttl(dentry); 460 } 461 462 //sf_i->force_restat = 0; /** @todo r=bird: This looks like confusion. */ 463 464 sf_dentry_set_update_jiffies(dentry, jiffies); 462 465 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 463 d_set_d_op(dentry, &sf_dentry_ops);466 Assert(dentry->d_op == &sf_dentry_ops); /* (taken from the superblock) */ 464 467 #else 465 468 dentry->d_op = &sf_dentry_ops; … … 522 525 } 523 526 524 sf_init_inode( sf_g, inode, info);527 sf_init_inode(inode, sf_new_i, info, sf_g); 525 528 526 529 sf_new_i->path = path; … … 528 531 sf_new_i->force_restat = 1; 529 532 sf_new_i->force_reread = 0; 533 sf_new_i->ts_up_to_date = jiffies - INT_MAX / 2; 530 534 #ifdef VBOX_STRICT 531 535 sf_new_i->u32Magic = SF_INODE_INFO_MAGIC; … … 622 626 } 623 627 628 sf_dentry_chain_increase_parent_ttl(dentry); 629 624 630 err = sf_instantiate(parent, dentry, path, &pCreateParms->Info, 625 631 fDirectory ? SHFL_HANDLE_NIL : pCreateParms->Handle); … … 642 648 } 643 649 644 sf_i->force_restat = 1; 650 sf_i->force_restat = 1; /**< @todo r=bird: Why?!? */ 645 651 VbglR0PhysHeapFree(pReq); 646 652 return 0; … … 681 687 #endif 682 688 { 689 /** @todo @a nd (struct nameidata) contains intent with partial open flags for 690 * 2.6.0-3.5.999. In 3.6.0 atomic_open was introduced and stuff 691 * changed (investigate)... */ 683 692 TRACE(); 684 693 return sf_create_aux(parent, dentry, mode, 0 /*fDirectory*/); … … 716 725 int rc, err; 717 726 struct sf_glob_info *sf_g = GET_GLOB_INFO(parent->i_sb); 718 struct sf_inode_info *sf_ i = GET_INODE_INFO(parent);727 struct sf_inode_info *sf_parent_i = GET_INODE_INFO(parent); 719 728 SHFLSTRING *path; 720 729 … … 722 731 BUG_ON(!sf_g); 723 732 724 err = sf_path_from_dentry(__func__, sf_g, sf_ i, dentry, &path);733 err = sf_path_from_dentry(__func__, sf_g, sf_parent_i, dentry, &path); 725 734 if (!err) { 726 735 VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String) … … 733 742 734 743 rc = VbglR0SfHostReqRemove(sf_g->map.root, pReq, fFlags); 744 745 if (dentry->d_inode) { 746 struct sf_inode_info *sf_i = GET_INODE_INFO(dentry->d_inode); 747 sf_i->force_restat = 1; 748 sf_i->force_reread = 1; 749 } 750 735 751 if (RT_SUCCESS(rc)) { 736 752 /* directory access/change time changed */ 737 sf_ i->force_restat = 1;753 sf_parent_i->force_restat = 1; 738 754 /* directory content changed */ 739 sf_ i->force_reread = 1;755 sf_parent_i->force_reread = 1; 740 756 741 757 err = 0; 758 } else if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) { 759 LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc; calling d_drop on %p\n", 760 fDirectory, path->String.utf8, rc, dentry)); 761 d_drop(dentry); 742 762 } else { 743 LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc\n", 744 fDirectory, path->String.utf8, rc)); 763 LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc\n", fDirectory, path->String.utf8, rc)); 745 764 err = -RTErrConvertToErrno(rc); 746 765 } -
trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c
r77139 r77492 387 387 0, /* uid */ 388 388 0, /* gid */ 389 0,/* ttl */389 -1, /* ttl */ 390 390 ~0U, /* dmode */ 391 391 ~0U, /* fmode*/ -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77458 r77492 973 973 struct sf_inode_info *sf_i = GET_INODE_INFO(inode); 974 974 struct sf_reg_info *sf_r; 975 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) 976 struct dentry *dentry = file_dentry(file); 977 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) 978 struct dentry *dentry = file->f_path.dentry; 979 #else 980 struct dentry *dentry = file->f_dentry; 981 #endif 975 982 VBOXSFCREATEREQ *pReq; 976 983 SHFLCREATEPARMS *pCreateParms; /* temp glue */ … … 1082 1089 } 1083 1090 1084 if (pCreateParms->Handle == SHFL_HANDLE_NIL) { 1091 if (pCreateParms->Handle != SHFL_HANDLE_NIL) { 1092 sf_dentry_chain_increase_ttl(dentry); 1093 rc_linux = 0; 1094 } else { 1085 1095 switch (pCreateParms->Result) { 1086 1096 case SHFL_PATH_NOT_FOUND: 1097 rc_linux = -ENOENT; 1098 break; 1087 1099 case SHFL_FILE_NOT_FOUND: 1100 /** @todo sf_dentry_increase_parent_ttl(file->f_dentry); if we can trust it. */ 1088 1101 rc_linux = -ENOENT; 1089 1102 break; 1090 1103 case SHFL_FILE_EXISTS: 1104 sf_dentry_chain_increase_ttl(dentry); 1091 1105 rc_linux = -EEXIST; 1092 1106 break; 1093 1107 default: 1108 sf_dentry_chain_increase_parent_ttl(dentry); 1109 rc_linux = 0; 1094 1110 break; 1095 1111 } 1096 1112 } 1097 1113 1098 sf_i->force_restat = 1; 1114 sf_i->force_restat = 1; /** @todo Why?!? */ 1099 1115 sf_r->Handle.hHost = pCreateParms->Handle; 1100 1116 file->private_data = sf_r; -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r77461 r77492 87 87 88 88 /* set [inode] attributes based on [info], uid/gid based on [sf_g] */ 89 void sf_init_inode(struct sf_glob_info *sf_g, struct inode *inode, 90 PSHFLFSOBJINFO info) 91 { 92 PSHFLFSOBJATTR attr; 89 void sf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct sf_glob_info *sf_g) 90 { 91 PCSHFLFSOBJATTR attr = &info->Attr; 93 92 int mode; 94 93 95 94 TRACE(); 96 95 97 attr = &info->Attr; 96 sf_i->ts_up_to_date = jiffies; 97 sf_i->force_restat = 0; 98 98 99 99 #define mode_set(r) attr->fMode & (RTFS_UNIX_##r) ? (S_##r) : 0; … … 185 185 * Update the inode with new object info from the host. 186 186 */ 187 void sf_update_inode(struct inode *pInode, PSHFLFSOBJINFO pObjInfo, struct sf_glob_info *sf_g)187 void sf_update_inode(struct inode *pInode, struct sf_inode_info *pInfoInfo, PSHFLFSOBJINFO pObjInfo, struct sf_glob_info *sf_g) 188 188 { 189 189 /** @todo make lock/rcu safe. */ 190 sf_init_inode( sf_g, pInode, pObjInfo);190 sf_init_inode(pInode, pInfoInfo, pObjInfo, sf_g); 191 191 } 192 192 … … 256 256 */ 257 257 if ( !sf_i->force_restat 258 && jiffies - dentry->d_time < sf_g->ttl)258 && jiffies - sf_i->ts_up_to_date < sf_g->ttl) 259 259 rc = 0; 260 260 else { … … 274 274 * Reset the TTL and copy the info over into the inode structure. 275 275 */ 276 dentry->d_time = jiffies; 277 sf_update_inode(pInode, &pReq->ObjInfo, sf_g); 276 sf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g); 278 277 } else if (rc == VERR_INVALID_HANDLE) { 279 278 rc = -ENOENT; /* Restore.*/ … … 303 302 * Reset the TTL and copy the info over into the inode structure. 304 303 */ 305 dentry->d_time = jiffies; 306 sf_update_inode(pInode, &pReq->CreateParms.Info, sf_g); 304 sf_update_inode(pInode, sf_i, &pReq->CreateParms.Info, sf_g); 307 305 rc = 0; 308 306 } else { … … 350 348 if ( !fForced 351 349 && !sf_i->force_restat 352 && jiffies - dentry->d_time <sf_g->ttl)350 && jiffies - sf_i->ts_up_to_date <= sf_g->ttl) 353 351 err = 0; 354 352 else { … … 364 362 * Reset the TTL and copy the info over into the inode structure. 365 363 */ 366 dentry->d_time = jiffies; 367 sf_update_inode(pInode, &pReq->ObjInfo, sf_g); 364 sf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g); 368 365 } else { 369 366 LogFunc(("VbglR0SfHostReqQueryObjInfo failed on %#RX64: %Rrc\n", hHostFile, err)); … … 376 373 } 377 374 return err; 378 }379 380 /* this is called during name resolution/lookup to check if the381 [dentry] in the cache is still valid. the job is handled by382 [sf_inode_revalidate] */383 static int384 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)385 sf_dentry_revalidate(struct dentry *dentry, unsigned flags)386 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)387 sf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)388 #else389 sf_dentry_revalidate(struct dentry *dentry, int flags)390 #endif391 {392 TRACE();393 394 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)395 if (flags & LOOKUP_RCU)396 return -ECHILD;397 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)398 /* see Documentation/filesystems/vfs.txt */399 if (nd && nd->flags & LOOKUP_RCU)400 return -ECHILD;401 #endif402 403 if (sf_inode_revalidate(dentry))404 return 0;405 406 return 1;407 375 } 408 376 … … 585 553 * dentry and all its parent entries are valid and could touch their timestamps 586 554 * extending their TTL (CIFS does that). */ 555 sf_i->force_restat = 1; /* temp fix */ 587 556 return sf_inode_revalidate(dentry); 588 557 … … 1001 970 } 1002 971 972 973 /* this is called during name resolution/lookup to check if the 974 [dentry] in the cache is still valid. the job is handled by 975 [sf_inode_revalidate] */ 976 static int 977 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) 978 sf_dentry_revalidate(struct dentry *dentry, unsigned flags) 979 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 980 sf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) 981 #else 982 sf_dentry_revalidate(struct dentry *dentry, int flags) 983 #endif 984 { 985 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) 986 int const flags = nd ? nd->flags : 0; 987 #endif 988 989 int rc; 990 991 Assert(dentry); 992 SFLOGFLOW(("sf_dentry_revalidate: %p %#x %s\n", dentry, flags, dentry->d_inode ? GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>")); 993 994 /* 995 * See Documentation/filesystems/vfs.txt why we skip LOOKUP_RCU. 996 * 997 * Also recommended: https://lwn.net/Articles/649115/ 998 * https://lwn.net/Articles/649729/ 999 * https://lwn.net/Articles/650786/ 1000 * 1001 */ 1002 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 1003 if (flags & LOOKUP_RCU) { 1004 rc = -ECHILD; 1005 SFLOGFLOW(("sf_dentry_revalidate: RCU -> -ECHILD\n")); 1006 } else 1007 #endif 1008 { 1009 /* 1010 * Do we have an inode or not? If not it's probably a negative cache 1011 * entry, otherwise most likely a positive one. 1012 */ 1013 struct inode *pInode = dentry->d_inode; 1014 if (pInode) { 1015 /* 1016 * Positive entry. 1017 * 1018 * Note! We're more aggressive here than other remote file systems, 1019 * current (4.19) CIFS will for instance revalidate the inode 1020 * and ignore the dentry timestamp for positive entries. 1021 */ 1022 //struct sf_inode_info *sf_i = GET_INODE_INFO(pInode); 1023 unsigned long const cJiffiesAge = sf_dentry_get_update_jiffies(dentry) - jiffies; 1024 struct sf_glob_info *sf_g = GET_GLOB_INFO(dentry->d_sb); 1025 if (cJiffiesAge <= sf_g->ttl) { 1026 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl)); 1027 rc = 1; 1028 } else if (!sf_inode_revalidate(dentry /** @todo force */)) { 1029 sf_dentry_set_update_jiffies(dentry, jiffies); /** @todo get jiffies from inode. */ 1030 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 1\n", cJiffiesAge, sf_g->ttl)); 1031 rc = 1; 1032 } else { 1033 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 0\n", cJiffiesAge, sf_g->ttl)); 1034 rc = 0; 1035 } 1036 } else { 1037 /* 1038 * Negative entry. 1039 * 1040 * Invalidate dentries for open and renames here as we'll revalidate 1041 * these when taking the actual action (also good for case preservation 1042 * if we do case-insensitive mounts against windows + mac hosts at some 1043 * later point). 1044 */ 1045 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) 1046 if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 1047 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 75) 1048 if (flags & LOOKUP_CREATE) 1049 #else 1050 if (0) 1051 #endif 1052 { 1053 SFLOGFLOW(("sf_dentry_revalidate: negative: create or rename target -> 0\n")); 1054 rc = 0; 1055 } else { 1056 /* Can we skip revalidation based on TTL? */ 1057 unsigned long const cJiffiesAge = sf_dentry_get_update_jiffies(dentry) - jiffies; 1058 struct sf_glob_info *sf_g = GET_GLOB_INFO(dentry->d_sb); 1059 if (cJiffiesAge < sf_g->ttl) { 1060 SFLOGFLOW(("sf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl)); 1061 rc = 1; 1062 } else { 1063 /* We could revalidate it here, but we could instead just 1064 have the caller kick it out. */ 1065 /** @todo stat the direntry and see if it exists now. */ 1066 SFLOGFLOW(("sf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 0\n", cJiffiesAge, sf_g->ttl)); 1067 rc = 0; 1068 } 1069 } 1070 } 1071 } 1072 return rc; 1073 } 1074 1075 #ifdef SFLOG_ENABLED 1076 1077 /** For logging purposes only. */ 1078 static int sf_dentry_delete(const struct dentry *pDirEntry) 1079 { 1080 SFLOGFLOW(("sf_dentry_delete: %p\n", pDirEntry)); 1081 return 0; 1082 } 1083 1084 static int sf_dentry_init(struct dentry *pDirEntry) 1085 { 1086 SFLOGFLOW(("sf_dentry_init: %p\n", pDirEntry)); 1087 return 0; 1088 } 1089 1090 #endif /* SFLOG_ENABLED */ 1091 1092 1003 1093 struct dentry_operations sf_dentry_ops = { 1004 .d_revalidate = sf_dentry_revalidate 1094 .d_revalidate = sf_dentry_revalidate, 1095 #ifdef SFLOG_ENABLED 1096 .d_delete = sf_dentry_delete, 1097 .d_init = sf_dentry_init, 1098 #endif 1005 1099 }; 1006 1100 -
trunk/src/VBox/Additions/linux/sharedfolders/vbsfmount.h
r77138 r77492 38 38 #define MAX_HOST_NAME 256 39 39 #define MAX_NLS_NAME 32 40 #define VBSF_DEFAULT_TTL_MS 200 40 41 41 42 #define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377' … … 58 59 int uid; /**< user ID for all entries, default 0=root */ 59 60 int gid; /**< group ID for all entries, default 0=root */ 60 int ttl; /**< time to live */ 61 int ttl; /**< directory entry and inode time to live in milliseconds. 62 * -1 for kernel default, 0 to disable caching. */ 61 63 int dmode; /**< mode for directories if != 0xffffffff */ 62 64 int fmode; /**< mode for regular files if != 0xffffffff */ -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77458 r77492 75 75 static void sf_glob_copy_remount_options(struct sf_glob_info *sf_g, struct vbsf_mount_info_new *info) 76 76 { 77 sf_g->ttl = info->ttl; 77 sf_g->ttl_msec = info->ttl; 78 if (info->ttl > 0) 79 sf_g->ttl = msecs_to_jiffies(info->ttl); 80 else if (info->ttl == 0 || info->ttl != -1) 81 sf_g->ttl = sf_g->ttl_msec = 0; 82 else 83 sf_g->ttl = msecs_to_jiffies(VBSF_DEFAULT_TTL_MS); 84 78 85 sf_g->uid = info->uid; 79 86 sf_g->gid = info->gid; … … 310 317 sb->s_blocksize = 1024; 311 318 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 3) 312 /* Required for seek/sendfile. 313 * 314 * Must by less than or equal to INT64_MAX despite the fact that the 315 * declaration of this variable is unsigned long long. See determination 316 * of 'loff_t max' in fs/read_write.c / do_sendfile(). I don't know the 317 * correct limit but MAX_LFS_FILESIZE (8TB-1 on 32-bit boxes) takes the 318 * page cache into account and is the suggested limit. */ 319 /* Required for seek/sendfile (see 'loff_t max' in fs/read_write.c / do_sendfile()). */ 319 320 # if defined MAX_LFS_FILESIZE 320 321 sb->s_maxbytes = MAX_LFS_FILESIZE; 322 # elif BITS_PER_LONG == 32 323 sb->s_maxbytes = (loff_t)ULONG_MAX << PAGE_SHIFT; 321 324 # else 322 sb->s_maxbytes = 0x7fffffffffffffffULL;325 sb->s_maxbytes = INT64_MAX; 323 326 # endif 324 327 #endif 325 328 sb->s_op = &sf_super_ops; 329 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 330 sb->s_d_op = &sf_dentry_ops; 331 #endif 326 332 327 333 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25) … … 345 351 } 346 352 347 sf_init_inode( sf_g, iroot, &fsinfo);353 sf_init_inode(iroot, sf_i, &fsinfo, sf_g); 348 354 SET_INODE_INFO(iroot, sf_i); 349 355 … … 519 525 err = sf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0); 520 526 BUG_ON(err != 0); 521 sf_init_inode( sf_g, iroot, &fsinfo);527 sf_init_inode(iroot, sf_i, &fsinfo, sf_g); 522 528 /*unlock_new_inode(iroot); */ 523 529 return 0; … … 541 547 struct sf_glob_info *sf_g = GET_GLOB_INFO(sb); 542 548 if (sf_g) { 543 seq_printf(m, ",uid=%u,gid=%u,ttl=% u,dmode=0%o,fmode=0%o,dmask=0%o,fmask=0%o,maxiopages=%u",544 sf_g->uid, sf_g->gid, sf_g->ttl , sf_g->dmode, sf_g->fmode, sf_g->dmask,549 seq_printf(m, ",uid=%u,gid=%u,ttl=%d,dmode=0%o,fmode=0%o,dmask=0%o,fmask=0%o,maxiopages=%u", 550 sf_g->uid, sf_g->gid, sf_g->ttl_msec, sf_g->dmode, sf_g->fmode, sf_g->dmask, 545 551 sf_g->fmask, sf_g->cMaxIoPages); 546 552 if (sf_g->tag[0] != '\0') { -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77458 r77492 60 60 VBGLSFMAP map; 61 61 struct nls_table *nls; 62 int ttl; 62 /** time-to-live value for direntry and inode info in jiffies. 63 * Zero == disabled. */ 64 unsigned long ttl; 65 /** The mount option value for /proc/mounts. */ 66 int ttl_msec; 63 67 int uid; 64 68 int gid; … … 120 124 /** directory content changed, update the whole directory on next sf_getdent */ 121 125 int force_reread; 126 /** The timestamp (jiffies) where the inode info was last updated. */ 127 unsigned long ts_up_to_date; 122 128 123 129 /** handle valid if a file was created with sf_create_aux until it will … … 149 155 150 156 /** 151 * VBox specific infor forea regular file.157 * VBox specific information for a regular file. 152 158 */ 153 159 struct sf_reg_info { … … 155 161 struct sf_handle Handle; 156 162 }; 163 164 /** 165 * Sets the update-jiffies value for a dentry. 166 * 167 * This is used together with sf_glob_info::ttl to reduce re-validation of 168 * dentry structures while walking. 169 * 170 * This used to be living in d_time, but since 4.9.0 that seems to have become 171 * unfashionable and d_fsdata is now used to for this purpose. We do this all 172 * the way back, since d_time seems only to have been used by the file system 173 * specific code (at least going back to 2.4.0). 174 */ 175 DECLINLINE(void) sf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet) 176 { 177 pDirEntry->d_fsdata = (void *)uToSet; 178 } 179 180 /** 181 * Get the update-jiffies value for a dentry. 182 */ 183 DECLINLINE(unsigned long) sf_dentry_get_update_jiffies(struct dentry *pDirEntry) 184 { 185 return (unsigned long)pDirEntry->d_fsdata; 186 } 187 188 /** 189 * Increase the time-to-live of @a pDirEntry and all ancestors. 190 * @param pDirEntry The directory entry cache entry which ancestors 191 * we should increase the TTL for. 192 */ 193 DECLINLINE(void) sf_dentry_chain_increase_ttl(struct dentry *pDirEntry) 194 { 195 #ifdef VBOX_STRICT 196 struct super_block * const pSuper = pDirEntry->d_sb; 197 #endif 198 unsigned long const uToSet = jiffies; 199 do { 200 Assert(pDirEntry->d_sb == pSuper); 201 sf_dentry_set_update_jiffies(pDirEntry, uToSet); 202 pDirEntry = pDirEntry->d_parent; 203 } while (!IS_ROOT(pDirEntry)); 204 } 205 206 /** 207 * Increase the time-to-live of all ancestors. 208 * @param pDirEntry The directory entry cache entry which ancestors 209 * we should increase the TTL for. 210 */ 211 DECLINLINE(void) sf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry) 212 { 213 Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb); 214 pDirEntry = pDirEntry->d_parent; 215 if (pDirEntry) 216 sf_dentry_chain_increase_ttl(pDirEntry); 217 } 218 157 219 158 220 /* globals */ … … 199 261 } 200 262 201 extern void sf_init_inode(struct sf_glob_info *sf_g, struct inode *inode, 202 PSHFLFSOBJINFO info); 263 extern void sf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct sf_glob_info *sf_g); 203 264 extern int sf_stat(const char *caller, struct sf_glob_info *sf_g, 204 265 SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail); … … 246 307 # define TRACE() LogFunc(("tracepoint\n")) 247 308 # define SFLOGFLOW(aArgs) Log(aArgs) 309 # ifdef LOG_ENABLED 310 # define SFLOG_ENABLED 1 311 # endif 248 312 #else 249 313 # define TRACE() RTLogBackdoorPrintf("%s: tracepoint\n", __FUNCTION__) 250 314 # define SFLOGFLOW(aArgs) RTLogBackdoorPrintf aArgs 315 # define SFLOG_ENABLED 1 251 316 #endif 252 317
Note:
See TracChangeset
for help on using the changeset viewer.