Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B3F1C3803D7; Thu, 20 Aug 2026 17:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247655; cv=none; b=hUdYn1ThZ8kAxIVW//dymV7YO7BQB3pld9u4mgOYEFJgTvo7LVJvZiwlOIoxjM05CwUByutH+D6jjoyyCvRYUs/fMf0gmL/AqwR/v8ldZLtbpQSEaIeZdL3bV6N6GVXO2/rASYCIUIds1eBob6ft0KyPcMwdY0SWdKIoE3vKSkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247655; c=relaxed/simple; bh=xhPv7LfnGwlB1N5LwUjlk+y3yGK6ynlqCWraw8d2EqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ekuztQ6vc+j02RzfR8aD89siylBzYtAVhrPoGxKyluFyFkz3kJIQ82aYKtfxGidJC3l92Uw1YyJVax8dpjmX33U+O4dIQWU8IZR377OT/oyog8DAc6ze6YOA01KQGXZdHWh2AQKQ1mSBT54HLZO7+CjCnJLaYv5tPSz6SnmP864= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UeImhQf+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UeImhQf+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E0351F000E9; Thu, 20 Aug 2026 17:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787247654; bh=tolN5kNiIU0BO7xzwbbq3AbBOkIiCYjiYkHYAwpHn6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UeImhQf+J4NExkZne54tXzr+Xx4BN/9F38WV0EWUtaZdqtGpqIS1WP6De9XH6JAnJ ArQrjIFEmBsjIbjwtK50XvXJll4LTsleOKqcc5pfvrmkacS2GLCrRH7berPUzPs6u/ KRSq6FS++N4MiIOsnFbz8HysQaBjHods7LO5I2Pk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Matthew Wilcox (Oracle)" , Viacheslav Dubeyko , Christian Brauner , Sasha Levin Subject: [PATCH 6.6 073/166] ceph: Use a folio in ceph_page_mkwrite() Date: Thu, 20 Aug 2026 16:55:32 +0200 Message-ID: <20260820145213.339628805@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145211.194104353@linuxfoundation.org> References: <20260820145211.194104353@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Matthew Wilcox (Oracle)" [ Upstream commit 88a59bda3f3786107694a3f5fd7f9df421752c21 ] Convert the passed page to a folio and use it throughout ceph_page_mkwrite(). Removes the last call to page_mkwrite_check_truncate(), the last call to offset_in_thp() and one of the last calls to thp_size(). Saves a few calls to compound_head(). Signed-off-by: "Matthew Wilcox (Oracle)" Link: https://lore.kernel.org/r/20250217185119.430193-3-willy@infradead.org Tested-by: Viacheslav Dubeyko Reviewed-by: Viacheslav Dubeyko Signed-off-by: Christian Brauner Stable-dep-of: cbf59617cd71 ("ceph: fix writeback_count leak in write_folio_nounlock()") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/ceph/addr.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1684,8 +1684,8 @@ static vm_fault_t ceph_page_mkwrite(stru struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_file_info *fi = vma->vm_file->private_data; struct ceph_cap_flush *prealloc_cf; - struct page *page = vmf->page; - loff_t off = page_offset(page); + struct folio *folio = page_folio(vmf->page); + loff_t off = folio_pos(folio); loff_t size = i_size_read(inode); size_t len; int want, got, err; @@ -1702,10 +1702,10 @@ static vm_fault_t ceph_page_mkwrite(stru sb_start_pagefault(inode->i_sb); ceph_block_sigs(&oldset); - if (off + thp_size(page) <= size) - len = thp_size(page); + if (off + folio_size(folio) <= size) + len = folio_size(folio); else - len = offset_in_thp(page, size); + len = offset_in_folio(folio, size); doutc(cl, "%llx.%llx %llu~%zd getting caps i_size %llu\n", ceph_vinop(inode), off, len, size); @@ -1722,30 +1722,30 @@ static vm_fault_t ceph_page_mkwrite(stru doutc(cl, "%llx.%llx %llu~%zd got cap refs on %s\n", ceph_vinop(inode), off, len, ceph_cap_string(got)); - /* Update time before taking page lock */ + /* Update time before taking folio lock */ file_update_time(vma->vm_file); inode_inc_iversion_raw(inode); do { struct ceph_snap_context *snapc; - lock_page(page); + folio_lock(folio); - if (page_mkwrite_check_truncate(page, inode) < 0) { - unlock_page(page); + if (folio_mkwrite_check_truncate(folio, inode) < 0) { + folio_unlock(folio); ret = VM_FAULT_NOPAGE; break; } - snapc = ceph_find_incompatible(page); + snapc = ceph_find_incompatible(&folio->page); if (!snapc) { - /* success. we'll keep the page locked. */ - set_page_dirty(page); + /* success. we'll keep the folio locked. */ + folio_mark_dirty(folio); ret = VM_FAULT_LOCKED; break; } - unlock_page(page); + folio_unlock(folio); if (IS_ERR(snapc)) { ret = VM_FAULT_SIGBUS;