Author: mjg
Date: Tue Aug  4 19:55:26 2020
New Revision: 363859
URL: https://svnweb.freebsd.org/changeset/base/363859

Log:
  cache: factor away failed vexec handling

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c   Tue Aug  4 19:55:00 2020        (r363858)
+++ head/sys/kern/vfs_cache.c   Tue Aug  4 19:55:26 2020        (r363859)
@@ -3668,6 +3668,33 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl)
        }
 }
 
+static int __noinline
+cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error)
+{
+
+       switch (error) {
+       case EAGAIN:
+               /*
+                * Can happen when racing against vgone.
+                * */
+       case EOPNOTSUPP:
+               cache_fpl_partial(fpl);
+               break;
+       default:
+               /*
+                * See the API contract for VOP_FPLOOKUP_VEXEC.
+                */
+               if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) {
+                       error = cache_fpl_aborted(fpl);
+               } else {
+                       cache_fpl_smr_exit(fpl);
+                       cache_fpl_handled(fpl, error);
+               }
+               break;
+       }
+       return (error);
+}
+
 static int
 cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl)
 {
@@ -3715,23 +3742,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp
 
                error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred, 
cnp->cn_thread);
                if (__predict_false(error != 0)) {
-                       switch (error) {
-                       case EAGAIN:
-                       case EOPNOTSUPP: /* can happen when racing against 
vgone */
-                               cache_fpl_partial(fpl);
-                               break;
-                       default:
-                               /*
-                                * See the API contract for VOP_FPLOOKUP_VEXEC.
-                                */
-                               if (!vn_seqc_consistent(fpl->dvp, 
fpl->dvp_seqc)) {
-                                       error = cache_fpl_aborted(fpl);
-                               } else {
-                                       cache_fpl_smr_exit(fpl);
-                                       cache_fpl_handled(fpl, error);
-                               }
-                               break;
-                       }
+                       error = cache_fplookup_failed_vexec(fpl, error);
                        break;
                }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to