On Mon, Aug 6, 2012 at 6:24 AM, Mike Qiu <[email protected]> wrote:
> Currently,it try to return the queue for device,which may cause an
> error when run the test about I/O Scheduler,because the device may be
> the partition like sdaj12(more than 26+ disks),or whole disk like sda,
> for obvious reasons,queue is for the entire disk, not for the partition.
> This change try to find out the entire disk of the partition,and get
> the queue for the entire disk
>
> Signed-off-by: Mike Qiu <[email protected]>
> ---
>  client/partition.py |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/client/partition.py b/client/partition.py
> index 7bed289..d9c8e30 100644
> --- a/client/partition.py
> +++ b/client/partition.py
> @@ -74,6 +74,9 @@ def list_mount_points():
>
>
>  def get_iosched_path(device_name, component):
> +    # for obvious reasons, queue is for the entire disk, not for the 
> partition
> +    if device_name[-1:].isdigit():

^ Here you can avoid the unnecessary list slice, and use directly [-1]

> +        device_name=re.sub("\d","","%s"%device_name)

^ Here you can use directly device name

>      return '/sys/block/%s/queue/%s' % (device_name, component)

Those are pretty minor nitpicks, so I've just fixed them, your patch looks now:

diff --git a/client/partition.py b/client/partition.py
index 7bed289..d2883dc 100644
--- a/client/partition.py
+++ b/client/partition.py
@@ -74,6 +74,9 @@ def list_mount_points():


 def get_iosched_path(device_name, component):
+    # queue refers to an entire disk, not a single partition
+    if device_name[-1].isdigit():
+        device_name=re.sub("\d", "", device_name)
     return '/sys/block/%s/queue/%s' % (device_name, component)


And it was applied. Thanks Mike,

-- 
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to