Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp573470pxb; Thu, 23 Sep 2021 06:28:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDcD8VfCBUeXjwZktN81/AgcKymFkfCsQhF6qbu7iCfhi2u7HXLuQ+df4gDF7qwDm+sdvs X-Received: by 2002:aa7:d796:: with SMTP id s22mr5421264edq.244.1632403720546; Thu, 23 Sep 2021 06:28:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1632403720; cv=pass; d=google.com; s=arc-20160816; b=JNlaXzveMV0lA7ycM9k9VOIZ6SckL4UryfnH3cCC9kG0BVoR5aPf2XQkMHxUCclVPa dVDKoJrq5AjnytZZWK4/3SkrWm1TZjvgq1mrUYhtTmugj6OdCEaPTzYL/+Es6rviwj8l FpqLWV1boIbDSrcqHDUDVI2JCQ0TF6jpuMc3vePQhoC7RqxSuHEyQqTBYZMhnENiUghi /PJxiboj6/hjuNZ2E0vj5lCi+ZveaF66q+TwUJoolBYiJsTXQAvkkownqswCXqAEJlMI Y0w3GIP5FkH7ebVR5aFGZNibg37wmsna72GhKeOZxf7F9I3f5T8aciuQoXFovDMMnBIu tnQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=oiT5pr0K1SzNaD+tk1eXPsdcldxnjdYU+xq7vNjbxmY=; b=U72c7GYQFUCOcpAKrwxblxMlRCJSabLyTWYAqBXyVLJ51hJhMGMX3DZwuPzMOiJQfG UaJnvAeQCZB81pRwBrybBpiTih8fLo9wxx8BNBap7T+hisC4sqvf5zhM3PqpDP8YDMqa p1RI9nrUKnZw17WBhP99ExafIukndzfnx9Ute3NGS2dVlR0TZ9ykMHmuFemPRj2ucBZX kB2DYV8YQle8+t8g+zcVjNRtaBRhlvxykU2AFlj0NUXb03Bsd9jnnl9r2QsuQd4M3YGN 3XxVi7d9Y0IpoXGRqfJRKDiTh4YknhPX0wEV/CYzakkDjndjfME/uRzHE6ybVEtvtq1W BMvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=HHkVZft3; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ar23si6629214ejc.736.2021.09.23.06.28.15; Thu, 23 Sep 2021 06:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=HHkVZft3; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241453AbhIWN0B (ORCPT + 99 others); Thu, 23 Sep 2021 09:26:01 -0400 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17283 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbhIWNZv (ORCPT ); Thu, 23 Sep 2021 09:25:51 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1632402519; cv=none; d=zoho.com.cn; s=zohoarc; b=hcflms2yGXPj40zXwh79bs9B+rZlwAiNHoAiDqeB4kA5p8f5VY28Pp2nyg/53vRHwWM7SfZsc87Nm5OEwvWTqeX7ibL/bYV3V6FsT0LgGNsmLQrPiq6yWye5y5MBU2s+iHPIDT7rypigGbqTkczAIS89q9YoNUiZjxpeE22oRQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1632402519; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=oiT5pr0K1SzNaD+tk1eXPsdcldxnjdYU+xq7vNjbxmY=; b=QYvnxb8rUmPDsebgB8N/Dp0/H2Ln1nV+HF4EVJ5sKBBnAn+rSaHxEGCjm3WoPzsESQ/cYEqiSYR4TO4z7uoCF6s1Mul3kg7AUS7+ezr1kDhk3yvxq1w8rJ1AeBh/rOC9eEa94k/NlhsOlsfhGUIbHmdmEWMsqiAaUIZAbxQE5Ms= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1632402519; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=oiT5pr0K1SzNaD+tk1eXPsdcldxnjdYU+xq7vNjbxmY=; b=HHkVZft3KaPjFQxhfMb9MimXpR/ixs/USm+dwjyN9o90gVKkZQIi9yN3CHGKROpQ xWKvsGFH027LE3F55nu02bb+Xaj+mR+HWpTj/BUCoAYBtLAJ6ymn/EumJ3uk8u3lAxB MWj7zmmv4iPT9gdstaLn8nem+Mx9GjqgkfWFxa2w= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1632402517441659.6191501603354; Thu, 23 Sep 2021 21:08:37 +0800 (CST) From: Chengguang Xu To: miklos@szeredi.hu, jack@suse.cz, amir73il@gmail.com Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, Chengguang Xu Message-ID: <20210923130814.140814-3-cgxu519@mykernel.net> Subject: [RFC PATCH v5 02/10] ovl: implement ->writepages operation Date: Thu, 23 Sep 2021 21:08:06 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210923130814.140814-1-cgxu519@mykernel.net> References: <20210923130814.140814-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement overlayfs' ->writepages operation so that we can sync dirty data/metadata to upper filesystem. Signed-off-by: Chengguang Xu --- fs/overlayfs/inode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 832b17589733..d854e59a3710 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -659,9 +659,22 @@ static const struct inode_operations ovl_special_inode= _operations =3D { =09.update_time=09=3D ovl_update_time, }; =20 +static int ovl_writepages(struct address_space *mapping, +=09=09=09 struct writeback_control *wbc) +{ +=09struct inode *inode =3D mapping->host; +=09struct ovl_fs *ofs =3D inode->i_sb->s_fs_info; +=09struct inode *upper =3D ovl_inode_upper(inode); + +=09if (!ovl_should_sync(ofs)) +=09=09return 0; +=09return filemap_fdatawrite_wbc(upper->i_mapping, wbc); +} + static const struct address_space_operations ovl_aops =3D { =09/* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO */ =09.direct_IO=09=09=3D noop_direct_IO, +=09.writepages=09=09=3D ovl_writepages, }; =20 /* --=20 2.27.0