From: Badari Pulavarty <pbadari@us.ibm.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org,
target-devel <target-devel@vger.kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>, Asias He <asias@redhat.com>,
Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Date: Thu, 30 May 2013 11:00:45 -0700 [thread overview]
Message-ID: <51A793CD.1070304@us.ibm.com> (raw)
In-Reply-To: <1369892185.7364.134.camel@haakon3.risingtidesystems.com>
On 05/29/2013 10:36 PM, Nicholas A. Bellinger wrote:
> On Wed, 2013-05-29 at 21:29 -0700, Nicholas A. Bellinger wrote:
>> On Thu, 2013-05-30 at 06:17 +0800, Asias He wrote:
>>> On Wed, May 29, 2013 at 08:10:44AM -0700, Badari Pulavarty wrote:
>>>> On 05/29/2013 02:05 AM, Wenchao Xia wrote:
>>>>> 于 2013-5-28 17:00, Wenchao Xia 写道:
>> <SNIP>
>>
>>>>> I have done a basic test of vhost-scsi, following is the result I'd
>>>>> like to post, generally it seems fine:
>>>>>
>>>>> Result:
>>>>> fdisk/mkfs: fdisk can find it, mke2fs works fine.
>>>>> mount: can mount it.
>>>>> file I/O: dd 90M zero to a file in that disk succeed.
>>>>
>>>>
>>>> I tried without nested kvm.
>>>>
>>>>> Issues:
>>>>> 1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
>>>>> dev fd0, sector 0", I guess it is caused by nested KVM that failed
>>>>> to kick host kernel?
>>>>
>>>> I don't see this issue. Are you sure "fd0" is actually the scsi device ?
>>>> what is "fd0" ?
>>>>
>>>>> 2) in fdisk -l, it shows 512 bytes larger than the parameter I
>>>>> specified in fd_dev_size parameter in configfs on host.(shows
>>>>> 104858112 bytes, see the invocation script below)
>>>>>
>>>> I see the same. For some reason "fdisk -l" in the VM shows
>>>> 512-bytes more than the actual size for the file (on the host).
>>> Hmm, interesting. Will look into it.
>>>
>>> Nick, Any ideas here?
>>>
>> Mmm, fd_get_blocks() is not returning the expected minus one logical
>> blocks with a !S_ISBLK() setup.
>>
>> This is happening for every other backend ->get_blocks() call already,
>> and should be happening for the fd_dev_size case as well.
>>
>> Applying the following to target-pending.git now.
>>
> Actually sorry, that last patch is not correct..
>
> Here's a better one to properly set fd_dev->fd_block_size at configure
> time, and use dev_attrib.block_size in fd_get_blocks() to allow for user
> defined block_sizes.
>
> Thanks,
>
> --nab
>
> commit 9e309f9307fe644dee8718980bfcb77de91ce38e
> Author: Nicholas Bellinger <nab@linux-iscsi.org>
> Date: Wed May 29 21:35:23 2013 -0700
>
> target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export
>
> This patch fixes a bug where FILEIO was incorrectly reporting the number
> of logical blocks (+ 1) when using non struct block_device export mode.
>
> It changes fd_get_blocks() to follow all other backend ->get_blocks() cases,
> and reduces the calculated dev_size by one dev->dev_attrib.block_size
> number of bytes, and fixes the initial block_size assignment within
> fd_configure_device()
>
> Reported-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> Reported-by: Badari Pulavarty <pbadari@us.ibm.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
>
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 1b1d544..b11890d 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -153,6 +153,7 @@ static int fd_configure_device(struct se_device *dev)
> struct request_queue *q = bdev_get_queue(inode->i_bdev);
> unsigned long long dev_size;
>
> + fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev);
> /*
> * Determine the number of bytes from i_size_read() minus
> * one (1) logical sector from underlying struct block_device
> @@ -199,6 +200,7 @@ static int fd_configure_device(struct se_device *dev)
> goto fail;
> }
>
> + fd_dev->fd_block_size = FD_BLOCKSIZE;
> /*
> * Limit UNMAP emulation to 8k Number of LBAs (NoLB)
> */
> @@ -217,9 +219,7 @@ static int fd_configure_device(struct se_device *dev)
> dev->dev_attrib.max_write_same_len = 0x1000;
> }
>
> - fd_dev->fd_block_size = dev->dev_attrib.hw_block_size;
> -
> - dev->dev_attrib.hw_block_size = FD_BLOCKSIZE;
> + dev->dev_attrib.hw_block_size = fd_dev->fd_block_size;
> dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS;
> dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
>
> @@ -694,11 +694,12 @@ static sector_t fd_get_blocks(struct se_device *dev)
> * to handle underlying block_device resize operations.
> */
> if (S_ISBLK(i->i_mode))
> - dev_size = (i_size_read(i) - fd_dev->fd_block_size);
> + dev_size = i_size_read(i);
> else
> dev_size = fd_dev->fd_dev_size;
>
> - return div_u64(dev_size, dev->dev_attrib.block_size);
> + return div_u64(dev_size - dev->dev_attrib.block_size,
> + dev->dev_attrib.block_size);
> }
>
> static struct sbc_ops fd_sbc_ops = {
>
>
Verified and it shows the correct value now.
Thanks,
Badari
next prev parent reply other threads:[~2013-05-30 18:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 14:24 [Qemu-devel] [PULL 0/9] SCSI updates for 2013-04-13 Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 1/9] scsi: avoid assertion failure on VERIFY command Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementation Paolo Bonzini
2013-06-21 3:47 ` Libaiqing
2013-06-21 7:36 ` Paolo Bonzini
2013-06-21 11:44 ` Dmitry Fleytman
2013-06-21 12:00 ` Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 3/9] vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 4/9] virtio-scsi: create VirtIOSCSICommon Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 5/9] virtio: simplify Makefile conditionals Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Paolo Bonzini
2013-05-28 7:13 ` Wenchao Xia
2013-05-28 8:01 ` Paolo Bonzini
2013-05-28 8:33 ` Asias He
2013-05-28 9:00 ` Wenchao Xia
2013-05-29 9:05 ` Wenchao Xia
2013-05-29 9:27 ` Asias He
2013-05-29 15:10 ` Badari Pulavarty
2013-05-29 22:17 ` Asias He
2013-05-30 4:29 ` Nicholas A. Bellinger
2013-05-30 5:36 ` Nicholas A. Bellinger
2013-05-30 18:00 ` Badari Pulavarty [this message]
2013-06-06 22:53 ` [Qemu-devel] vhost-scsi and pscsi Badari
2013-05-30 2:09 ` [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Wenchao Xia
2013-06-19 12:55 ` Libaiqing
2013-06-20 1:33 ` Asias He
2013-06-20 3:22 ` Wenchao Xia
2013-06-20 8:49 ` Libaiqing
2013-06-20 9:38 ` Asias He
2013-06-21 10:16 ` Libaiqing
2013-07-03 3:08 ` Libaiqing
2013-07-03 3:18 ` Asias He
2013-07-03 3:23 ` Asias He
2013-07-03 8:08 ` Asias He
2013-07-03 12:33 ` Libaiqing
2013-07-04 11:23 ` Paolo Bonzini
2013-07-08 0:59 ` Libaiqing
2013-07-04 7:00 ` Libaiqing
2013-07-05 0:00 ` Asias He
2013-07-05 6:52 ` Asias He
2013-07-05 11:17 ` Vadim Rozenfeld
2013-07-10 1:50 ` Asias He
2013-04-19 14:24 ` [Qemu-devel] [PATCH 7/9] vhost-scsi-pci: " Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 8/9] vhost-scsi-ccw: " Paolo Bonzini
2013-04-19 14:24 ` [Qemu-devel] [PATCH 9/9] vhost-scsi-s390: " Paolo Bonzini
2013-04-23 23:17 ` [Qemu-devel] [PULL 0/9] SCSI updates for 2013-04-13 Nicholas A. Bellinger
2013-04-24 5:59 ` [Qemu-devel] seabios for qemu 1.5 Gerd Hoffmann
2013-04-24 6:11 ` Amos Kong
2013-05-16 4:46 ` Amos Kong
2013-05-27 6:17 ` Gerd Hoffmann
2013-04-30 16:01 ` Paolo Bonzini
2013-04-24 4:56 ` [Qemu-devel] [PULL 0/9] SCSI updates for 2013-04-13 Stefan Weil
2013-04-24 8:19 ` Paolo Bonzini
2013-04-24 16:56 ` Stefan Weil
2013-04-26 8:40 ` Paolo Bonzini
2013-06-17 21:18 ` Anthony Liguori
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=51A793CD.1070304@us.ibm.com \
--to=pbadari@us.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=asias@redhat.com \
--cc=mst@redhat.com \
--cc=nab@linux-iscsi.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=target-devel@vger.kernel.org \
--cc=xiawenc@linux.vnet.ibm.com \
/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).