Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1373760lqh; Mon, 6 May 2024 06:05:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXA8idOkDQozwzK6OPSRUR2BJvLgzb93Vccd9KrhiMCqMDw00P9qPHcq7fK27q55+SksjvDHIXi+nVfhhvFUdYCwifgZDvu652UiI3v2A== X-Google-Smtp-Source: AGHT+IFHqMrwvnUg0ExDW5BS9dn0t1jGkORUbRicmHAjK1uIuRSEEx5a1eY2/K6HPIhp7mvzCxVW X-Received: by 2002:a05:6122:1da1:b0:4d8:7d49:18fe with SMTP id gg33-20020a0561221da100b004d87d4918femr17962800vkb.4.1715000744594; Mon, 06 May 2024 06:05:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715000744; cv=pass; d=google.com; s=arc-20160816; b=TbmfIZuHPdjX+p5E8V4DSIVtmHflT8hatV5LnGtfOW381hkMdIgWCoOVHPHHgedJDn 7KhBsUBFAJxsMWuTYIzgPWEELzvJIMCrb35iIZ+jnANIrZuA+VkXarV1chOe30JVVKjT cloiws7EvhfSyEDXLkJPiBdyDhysNQzrAPw4xfb1B+TbhHJXP2zqCjxPFK+CS9/TPA1i HmOGUESS+M/DBR/7U51jEsdBOdCLCmHEPIJf7MrLM/XRl1qNOLfC7VpAQU2PNTXtY9Hb bKzkYvfQdGLgXPf6WSz/NhE5oAi4+E+4P5yaiERcH7gRnisE6EBwGJzKYdhJepGRbvvt cFTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=oQKVfzwfwLLDVFsPcbQHe60VzKi2BvXGduWxYsOPqYA=; fh=Osh4uBb3kdyegO/YWwQoGUhCgrrzgbnUvsz5EKu0a8s=; b=EZlLTF7OQ6f9PZAGtskqGVTdGplh/p6mP+X5CQVk+KcAqBzs7m/Uk3bEt3p+VK8Ehb kAseHGCMzEX0ibNN8z/LQ78xi2lerxu6fH5vW8h66XdUPQVquzHkps1SpBS5Vala4EAR 0N/bwqcejbY/mReljjgnS9UaX2C5DvIJFZh8ynX1jZpNF79Vi8DnwWYahCA5QjfYlotK mbGuUgH/CcxGx13K8UnLnQA+5UkwbWYH+w5rHFuQWKSuxj4o1oFexVEnLFot4YAijx6U Uc7MLyNmOdnsf12tNO8nbd5YAUo4WB5rDcwI+xiHzjXwDnNSmNOaOoWVys/JPUdHl5rr Iy2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-169867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169867-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 19-20020a05612208d300b004de9a76e9afsi1678304vkg.13.2024.05.06.06.05.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 06:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-169867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169867-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 41B801C235F7 for ; Mon, 6 May 2024 13:05:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BC2A76408; Mon, 6 May 2024 13:05:33 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (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 9B5B644C66; Mon, 6 May 2024 13:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715000732; cv=none; b=rIGRcKfNEHVT2ridJiTzJcvCrruAObbh+uDEMnwWCzP/uerbnlIFxlFCxemF352itBrG23fFCDKsBT4u6/lkQ2J0G4yJXrS1sSRSGmBPsR8nH5nbDB8TJSgVY6XJ/sZzlx/iFGobswHQVC/kkntce9jHiiCQtJeYZ739s11Xvvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715000732; c=relaxed/simple; bh=o/sXgNc3t4AhEHZQzACRVWndIPoft8f4vqB8PGglIIo=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=MaSh/EytpS1MUuZ7I5L+h84RV0eMnIldDzu6OB8PmbvnlkR6qUYGzsSCoCiixCLfl+RHLVNcRAoDSRy/9ZYELugyHedNwABglla1RS2+/RZUucRV7PN2h79SaHr455ydDqe9j5XwesPTf+uwogOzjac9ZaIn9PwvnySM5lqsZaw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VY1q04Xwqz4f3jd5; Mon, 6 May 2024 21:05:16 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id CBBD31A0572; Mon, 6 May 2024 21:05:24 +0800 (CST) Received: from [10.174.179.80] (unknown [10.174.179.80]) by APP2 (Coremail) with SMTP id Syh0CgAnmAuS1ThmXifRMA--.45497S3; Mon, 06 May 2024 21:05:24 +0800 (CST) Subject: Re: [RFC PATCH v4 29/34] ext4: fall back to buffer_head path for defrag To: Dave Chinner Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com References: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> <20240410150313.2820364-1-yi.zhang@huaweicloud.com> From: Zhang Yi Message-ID: <5dbb3021-b92e-2e53-7eee-5a6595a5ad03@huaweicloud.com> Date: Mon, 6 May 2024 21:05:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:Syh0CgAnmAuS1ThmXifRMA--.45497S3 X-Coremail-Antispam: 1UD129KBjvdXoW7Jr4kGw4xCryrur4xWFW8Crg_yoWDWwcE9F yrCrWDC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, 2024 at 11:03:08PM +0800, Zhang Yi wrote: >> From: Zhang Yi >> >> Online defrag doesn't support iomap path yet, we have to fall back to >> buffer_head path for the inode which has been using iomap. Changing >> active inode is dangerous, before we start, we must hold the inode lock >> and the mapping->invalidate_lock, and writeback all dirty folios and >> drop the inode's pagecache. > > Even then, I don't think this is obviously safe. We went through > this with DAX and we couldn't make it work safely. > > Just return EOPNOTSUPP to the online defrag ioctl if iomap is in use > - that avoids all the excitement involved in doing dangerous things > like swapping aops structures on actively referenced inodes... > Okay, this is just a temporary solution to support defrag. I've been looking at how to support defrag for iomap recently, I hope it could be supported in the near future, so let's drop this dangerous operation. Thanks, Yi.