From nobody Tue Feb 10 03:37:25 2026 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (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 BBA9C32D44F for ; Tue, 21 Oct 2025 10:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761044384; cv=none; b=XJPM0692vTPZ6p8ZmOQqMOSp+ytZD65R9FpdlX/GXgTr3JVBuhzrSY43onaVH1EzvBFK3zKelItGC+ViZO0BJQZKpKhrXw64YbhHO6sI42YbLEXubhGSGGcFwRxA2PReA7hpUzAe2/a0oeoENFYKdoJDm5MbKKZ5UjarHFJI3Pc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761044384; c=relaxed/simple; bh=m7lKZNF6v1JOQns6TrfDyOTVCleCZ4N0YNF027wTilo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PQ1gMxdAxl9pbx7DcE4p+k4tfJP2z3rKsKLKp2UbE67rKx3PklsEwYTfyPHo3oEJLNfWelLnJRvHjXzdYDGeECH2VTIW57IQGe2wJRiCFOK+ijEFzt34WvKBA4zmD/0DcqEQgC0Nk++xOSe+AwcuvqRR7fcFSDlUQpI6S5xUCnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=OL51/MT6; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="OL51/MT6" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=7tLzL1Hn+o30kT4oezlP37EIN8PptJGJl2YdtDGMiFg=; b=OL51/MT6lH4JzPxeE4Ja31IrCJ1JqVY7JIg139eAaBwpCxvYSSs5h1rpm/ITf+iojHnGCp4eB rPFLyv/Y6nbRPZUQ6Qqd78D5H8hV+J3b4DYlmlr7Ss1xFjDSAdzsuL+B5mCkUXBcpXW/2j/xtWr FoGSwycp4DtguNH2SPFgiVs= Received: from mail.maildlp.com (unknown [172.19.162.112]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4crTnW36VmzLlVc; Tue, 21 Oct 2025 18:59:11 +0800 (CST) Received: from kwepemr500015.china.huawei.com (unknown [7.202.195.162]) by mail.maildlp.com (Postfix) with ESMTPS id 6DDE0140155; Tue, 21 Oct 2025 18:59:35 +0800 (CST) Received: from huawei.com (10.67.174.162) by kwepemr500015.china.huawei.com (7.202.195.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 21 Oct 2025 18:59:34 +0800 From: Hongbo Li To: , , , CC: , , Subject: [PATCH RFC v7 7/7] erofs: implement .fadvise for page cache share Date: Tue, 21 Oct 2025 10:48:15 +0000 Message-ID: <20251021104815.70662-8-lihongbo22@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20251021104815.70662-1-lihongbo22@huawei.com> References: <20251021104815.70662-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemr500015.china.huawei.com (7.202.195.162) Content-Type: text/plain; charset="utf-8" From: Hongzhen Luo This patch implements the .fadvise interface for page cache share. Similar to overlayfs, it drops those clean, unused pages through vfs_fadvise(). Signed-off-by: Hongzhen Luo [hongbo: forward port, minor cleanup] Signed-off-by: Hongbo Li --- fs/erofs/ishare.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c index 73432b13bf75..b067f0e02d6c 100644 --- a/fs/erofs/ishare.c +++ b/fs/erofs/ishare.c @@ -228,6 +228,16 @@ static int erofs_ishare_mmap(struct file *file, struct= vm_area_struct *vma) return generic_file_readonly_mmap(file, vma); } =20 +static int erofs_ishare_fadvice(struct file *file, loff_t offset, + loff_t len, int advice) +{ + struct file *realfile =3D file->private_data; + + if (!realfile) + return -EINVAL; + return vfs_fadvise(realfile, offset, len, advice); +} + const struct file_operations erofs_ishare_fops =3D { .open =3D erofs_ishare_file_open, .llseek =3D generic_file_llseek, @@ -236,6 +246,7 @@ const struct file_operations erofs_ishare_fops =3D { .release =3D erofs_ishare_file_release, .get_unmapped_area =3D thp_get_unmapped_area, .splice_read =3D filemap_splice_read, + .fadvise =3D erofs_ishare_fadvice, }; =20 void erofs_read_begin(struct erofs_read_ctx *rdctx) --=20 2.22.0