]> git.hungrycats.org Git - linux/commitdiff
[PATCH] tmpfs 5/6: use cond_resched
authorAndrew Morton <akpm@digeo.com>
Thu, 3 Apr 2003 00:27:26 +0000 (16:27 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 3 Apr 2003 00:27:26 +0000 (16:27 -0800)
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.

mm/shmem.c

index a1bff8caab34f650d3d18ca5ab064a56d90f9b74..ca44cbbf438ea107ccd1bb5bd3d20dac452c2e52 100644 (file)
@@ -1211,6 +1211,8 @@ shmem_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
                buf += bytes;
                if (pos > inode->i_size)
                        inode->i_size = pos;
+
+               cond_resched();
        } while (count);
 
        *ppos = pos;
@@ -1302,6 +1304,8 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_
                page_cache_release(page);
                if (ret != nr || !desc->count)
                        break;
+
+               cond_resched();
        }
 
        *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;