From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3kxr-0008Ed-5d for qemu-devel@nongnu.org; Tue, 21 Aug 2012 05:41:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3kxq-0005U2-6F for qemu-devel@nongnu.org; Tue, 21 Aug 2012 05:41:35 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:45035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3kxp-0005Tm-IO for qemu-devel@nongnu.org; Tue, 21 Aug 2012 05:41:34 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Aug 2012 19:40:18 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7L9WTBS21627110 for ; Tue, 21 Aug 2012 19:32:30 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7L9f8W1018042 for ; Tue, 21 Aug 2012 19:41:09 +1000 Message-ID: <503357B2.5040901@linux.vnet.ibm.com> Date: Tue, 21 Aug 2012 17:41:06 +0800 From: Cong Meng MIME-Version: 1.0 References: <1345537427-21601-1-git-send-email-mc@linux.vnet.ibm.com> <50334B51.6050900@redhat.com> In-Reply-To: <50334B51.6050900@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , stefanha@linux.vnet.ibm.com, zwanp@cn.ibm.com, Rusty Russell , linuxram@us.ibm.com, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org On Tue 21 Aug 2012 04:48:17 PM CST, Paolo Bonzini wrote: > Il 21/08/2012 10:23, Cong Meng ha scritto: >> +static void sg_get_queue_limits(BlockDriverState *bs, const char *filename) >> +{ >> + DIR *ffs; >> + struct dirent *d; >> + char path[MAXPATHLEN]; >> + >> + snprintf(path, MAXPATHLEN, >> + "/sys/class/scsi_generic/sg%s/device/block/", >> + filename + strlen("/dev/sg")); >> + >> + ffs = opendir(path); >> + if (!ffs) { >> + return; >> + } >> + >> + for (;;) { >> + d = readdir(ffs); >> + if (!d) { >> + return; >> + } >> + >> + if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) { >> + continue; >> + } >> + >> + break; >> + } >> + >> + closedir(ffs); >> + >> + pstrcat(path, MAXPATHLEN, d->d_name); >> + pstrcat(path, MAXPATHLEN, "/queue/"); >> + >> + read_queue_limit(path, "max_sectors_kb", &bs->max_sectors); >> + read_queue_limit(path, "max_segments", &bs->max_segments); >> + read_queue_limit(path, "max_segment_size", &bs->max_segment_size); >> +} > > Using /sys/dev/block or /sys/dev/char seems easier, and lets you > retrieve the parameters for block devices too. > what do you mean with "block devices"? Using "/dev/sda" instead of "/dev/sg0"? > However, I'm worried of the consequences this has for migration. You > could have the same physical disk accessed with two different HBAs, with > different limits. So I don't know if this can really be solved at all. > I know little about qemu migration now. The pending scsi commands will be saved and transfered to remote machine when starting migration? Cong. > Paolo >