From owner-freebsd-geom@FreeBSD.ORG Thu Aug 2 18:31:21 2012 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A16DC106564A for ; Thu, 2 Aug 2012 18:31:21 +0000 (UTC) (envelope-from jim.harris@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 333618FC08 for ; Thu, 2 Aug 2012 18:31:20 +0000 (UTC) Received: by weyx56 with SMTP id x56so7460505wey.13 for ; Thu, 02 Aug 2012 11:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=k9SfNxHIv4GwKMh6AjXmI+JlqqYp9uYm7foFbSLoaK0=; b=FUb9zWPj4Daq3PX+uZzdcapnJdTK1Nd/zYRO81LuC8VnK3XWTy7RDyrVlefaoDbtdJ +s4hLjn4W3fN11sHYWSDLjKhoBQUyYN//Qe2BcXDvQIPb8n63+2S9jFYMf1U+jO8B3ga FbmxDo09Z7PaIvAQ9uiqDnSCtX2YJ007lpQZkrj2CsdZ926jsWcPq9ugiamCap8oUtdc KJKjtSnwiJIbz+fQaDdPdd8Xo9KZKqXXXUi3OX3Ac3jpDJcgGiFaxQvaty7eseEIOKRx GQapQiBKR9CjM5VDUVMhRuUphjOe0XH6nK5+iu+ZBzkh8C26cqJQPgdOslNJk9M+wEjP +Qrg== MIME-Version: 1.0 Received: by 10.180.75.209 with SMTP id e17mr7907394wiw.0.1343932280005; Thu, 02 Aug 2012 11:31:20 -0700 (PDT) Sender: jim.harris@gmail.com Received: by 10.216.241.203 with HTTP; Thu, 2 Aug 2012 11:31:19 -0700 (PDT) In-Reply-To: References: Date: Thu, 2 Aug 2012 11:31:19 -0700 X-Google-Sender-Auth: Owk8kPzdN-L0bfduX3dWDJ8z77w Message-ID: From: Jim Harris To: freebsd-geom@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: bio_flags (BIO_ORDERED) and g_clone_bio() X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2012 18:31:21 -0000 On Thu, Aug 2, 2012 at 11:01 AM, Jim Harris wrote: > I'm trying to understand how the BIO_ORDERED flag ever gets passed > down to disk consumers (i.e. daX) It's obvious that g_io_flush() sets > the BIO_ORDERED flag, but when the bio gets cloned, the bio_flags do > not get cloned. So while the FLUSH command does make it to the disk > consumer, it is without the BIO_ORDERED flag. I'm sure some flags are > not meant to be cloned, but is seems BIO_ORDERED should. > > I'm sure I'm missing something here, but haven't figured it out yet. > Any help would be appreciated. > The following patch seems to be appropriate. The other flags (BIO_ERROR, BIO_DONE, and BIO_ONQUEUE) aren't suitable for cloning. diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index b4044a7..00c7d39 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -177,6 +177,8 @@ g_clone_bio(struct bio *bp) if (bp2 != NULL) { bp2->bio_parent = bp; bp2->bio_cmd = bp->bio_cmd; + /* Only BIO_ORDERED flag is suitable to be cloned. */ + bp2->bio_flags = bp->bio_flags & BIO_ORDERED; bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data;