Skip to contentSkip to conversation

Android: add ioprio support

PATCH In review Aaron Carroll 2 participants 3 messages Mar 12, 2013 – Mar 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Android: add ioprio support

Also fix a build warning due to unused variable in some configs.

From af503d22666a97623b8f85e07d6fefd9c232f1ee Mon Sep 17 00:00:00 2001
From: Aaron Carroll <[email protected]>
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(-)
engines/net.c +6 -0
index 624ff15..abb8412 100644
@@ -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);
os/os-android.h +22 -0
index cedfdaf..e8c64f3 100644
@@ -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
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 1 line · Aaron Carroll

Also fix a build warning due to unused variable in some configs.

I applied the ioprio part, is the other bit against an older series?

Quoted 15 lines
engines/net.c +3 -0
index 624ff15..abb8412 100644
@@ -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)

engines/net.c static int fio_netio_accept(struct thread_data *td, struct fio_file *f) · line 564

Quoted 9 lines
engines/net.c +3 -0
@@ -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);

optval is only inside the scope of the ifdef. This was changed with commit 6264c7a8 as of Feb 28th.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 4 lines · Jens Axboe
Quoted 1 line · Aaron Carroll

Also fix a build warning due to unused variable in some configs.

I applied the ioprio part, is the other bit against an older series?

Er, yes. Sorry about that.

-- Aaron