lkml.org 
[lkml]   [2018]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 4/6] tools/gup_benchmark: Allow user specified file
On Wed, 10 Oct 2018 13:56:03 -0600 Keith Busch <keith.busch@intel.com> wrote:

> This patch allows a user to specify a file to map by adding a new option,
> '-f', providing a means to test various file backings.
>
> If not specified, the benchmark will use a private mapping of /dev/zero,
> which produces an anonymous mapping as before.
>
> ...
>
> --- a/tools/testing/selftests/vm/gup_benchmark.c
> +++ b/tools/testing/selftests/vm/gup_benchmark.c
>
> ...
>
> @@ -61,11 +62,18 @@ int main(int argc, char **argv)
> case 'w':
> write = 1;
> break;
> + case 'f':
> + file = optarg;
> + break;
> default:
> return -1;
> }
> }
>
> + filed = open(file, O_RDWR|O_CREAT);
> + if (filed < 0)
> + perror("open"), exit(filed);

Ick. Like this, please:

--- a/tools/testing/selftests/vm/gup_benchmark.c~tools-gup_benchmark-allow-user-specified-file-fix
+++ a/tools/testing/selftests/vm/gup_benchmark.c
@@ -71,8 +71,10 @@ int main(int argc, char **argv)
}

filed = open(file, O_RDWR|O_CREAT);
- if (filed < 0)
- perror("open"), exit(filed);
+ if (filed < 0) {
+ perror("open");
+ exit(filed);
+ }

gup.nr_pages_per_call = nr_pages;
gup.flags = write;
\
 
 \ /
  Last update: 2018-10-11 00:31    [W:0.066 / U:23.760 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site