From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3k8X-0008FN-RK for qemu-devel@nongnu.org; Tue, 21 Aug 2012 04:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3k8T-0006nS-LG for qemu-devel@nongnu.org; Tue, 21 Aug 2012 04:48:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3k8T-0006n7-E8 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 04:48:29 -0400 Message-ID: <50334B51.6050900@redhat.com> Date: Tue, 21 Aug 2012 10:48:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1345537427-21601-1-git-send-email-mc@linux.vnet.ibm.com> In-Reply-To: <1345537427-21601-1-git-send-email-mc@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 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: Cong Meng 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 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. 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. Paolo