Commit 548ac1de authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] tmpfs 5/6: use cond_resched

From: Hugh Dickins <hugh@veritas.com>

cond_resched each time around the loop in shmem_file_write
and do_shmem_file_read, matching filemap.c.
parent 5d86cc8b
...@@ -1211,6 +1211,8 @@ shmem_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -1211,6 +1211,8 @@ shmem_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
buf += bytes; buf += bytes;
if (pos > inode->i_size) if (pos > inode->i_size)
inode->i_size = pos; inode->i_size = pos;
cond_resched();
} while (count); } while (count);
*ppos = pos; *ppos = pos;
...@@ -1302,6 +1304,8 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_ ...@@ -1302,6 +1304,8 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_
page_cache_release(page); page_cache_release(page);
if (ret != nr || !desc->count) if (ret != nr || !desc->count)
break; break;
cond_resched();
} }
*ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset; *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
......
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