[PATCH] Android: add ioprio support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also fix a build warning due to unused variable in some configs.
>From af503d22666a97623b8f85e07d6fefd9c232f1ee Mon Sep 17 00:00:00 2001
From: Aaron Carroll <aaronc@xxxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2013 15:46:10 +1100
Subject: [PATCH 2/2] Android: add ioprio support

Also fix build warning due to unused variable in some configs.
---
 engines/net.c   |    6 ++++++
 os/os-android.h |   22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/engines/net.c b/engines/net.c
index 624ff15..abb8412 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -490,6 +490,9 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
 			return 1;
 		}
 	}
+#else
+	/* avoid warnings */
+	(void)optval;
 #endif
 
 	if (o->proto == FIO_TYPE_UDP)
@@ -553,6 +556,9 @@ static int fio_netio_accept(struct thread_data *td, struct fio_file *f)
 			return 1;
 		}
 	}
+#else
+	/* avoid warnings */
+	(void)optval;
 #endif
 
 	reset_all_stats(td);
diff --git a/os/os-android.h b/os/os-android.h
index cedfdaf..e8c64f3 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -19,6 +19,7 @@
 
 #define FIO_HAVE_DISK_UTIL
 #define FIO_HAVE_IOSCHED_SWITCH
+#define FIO_HAVE_IOPRIO
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_BLKTRACE
@@ -74,6 +75,27 @@ static inline int shmdt (const void *__shmaddr)
 
 #define SPLICE_DEF_SIZE	(64*1024)
 
+static inline int ioprio_set(int which, int who, int ioprio)
+{
+	return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+enum {
+	IOPRIO_CLASS_NONE,
+	IOPRIO_CLASS_RT,
+	IOPRIO_CLASS_BE,
+	IOPRIO_CLASS_IDLE,
+};
+
+enum {
+	IOPRIO_WHO_PROCESS = 1,
+	IOPRIO_WHO_PGRP,
+	IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_BITS		16
+#define IOPRIO_CLASS_SHIFT	13
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64	_IOR(0x12,114,size_t)
 #endif
-- 
1.7.0.4


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux