Re: [PATCH 3/3] Added test case 259 for the btrfs raid features
From: Christoph Hellwig <hch@infradead.org>
Date: 2011-09-02 08:49:41
Also in:
linux-fsdevel, linux-xfs
From: Christoph Hellwig <hch@infradead.org>
Date: 2011-09-02 08:49:41
Also in:
linux-fsdevel, linux-xfs
On Fri, Aug 12, 2011 at 04:01:33AM +0800, Anand Jain wrote:
Added test case 259 for the btrfs raid features. SCRATCH_DEV_POOL must be set to 2 or more disks.
Any chance you can document how SCRATCH_DEV_POOL is supposed to be used in the README file? An addition patch is fine, no need to update the existing ones. Also is there a chance you could allow setting only SCRATCH_DEV_POOL for btrfs, and derive SCRATCH_DEV for that as an additional step?
+# arg 1 remove/add
+# arg 2 /dev/sdx or return of devmgt resply
+_devmgt()
+{
+ local x
+ local d
+
+ if [ $1 == "remove" ]; then
+ d=`echo $2|cut -d"/" -f3`
+ x=`ls -l /sys/class/block/${d} | cut -d "/" -f12 | sed 's/:/ /g'`
+ echo "scsi remove-single-device ${x}" > /proc/scsi/scsi || _fail
"Remove disk failed"
+ DEVHTL=${x}
+ else
+ echo "scsi add-single-device ${2}" > /proc/scsi/scsi || _fail
"Add disk failed"
+ fi
+}Please use the sysfs interface instead of the deprecated /proc/scsi/scsi interface. I would also suggest to split this routine into two for removing and adding, and move them to the common helper library, so it could be used for other tests.
+# we need this to test removing a dev from the system
+_require_proc_scsi()
+{
+ [ -e /proc/scsi/scsi ] || _notrun "/proc/scsi/scsi is not present"
+}The _require need really is that the device you want to work on is a SCSI device.