From patchwork Fri Mar 4 01:51:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 607581 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p242PVrc001412 for ; Fri, 4 Mar 2011 02:25:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759153Ab1CDCZ0 (ORCPT ); Thu, 3 Mar 2011 21:25:26 -0500 Received: from rcsinet10.oracle.com ([148.87.113.121]:29747 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759044Ab1CDCZZ (ORCPT ); Thu, 3 Mar 2011 21:25:25 -0500 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p242PKeN023280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Mar 2011 02:25:21 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p242PJJI018260; Fri, 4 Mar 2011 02:25:19 GMT Received: from abhmt005.oracle.com by acsmt354.oracle.com with ESMTP id 1107538271299203520; Thu, 03 Mar 2011 17:52:00 -0800 Received: from localhost (/66.66.148.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Mar 2011 17:52:00 -0800 From: Chris Mason To: "Zhong, Xin" Cc: Mitch Harder , Xin Zhong , "linux-btrfs@vger.kernel.org" Subject: RE: [PATCH] btrfs file write debugging patch In-reply-to: <1865303E0DED764181A9D882DEF65FB68662CD02C8@shsmsx502.ccr.corp.intel.com> References: <1865303E0DED764181A9D882DEF65FB68662CD02C8@shsmsx502.ccr.corp.intel.com> Date: Thu, 03 Mar 2011 20:51:55 -0500 Message-Id: <1299203447-sup-9359@think> User-Agent: Sup/git X-Source-IP: acsmt355.oracle.com [141.146.40.155] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4D704D90.005D,ss=1,fgs=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 04 Mar 2011 02:25:32 +0000 (UTC) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 89a6a26..6a44add 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1039,6 +1038,14 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, copied = btrfs_copy_from_user(pos, num_pages, write_bytes, pages, &i); + + /* + * if we have trouble faulting in the pages, fall + * back to one page at a time + */ + if (copied < write_bytes) + nrptrs = 1; + if (copied == 0) dirty_pages = 0; else