[PATCH] [yeeloong] held proper mountroot waits

Vladimir 'φ-coder/phcoder' Serbinenko phcoder at gmail.com
Mon Sep 27 11:06:57 UTC 2010


On 09/27/2010 08:59 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Hello. Here the yeeloong patches split into small pieces for easier
> review and merge.
> First patch is to held mountroot wait during usb probing. I believe this
> issue isn't yeeloong-specific but became apparent on it because of
> either different speed ratios between varios hardware components or
> because when I first came up with it I was testing without cache at all. 
>
>   
Resending the attachment with .txt added

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

-------------- next part --------------
=== modified file 'cam/cam_xpt.c'
--- cam/cam_xpt.c	2010-08-13 22:16:49 +0000
+++ cam/cam_xpt.c	2010-08-13 22:20:49 +0000
@@ -816,6 +816,9 @@
 	return 0;
 }
 
+static struct root_hold_token *xpt_rool_hold = NULL;
+static int rescan_counter = 0;
+
 static void
 xpt_rescan_done(struct cam_periph *periph, union ccb *done_ccb)
 {
@@ -828,6 +831,11 @@
 		(*done_ccb->ccb_h.cbfcnp)(periph, done_ccb);
 	}
 	xpt_release_boot();
+	if (atomic_fetchadd_int (&rescan_counter, -1) == 1)
+	{
+		root_mount_rel (xpt_rool_hold);
+		xpt_rool_hold = NULL;
+	}
 }
 
 /* thread to handle bus rescans */
@@ -861,6 +869,11 @@
 {
 	struct ccb_hdr *hdr;
 
+	if (atomic_fetchadd_int (&rescan_counter, 1) == 0)
+	{
+		xpt_rool_hold = root_mount_hold("XPT bus rescan");
+	}
+
 	/* Prepare request */
 	if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD &&
 	    ccb->ccb_h.path->device->lun_id == CAM_LUN_WILDCARD)


More information about the freebsd-mips mailing list