From 61837ba0b4b1b11db22c1a4aeee04a769eb1a8f3 Mon Sep 17 00:00:00 2001 From: braam Date: Sat, 23 Mar 2002 08:31:50 +0000 Subject: [PATCH] - don't read the page if we're just about to completely overwrite it - fixed one of the page invariant BUGs --- lustre/llite/rw.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index aa1d9e3..12814a4 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -241,12 +241,19 @@ static int ll_prepare_write(struct file *file, struct page *page, unsigned from, goto prepare_done; } - if ( offset + from >= inode->i_size ) { - memset(addr, 0, PAGE_SIZE); + if (offset + from >= inode->i_size) { + memset(addr, 0, PAGE_SIZE); EXIT; goto prepare_done; } - + + /* We're completely overwriting an existing page, so _don't_ set it up + * to date until commit_write */ + if (from == 0 && to == PAGE_SIZE) { + memset(addr, 0, PAGE_SIZE); + RETURN(0); + } + rc = ll_brw(OBD_BRW_READ, inode, page, 0); prepare_done: @@ -299,14 +306,13 @@ static int ll_commit_write(struct file *file, struct page *page, ENTRY; oa = ll_oa_from_inode(inode, OBD_MD_FLNOTOBD); - if (! oa ) { - return -ENOMEM; - } + if (! oa ) + RETURN(-ENOMEM); + + SetPageUptodate(page); if (!PageLocked(page)) BUG(); - if (!Page_Uptodate(page)) - BUG(); CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n", from, to, count); -- 1.8.3.1