From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eli Carter Subject: [PATCH] cont_prepare_write question Date: Mon, 21 Jul 2003 14:45:25 -0500 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3F1C42D5.5050009@inet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from zeke.inet.com ([199.171.211.198]:1963 "EHLO zeke.inet.com") by vger.kernel.org with ESMTP id S270702AbTGUTaY (ORCPT ); Mon, 21 Jul 2003 15:30:24 -0400 Received: from tex.inetint.com (tex [172.16.99.35]) by zeke.inet.com (INET SMTP Server) with ESMTP id h6LJjQll011061 for ; Mon, 21 Jul 2003 14:45:26 -0500 (CDT) Received: from harpo.inetint.com (localhost [127.0.0.1]) by tex.inetint.com (8.12.1/8.12.1) with ESMTP id h6LJjPS7021334 for ; Mon, 21 Jul 2003 14:45:25 -0500 (CDT) Received: from inet.com ([172.16.20.84]) by harpo.inetint.com (Netscape Messaging Server 4.15) with ESMTP id HIE47P00.RBD for ; Mon, 21 Jul 2003 14:45:25 -0500 To: linux-fsdevel@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org From a very basic look at cont_prepare_write() in fs/buffer.c, it looks like it needs this patch to prevent an infinite loop when extending a file by several blocks. (>8 for the 0.5k block case) --- linux-2.5.68-rmk1/fs/buffer.c 2003/04/22 15:13:04 1.1.2.3 +++ linux-2.5.68-rmk1/fs/buffer.c 2003/07/21 19:38:40 @@ -2118,6 +2118,7 @@ goto out_unmap; kaddr = kmap_atomic(new_page, KM_USER0); memset(kaddr+zerofrom, 0, PAGE_CACHE_SIZE-zerofrom); + *bytes += PAGE_CACHE_SIZE-zerofrom; flush_dcache_page(new_page); kunmap_atomic(kaddr, KM_USER0); __block_commit_write(inode, new_page, I'm not going to pretend that I understand why, or what this exactly accomplishes... it just seems to improve things somewhat in my case. If someone could give a basic explanation of what is going on in this loop, particularly in regards to how the loop is supposed to end, or a pointer to something to read that would make this function clearer than mud, I'd be very grateful. Thanks, Eli --------------------. "If it ain't broke now, Eli Carter \ it will be soon." -- crypto-gram eli.carter(a)inet.com `-------------------------------------------------