From patchwork Wed Dec 2 20:45:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 7751621 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 952C09F39D for ; Wed, 2 Dec 2015 20:45:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C550F20532 for ; Wed, 2 Dec 2015 20:45:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDF5420520 for ; Wed, 2 Dec 2015 20:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754396AbbLBUpS (ORCPT ); Wed, 2 Dec 2015 15:45:18 -0500 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:18423 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752550AbbLBUpR (ORCPT ); Wed, 2 Dec 2015 15:45:17 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DNBgCoV19W/1bELHlehHuCYagnAQEEBos/iTyGCAICAQECgU9NAQEBAQEBgQuENAEBBScTHDMIAxUDCSUPBSUDIQESiC7ABwELIRmFdIVEhQGEOgWSd4NqjTOcdmOEGCo0hW8BAQE Received: from ppp121-44-196-86.lns20.syd7.internode.on.net (HELO dastard) ([121.44.196.86]) by ipmail07.adl2.internode.on.net with ESMTP; 03 Dec 2015 07:15:15 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1a4EGs-00046q-8d; Thu, 03 Dec 2015 07:45:02 +1100 Date: Thu, 3 Dec 2015 07:45:02 +1100 From: Dave Chinner To: Ross Zwisler , xfs@oss.sgi.com, Brian Foster , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Moyer Subject: Re: xfstests failures with xfs, dax and v4.4-rc3 Message-ID: <20151202204502.GI19199@dastard> References: <20151202183438.GA1319@linux.intel.com> <20151202202910.GH19199@dastard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151202202910.GH19199@dastard> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Dec 03, 2015 at 07:29:10AM +1100, Dave Chinner wrote: > On Wed, Dec 02, 2015 at 11:34:38AM -0700, Ross Zwisler wrote: > > I'm hitting a few more test failures in my testing setup with v4.4-rc3, xfs > > and DAX. My test setup is a pair of 4GiB PMEM partitions in a KVM virtual > > machine. Here are the failures: > > Which are caused by commit 1ca1915 ("xfs: Don't use unwritten extents > for DAX") because of this code for unwritten extent conversion in > get_blocks: > > tp->t_flags |= XFS_TRANS_RESERVE; > > It's a minor problem compared to all the other issues DAX has right > now, so I ignored it to get the bigger problem solved first. Patch to fix the problem below. -Dave. Tested-by: Ross Zwisler diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index f4f5b43..9ed146b 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -203,15 +203,20 @@ xfs_iomap_write_direct( * this outside the transaction context, but if we commit and then crash * we may not have zeroed the blocks and this will be exposed on * recovery of the allocation. Hence we must zero before commit. + * * Further, if we are mapping unwritten extents here, we need to zero * and convert them to written so that we don't need an unwritten extent * callback for DAX. This also means that we need to be able to dip into - * the reserve block pool if there is no space left but we need to do - * unwritten extent conversion. + * the reserve block pool for bmbt block allocation if there is no space + * left but we need to do unwritten extent conversion. */ + if (IS_DAX(VFS_I(ip))) { bmapi_flags = XFS_BMAPI_CONVERT | XFS_BMAPI_ZERO; - tp->t_flags |= XFS_TRANS_RESERVE; + if (ISUNWRITTEN(imap)) { + tp->t_flags |= XFS_TRANS_RESERVE; + resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0) << 1; + } } error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write, resblks, resrtextents);