From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=41001 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObFTU-0007zH-S3 for qemu-devel@nongnu.org; Tue, 20 Jul 2010 12:15:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ObFR5-0007Tp-Vb for qemu-devel@nongnu.org; Tue, 20 Jul 2010 12:12:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25915) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObFR5-0007Ta-Of for qemu-devel@nongnu.org; Tue, 20 Jul 2010 12:12:51 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6KGCodi015032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Jul 2010 12:12:51 -0400 Message-ID: <4C45CB01.4020008@redhat.com> Date: Tue, 20 Jul 2010 18:12:49 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Disable O_DIRECT for physical CDROM/DVD drives References: <1279639056-20465-1-git-send-email-Jes.Sorensen@redhat.com> <4C45C350.9000707@redhat.com> <4C45C8F1.9070705@redhat.com> In-Reply-To: <4C45C8F1.9070705@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: qemu-devel@nongnu.org Am 20.07.2010 18:04, schrieb Jes Sorensen: > On 07/20/10 17:40, Kevin Wolf wrote: >>> diff --git a/block/raw-posix.c b/block/raw-posix.c >>> index 291699f..0ea79b6 100644 >>> --- a/block/raw-posix.c >>> +++ b/block/raw-posix.c >>> @@ -1139,6 +1139,11 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags) >>> BDRVRawState *s = bs->opaque; >>> >>> s->type = FTYPE_CD; >>> + if (flags & BDRV_O_NOCACHE) { >>> + fprintf(stderr, "Disabling unsupported O_DIRECT (cache=none) for " >>> + "CDROM/DVD device (%s)\n", filename); >>> + flags &= ~BDRV_O_NOCACHE; >>> + } >> >> Good point. Just one detail: We should probably change bs->open_flags, >> too, to keep things consistent. > > Thats effectively what my patch does. cdrom_open() calls > raw_open_common() which has this part: > > /* Use O_DSYNC for write-through caching, no flags for write-back > caching, > * and O_DIRECT for no caching. */ > if ((bdrv_flags & BDRV_O_NOCACHE)) > s->open_flags |= O_DIRECT; s and bs both have a field open_flags (and I think they share some more field names, which has caused confusion more than once). I meant the bs one here. Kevin