From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSotg-0001cC-BO for qemu-devel@nongnu.org; Tue, 22 Nov 2011 06:52:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSotb-0000pK-Pj for qemu-devel@nongnu.org; Tue, 22 Nov 2011 06:52:20 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:59143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSotb-0000ox-8D for qemu-devel@nongnu.org; Tue, 22 Nov 2011 06:52:15 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Nov 2011 11:50:11 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAMBmd6e1372360 for ; Tue, 22 Nov 2011 22:48:44 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAMBpp8I022794 for ; Tue, 22 Nov 2011 22:51:54 +1100 Message-ID: <4ECB87E8.3030806@in.ibm.com> Date: Tue, 22 Nov 2011 17:00:48 +0530 From: supriya kannery MIME-Version: 1.0 References: <20111111064707.15024.69847.sendpatchset@skannery.in.ibm.com> <20111111064833.15024.54047.sendpatchset@skannery.in.ibm.com> <4ECA447A.40500@in.ibm.com> <4ECB6F43.8060000@in.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [v9 Patch 6/6]Qemu: raw posix implementation of reopen functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Supriya Kannery , Christoph Hellwig , qemu-devel@nongnu.org, Luiz Capitulino Stefan Hajnoczi wrote: > On Tue, Nov 22, 2011 at 9:45 AM, supriya kannery wrote: > >> supriya kannery wrote: >> >>> Stefan Hajnoczi wrote: >>> >>>> On Fri, Nov 11, 2011 at 6:48 AM, Supriya Kannery >>>> wrote: >>>> >>>> >>>>> + } >>>>> + if ((flags & BDRV_O_NOCACHE)) { >>>>> + raw_rs->reopen_state.reopen_flags |= O_DIRECT; >>>>> + } else { >>>>> + raw_rs->reopen_state.reopen_flags &= ~O_DIRECT; >>>>> + } >>>>> + ret = fcntl_setfl(raw_rs->reopen_fd, >>>>> raw_rs->reopen_state.reopen_flags); >>>>> >>>>> >>>> I wonder if this works on Solaris, FreeBSD, etc? >>>> >>>> Perhaps there needs to be a fallback to the missing "else" case below... >>>> >>>> >>>> >>> ok. Will look into whether this will work on Solaris, FreeBSD etc.. >>> >>> >> This should work for all non-win Oses. >> I have tested only in x86. >> >> #ifndef _WIN32 >> /* Sets a specific flag */ >> int fcntl_setfl(int fd, int flag) >> { >> int flags; >> >> flags = fcntl(fd, F_GETFL); >> > > Are you sure POSIX guarantees that O_DIRECT can be changed with > F_SETFL? I didn't find any statement in the specification. It is > possible that this code compiles but does not actually work on > non-Linux OSes. Did you run tests? > I don't have FreeBSD and Solaris systems to use. Referred the following man page links to verify that O_DIRECT in these OSes can be changed using fcntl. http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?fcntl+2 http://man-wiki.net/index.php/2:fcntl If anybody with these systems can confirm, that would be very helpful. -thanks, Supriya > Stefan > >