Commit 8ccc8691 authored by Kinglong Mee's avatar Kinglong Mee Committed by Anna Schumaker

sunrpc: use simple_read_from_buffer for reading cache flush

Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 3f373e81
...@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf, ...@@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
struct cache_detail *cd) struct cache_detail *cd)
{ {
char tbuf[22]; char tbuf[22];
unsigned long p = *ppos;
size_t len; size_t len;
snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time)); len = snprintf(tbuf, sizeof(tbuf), "%lu\n",
len = strlen(tbuf); convert_to_wallclock(cd->flush_time));
if (p >= len) return simple_read_from_buffer(buf, count, ppos, tbuf, len);
return 0;
len -= p;
if (len > count)
len = count;
if (copy_to_user(buf, (void*)(tbuf+p), len))
return -EFAULT;
*ppos += len;
return len;
} }
static ssize_t write_flush(struct file *file, const char __user *buf, static ssize_t write_flush(struct file *file, const char __user *buf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment