diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2017-02-07 08:50:32 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-02-08 17:02:47 -0500 |
commit | 8ccc869169d0c59d288b20ec2b060317f87e08b4 (patch) | |
tree | 12a720592ebbd756f35f0ede7c1d210119c653b0 | |
parent | 3f373e81b1e8d26a90523cd12385cbce588f3f18 (diff) |
sunrpc: use simple_read_from_buffer for reading cache flush
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | net/sunrpc/cache.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 9e8561d1714d..2f06f510b570 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf, | |||
1427 | struct cache_detail *cd) | 1427 | struct cache_detail *cd) |
1428 | { | 1428 | { |
1429 | char tbuf[22]; | 1429 | char tbuf[22]; |
1430 | unsigned long p = *ppos; | ||
1431 | size_t len; | 1430 | size_t len; |
1432 | 1431 | ||
1433 | snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time)); | 1432 | len = snprintf(tbuf, sizeof(tbuf), "%lu\n", |
1434 | len = strlen(tbuf); | 1433 | convert_to_wallclock(cd->flush_time)); |
1435 | if (p >= len) | 1434 | return simple_read_from_buffer(buf, count, ppos, tbuf, len); |
1436 | return 0; | ||
1437 | len -= p; | ||
1438 | if (len > count) | ||
1439 | len = count; | ||
1440 | if (copy_to_user(buf, (void*)(tbuf+p), len)) | ||
1441 | return -EFAULT; | ||
1442 | *ppos += len; | ||
1443 | return len; | ||
1444 | } | 1435 | } |
1445 | 1436 | ||
1446 | static ssize_t write_flush(struct file *file, const char __user *buf, | 1437 | static ssize_t write_flush(struct file *file, const char __user *buf, |