Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp980645lqh; Fri, 29 Mar 2024 03:27:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAlDbiM4FgV/RRjAXK3kR99ZT+pin8lU6JN6OV/UBcTGmiX6fsDkOapIwl/Ir3iVuU34TCF8ffpgofUnwjr50CabJPFZ6ubzV69jMWRg== X-Google-Smtp-Source: AGHT+IFtZwQ7z9T256mcem5wCZ3W9mA8AKEA2BKdwj0uMeh119Gsrcyimm0frtR1phAkq5lfNyNO X-Received: by 2002:a05:6e02:1a6d:b0:368:97ba:a2a2 with SMTP id w13-20020a056e021a6d00b0036897baa2a2mr1801522ilv.14.1711708055882; Fri, 29 Mar 2024 03:27:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711708055; cv=pass; d=google.com; s=arc-20160816; b=dgRCvWBjKY0u4TkYVKXFvbpo80tayu35gp97XUJK2ht+CuC9BYVZZ11PjyTvlx3t8S nAYZKFk+AlKcUr5ZlbdykioLULilh3ShJYIFBYNxZztin010ZqP5eWHpvCvYonlC69P7 ST/B13DmM55b49ZgFwHW7Zdget6p6bJm6ED+D6TsEu7YmSu9i409ZCxr03Hb2Gns6+g6 V7SUK1V+Ap5Z9oh39a5Kh6+kWnM9QMb0YZm0X+cYi5yXLwF8v+/NQEgc+/2DkLgKc9Ng 2oQMgdoCszE2g81lCUzwoUz8CuRO56puSxTQfm/qzLBNq5xRSpQPcIfQ0ncnuS3ByZWV S0kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5Pkv6qlinXe1eOJh8BsuMc+zxZET/h+TOL3hzurhBlY=; fh=OVWHRytJFaPi5Srv6FPaG+0OzUY77ept4AErdF2o8xI=; b=tO2hfuOGiimKv8C72I6o1GbVSmARl7uW197HKgrcry5GHe033nDzkpdc2jr92THEaK ecB+QsZoFQvxKOT6rLjmDg6C41kSkYnLBIDDv+skm4h8wgJVwOFy/AEQf3snw8GNiPWl 9yYIIb58QwjtLcbRw0dsETEm7C9cnoUzj5lqld7dnNm1j02IFA03PFbG3EDDEZMNIdXx pIw7E8C8dVr6t/zJErWij6AaO4euAGOr08N0tka1OtCSWjhm9FOrKaXT+KUbRNadiUmo kToq7ACTogGqZBzKwhx1GNiWc6d28TI1zNxoKumBFksodWWAf95r6OyYglOGxu2B1x3i 2ANg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PIyOpwrC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124387-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p19-20020a63e653000000b005f073cfa44asi3400296pgj.647.2024.03.29.03.27.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 03:27:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PIyOpwrC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124387-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A538283E70 for ; Fri, 29 Mar 2024 10:27:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35E795467B; Fri, 29 Mar 2024 10:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PIyOpwrC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5F3C254662 for ; Fri, 29 Mar 2024 10:27:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711708046; cv=none; b=ja2LkZon99jg5ujVIBRDRW2wRoCPhBq4SSNcyd02a+i5rHaY07nzf+9dxc/zfxDP/fpq36xZl+ipM2ebu23/FZz94IdMEeiW+s4Rka5HmAQ6QaGPqUx09bLPAsSJpHmZmJW+5F1kzweeIdIXlWGpVdtjFrstw1p667/CI3YiaE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711708046; c=relaxed/simple; bh=8xMeaCmofKZN4p34vXY4FFK17GcCRICBaE1lcyCzeBM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cLsvpgR+65eCAlOYn2WKngDSYpsK4UUb38PRIS3mPI45kpQbAURtV+d3mR/NHOy5zhYsXc25LFM2UAJTZCS4y22QvNghAEXAuV3bE9bE5F27bLYpDqGicsjvDJdJuTXlcOxjRkv/PM+txrlypjt3x5Bz2GtCWAHmVNwboHM7rgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PIyOpwrC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D599DC433C7; Fri, 29 Mar 2024 10:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711708046; bh=8xMeaCmofKZN4p34vXY4FFK17GcCRICBaE1lcyCzeBM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=PIyOpwrCPivcOVF6EfUHGrLZj2HiAf2Wi9ge1bXQnB5kBkAOtIFQyxiG5bM6VToQF ny+g2wHOlBFl0qixv6urftD3AHuJp3tvnXCGJfshh9EbiyihhrO9f08e3DcisC0Vpn gwkm8Yfmb3AeAJmu79QCSNaf2PatMbZ7/SD9mnDLYTeXZcEhROsWsCyqDJ4g2BzNwT FtO9RFZQIgH1sn8D6l+t+KOK2a1yWStYkG+xY7vkjO38BvVH4JqWKktkcztTcH/1dq QgJ0TNQgIH8cQsJm9k4KVPvPsqlQYrKwKxCrC0HrPlDRSkTv5JyxmEd/QWF8FXWNa7 sjmzuvCv5fZtg== Message-ID: <9172f17e-deb4-4219-b917-330cdffa5a81@kernel.org> Date: Fri, 29 Mar 2024 18:27:22 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] f2fs: fix 0 addr of multi devices when dio mapping To: Wu Bo , Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Wu Bo References: <20240329065508.2398202-1-bo.wu@vivo.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20240329065508.2398202-1-bo.wu@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/3/29 14:55, Wu Bo wrote: > Consider of a f2fs system with 2 devices: > Info: Device[0] : /dev/block/dm-46 blkaddr = 0--3fffff > Info: Device[1] : /dev/block/dm-47 blkaddr = 400000--67fffff > > f2fs_map_blocks will return logical addr of fs when doing buffered io: > f2fs_map_blocks: dev = (254,46), ino = 40020, file offset = 462865, start blkaddr = 0x400000 > > While dio mapping will return the addr of device: > f2fs_map_blocks: dev = (254,47), ino = 40020, file offset = 462865, start blkaddr = 0x0 > > So the addr=0 is valid when the map.m_bdev is not s_bdev. Thanks for catching this, there is already a formal patch as below link: https://lore.kernel.org/linux-f2fs-devel/20240327074223.2216487-1-chao@kernel.org Thanks, > > Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin") > Signed-off-by: Wu Bo > --- > fs/f2fs/data.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index d9494b5fc7c1..dca3628932c7 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -4185,7 +4185,8 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, > if (WARN_ON_ONCE(map.m_pblk == COMPRESS_ADDR)) > return -EINVAL; > > - if (map.m_pblk != NULL_ADDR) { > + if (map.m_pblk != NULL_ADDR || > + (map.m_multidev_dio && map.m_bdev != inode->i_sb->s_bdev)) { > iomap->length = blks_to_bytes(inode, map.m_len); > iomap->type = IOMAP_MAPPED; > iomap->flags |= IOMAP_F_MERGED;