Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp470148lqb; Thu, 29 Feb 2024 06:24:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWE2VucrunBeC8xH5baf6YcaC2w43J2yv66BH8RgNpezRjeKiM2gFHz+U0yC2UKP4F21B+Oq5smmzqlSmTwpge0AbFgUfqGAthQG+wmlw== X-Google-Smtp-Source: AGHT+IFUxJ0MUmox5bw8IjWdSKxalceibnz3MM9dQds5DiCQGDQI2XdygqoOGK+q/C/40rAvKOHS X-Received: by 2002:a05:6402:528c:b0:565:e2ee:3079 with SMTP id en12-20020a056402528c00b00565e2ee3079mr1856740edb.15.1709216646069; Thu, 29 Feb 2024 06:24:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709216646; cv=pass; d=google.com; s=arc-20160816; b=TSWWrkioRxJhT3PyWpGrbC4HqO1oQnYJ7HF5SdCIilwvimUHh6oAsuFxkaLyu5r+vL BlUPXKyaI47yYrLqE14UZRFtXTMrgGllyGfEWmxa6Y9O9EApUr1ULkjw9Rt/nUVxJZRS skDxuai1YNuOnhRpUFJr/W6MFVYGQjEUUrMDyreIO6vJbQrpdRaUYe6v/TQpMtLjBOKm WGAcmNq8I2pld8R/qfTlMIjm8dAiK9msu7ytg1nzJOgFWyRC2QCg6oxHEZi8riFxyqc0 kR01653oG/AXuOY7kNxfBf/MiaKAcmXjScBcmv+9UPDhlqk8Dt5ESbMdqjUJfQAFwZqQ 2FBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from; bh=Bp409T9hB7VktBufpivc58e3oF4Ucc13+kIs+ONcc2A=; fh=Ztr50G4dYfEcbVk3qhzfU7XKsVRNXhdMOcsF2vCFtk8=; b=SLgBN0Bcy8LCEYdYpYMcbwZttdCFy81GtKNyW/0Nlt+uXekqVs2g9cqi5Ksl10cuDB V/7oi5EzEQ2x/WZdEC8mSdMcHtWQnGly3d/158jhHd8LsF1iwxZAQmLsdLb86qu9LE4i R+3KByXro42Y5CATjeTFkhSRxsvjmf9qR5/kwuTs7Y9BAoYKTrWEXtUY/LPSHexEKPjM Z8S5YV6mvTJYaGfNIZkCtpAAlSzPlE/FDf8BSMRDIkOul5++cT6/FkxEB73G6mUfoOCJ aR29VbixOtG55lNEuuVyj9qhhlHAmC0DwTJf+d56JdFj2rBv0sDnCaNN4TA17GWCto+R uYHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=thesusis.net); spf=pass (google.com: domain of linux-ext4+bounces-1432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1432-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y7-20020a056402358700b00566a3aaba8dsi550897edc.45.2024.02.29.06.24.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 06:24:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=thesusis.net); spf=pass (google.com: domain of linux-ext4+bounces-1432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1432-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA2B61F251A8 for ; Thu, 29 Feb 2024 14:24:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 440F11361D3; Thu, 29 Feb 2024 14:23:44 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from vps.thesusis.net (vps.thesusis.net [34.202.238.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 796DC12F58D for ; Thu, 29 Feb 2024 14:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=34.202.238.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709216624; cv=none; b=mdTW2XNEHI1u9G1i8IK/ywF6HXx+9yGHYfSYBlru3HYYHROEvG6gX4+cYC7vfoMmr6E2yP9SBBz0zsxQhFYPslK4RQKfmCFkoTQNdjv84ZTZKUENhQxZvX17/9+C1RVIJO9edxwosFFxVH9MJcCBnPNBVYlxOlBwveuewoxtFqQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709216624; c=relaxed/simple; bh=Z/Ix3tOT6a0nAt88mwf6cU0mTWv1qJyE2c4TbTKeo8c=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AGoaN5t2H85mp5sc+WOG3AiDm55/HAmUIsNYrBz+9VazKlsvO3i2gfIpgIYvO1p6jtFQYri21u8SM35dwKpCjliyW18TB/wa5DXYCavm27uGyE5ZZcOr15qPqwdpTLR25eg+mZcP6uAVifCILm8N/MOsCFcc9cud8Wz4zu0AuDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thesusis.net; spf=pass smtp.mailfrom=thesusis.net; arc=none smtp.client-ip=34.202.238.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thesusis.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=thesusis.net Received: by vps.thesusis.net (Postfix, from userid 1000) id A25DB27856; Thu, 29 Feb 2024 09:23:35 -0500 (EST) From: Phillip Susi To: Theodore Tso Cc: linux-ext4@vger.kernel.org Subject: Re: [PATCH] [RFC] Fix jbd2 to stop waking up sleeping disks on sync In-Reply-To: <20240229080759.GB57093@macsyma.local> References: <20240227212546.110340-1-phill@thesusis.net> <20240229080759.GB57093@macsyma.local> Date: Thu, 29 Feb 2024 09:23:35 -0500 Message-ID: <87edcv1h94.fsf@vps.thesusis.net> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Theodore Tso" writes: > Yeah, this change is going to problems. The basic idea here is if > when we request that a transaction to commit, will it issue a a > commit? If so, then fsync(2) doesn't need to issue a barrier (i.e., a > cache flush command). > > So for example, if a database does an overwriting write to a file > block which is already allocated, and then follows it up with a > fdatasync(2), there won't be any need to make any metadata changes as > part of writing out the changed block. Hence, we won't need to start > a new jbd2 transaction, and in that case, current transaction has > already commited, so the jbd2 layer won't need to do anything, and so > it won't have issued a commit. In that case, > jbd2_trans_will_send_data_barrier() needs to return false, so that > fdatasync(2) will actually issue a cache flush command. > > The patch you've proposed will cause fdatasync(2) to not issue a > barrier, which could lead to the write to the database file getting > lost after a power fail event, which would make the database > adminisrtator very sad. So because no metadata changed, jbd2 will not issue a barrier to end the transaction? How can we fix this then? Is there some way that jbd2 can know whether file data has been written, and thus, issue the barrier to close the transaction?