qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad@kernel.org>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	qemu-devel@nongnu.org, xen-devel@lists.xen.org
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH RFC 1/3] xen_disk: handle disk files on ramfs/tmpfs
Date: Thu, 3 Jan 2013 09:21:30 -0500	[thread overview]
Message-ID: <20130103142129.GA6690@localhost.localdomain> (raw)
In-Reply-To: <1356956174-23548-2-git-send-email-roger.pau@citrix.com>

On Mon, Dec 31, 2012 at 01:16:12PM +0100, Roger Pau Monne wrote:
> Files that reside on ramfs or tmpfs cannot be opened with O_DIRECT,

That is not entirely true. There are patches floating around (LKML)
to make tmpfs/ramfs be able to do this.

> if first call to bdrv_open fails with errno = EINVAL, try a second
> call without BDRV_O_NOCACHE.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: xen-devel@lists.xen.org
> Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  hw/xen_disk.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xen_disk.c b/hw/xen_disk.c
> index e6bb2f2..a159ee5 100644
> --- a/hw/xen_disk.c
> +++ b/hw/xen_disk.c
> @@ -562,7 +562,7 @@ static void blk_alloc(struct XenDevice *xendev)
>  static int blk_init(struct XenDevice *xendev)
>  {
>      struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
> -    int index, qflags, info = 0;
> +    int index, qflags, info = 0, rc;
>  
>      /* read xenstore entries */
>      if (blkdev->params == NULL) {
> @@ -625,8 +625,18 @@ static int blk_init(struct XenDevice *xendev)
>          xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
>          blkdev->bs = bdrv_new(blkdev->dev);
>          if (blkdev->bs) {
> -            if (bdrv_open(blkdev->bs, blkdev->filename, qflags,
> -                        bdrv_find_whitelisted_format(blkdev->fileproto)) != 0) {
> +            rc = bdrv_open(blkdev->bs, blkdev->filename, qflags,
> +                        bdrv_find_whitelisted_format(blkdev->fileproto));
> +            if (rc != 0 && errno == EINVAL) {
> +                /* Files on ramfs or tmpfs cannot be opened with O_DIRECT,
> +                 * remove the BDRV_O_NOCACHE flag, and try to open
> +                 * the file again.
> +                 */
> +                qflags &= ~BDRV_O_NOCACHE;
> +                rc = bdrv_open(blkdev->bs, blkdev->filename, qflags,
> +                        bdrv_find_whitelisted_format(blkdev->fileproto));
> +            }
> +            if (rc != 0) {
>                  bdrv_delete(blkdev->bs);
>                  blkdev->bs = NULL;
>              }
> -- 
> 1.7.7.5 (Apple Git-26)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 

  reply	other threads:[~2013-01-03 14:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-31 12:16 [Qemu-devel] [PATCH RFC 0/3] xen pv disk persistent grants implementation Roger Pau Monne
2012-12-31 12:16 ` [Qemu-devel] [PATCH RFC 1/3] xen_disk: handle disk files on ramfs/tmpfs Roger Pau Monne
2013-01-03 14:21   ` Konrad Rzeszutek Wilk [this message]
2013-01-03 14:28   ` [Qemu-devel] [Xen-devel] " Ian Campbell
2013-01-04 14:54     ` Stefano Stabellini
2013-01-04 15:05       ` Roger Pau Monné
2013-01-04 15:30         ` Stefano Stabellini
2012-12-31 12:16 ` [Qemu-devel] [PATCH RFC 2/3] xen_disk: fix memory leak Roger Pau Monne
2013-01-04 15:06   ` Stefano Stabellini
2012-12-31 12:16 ` [Qemu-devel] [PATCH RFC 3/3] xen_disk: add persistent grant support to xen_disk backend Roger Pau Monne
2013-01-04 16:42   ` Stefano Stabellini
2013-01-04 17:37     ` Roger Pau Monné
2013-01-04 18:02       ` Stefano Stabellini
2013-01-04 21:01   ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130103142129.GA6690@localhost.localdomain \
    --to=konrad@kernel.org \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).