forked from Minki/linux
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>
This commit is contained in:
parent
3f373e81b1
commit
8ccc869169
@ -1427,20 +1427,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
|
||||
struct cache_detail *cd)
|
||||
{
|
||||
char tbuf[22];
|
||||
unsigned long p = *ppos;
|
||||
size_t len;
|
||||
|
||||
snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
|
||||
len = strlen(tbuf);
|
||||
if (p >= 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;
|
||||
len = snprintf(tbuf, sizeof(tbuf), "%lu\n",
|
||||
convert_to_wallclock(cd->flush_time));
|
||||
return simple_read_from_buffer(buf, count, ppos, tbuf, len);
|
||||
}
|
||||
|
||||
static ssize_t write_flush(struct file *file, const char __user *buf,
|
||||
|
Loading…
Reference in New Issue
Block a user