From patchwork Wed Apr 17 15:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633510 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 D455513DDC1 for ; Wed, 17 Apr 2024 15:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366263; cv=none; b=UGokBuJkDCmgCu9H6l8Mffc5s9WImMAFZsk+yOokngunX5IjzVsTXakasqARgBRT6KAAgurF8wog/libx1OpUOXAQ1XaVJ0Pv8DSWPkGxyuOy68rxgX2KscdpbkLwEZU+5mpGOCJBdYM3GL6RACPdOAZ4x8iyCqaxHlrFu+Mc9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366263; c=relaxed/simple; bh=epxjwHL76sIhbrKLnddXkjY0VrSqyQ6u4j31e1vRqIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GQgIc8gof4dRyR47JlYjbdeG37xxRdYSmrX0Ks5b0E6gMCQvzMZG7gVhgdESm9sxx/i/Tpi3lQILIydiNaCbgVBUfQVoHa/LQRxInW/vWi02d5VWstCW9mNbViTUGILMNB1mUr8KGX6Q347uDK9WqFbz9WCBkcA+kjW8J0oN3pw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GiVaYEtb; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GiVaYEtb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ftRNeaJEfx49awHZ0g/zGxDTKwmCFs9ciDpk78+/9xM=; b=GiVaYEtblVSFwa12A231A1pbog bPh2WVb3bf3k1FAwJI5w/EXdXv1MJk9ExJFBETpibHZb6QKhwQHr+0aXrWiiIA2wl0mc7l2Pfli6j Sjk0EUrT+cl3iVpYze8kCQMwHtNbr64hgkkZOklH+rqAjY+0nOnCNTabur7FJj0sROldE8adiyTld Q5R4q1aqZmgl+MGpq4oOC/Fu++cB6/TMuEazzG1vheMr4Vk9elpB5qcUBD8MHBEsYlmzg8zpzx9Jh QDPatkjil+9fQVGY3LT7WcDVwFstbTLNRLlAeHgJVbjOYgNu/HE5vPhQqcY0ysW1C0Cg1SCePwyp6 q1Dnn4VA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039sX-07yF; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 1/7] udf: Convert udf_symlink_filler() to use a folio Date: Wed, 17 Apr 2024 16:04:07 +0100 Message-ID: <20240417150416.752929-2-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion to struct page and use folio APIs throughout. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/symlink.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index f7eaf7b14594..0105e7e2ba3d 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c @@ -99,18 +99,17 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from, static int udf_symlink_filler(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct buffer_head *bh = NULL; unsigned char *symlink; int err = 0; - unsigned char *p = page_address(page); + unsigned char *p = folio_address(folio); struct udf_inode_info *iinfo = UDF_I(inode); /* We don't support symlinks longer than one block */ if (inode->i_size > inode->i_sb->s_blocksize) { err = -ENAMETOOLONG; - goto out_unlock; + goto out; } if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { @@ -120,24 +119,15 @@ static int udf_symlink_filler(struct file *file, struct folio *folio) if (!bh) { if (!err) err = -EFSCORRUPTED; - goto out_err; + goto out; } symlink = bh->b_data; } err = udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p, PAGE_SIZE); brelse(bh); - if (err) - goto out_err; - - SetPageUptodate(page); - unlock_page(page); - return 0; - -out_err: - SetPageError(page); -out_unlock: - unlock_page(page); +out: + folio_end_read(folio, err == 0); return err; } From patchwork Wed Apr 17 15:04:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633506 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 D45DC146A9C for ; Wed, 17 Apr 2024 15:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366261; cv=none; b=FqIn6JFPL2bexs0NR/dClPC2cQcrfqUA0lbeNMQ6LT+s+joPQOBM2hEPQJbPSaJswR+4sLrk/7lXIg2sJvD/x1Ngy8B5D6bPkNfZ2ZBy+ZXQBSRicM8SdfEeIJQBVnFi/i5cqutcnUHnbI20mu76j0G7SYLSn/2+aU4sZ2abh9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366261; c=relaxed/simple; bh=1/PC5zyu2WViqsl2NNkGD7Losd2xwp3pWm1dJpPlE0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HH2O4jbLOvtAGsOZguu9pakBFSr5jGHzGMGzBCSzwEcPn56XiCFsYOYsBAAZ5STMLfwSRBuW62VIQAsZLrQXcjlZ0adm2KIjVKtQ5vzSr3Oom6OkFoCRyAxO0KS2qIbReoUIyF9QzFsCQ6keCglwn1DPZIt3cXkx6RSSk3zCAUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=K2NzD7uv; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="K2NzD7uv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=87FKHCCGdhxffL/mCXQT5VI1YF9tuBbPEZRsI5Ng4hc=; b=K2NzD7uvOXufhY6p9mhV4PApy0 Afcw80621cQ6g1tG3OOuKVaAN8dueZG69PWl/22T3ZJ/Fl5GCvBJU7z/jmIFNJqDwCHixEgVhJcPc ehk+tmoPUl4GmgvDOjZ+CSEWjVmH5XckzO2uiITztmWW/pcFd/dkpBNSxEo11FO75yptzZljpuOFk gry9/vxhN1M2QDmALPq4K/p/avft5asmlcLSTv5nMxLDB4EOOFBXN4Nk6+ylKzIAqTaHYyaRM/cPk zcWWK3guwUHA9jyfMGrHe1dE3RgwvsubxIxUYUL+mG9annQXjNZVd4OtDHx6QT3dmNTb8QVsRp2hC Mi57aLrg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039sa-0cG5; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 2/7] udf: Convert udf_write_begin() to use a folio Date: Wed, 17 Apr 2024 16:04:08 +0100 Message-ID: <20240417150416.752929-3-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the folio APIs throughout instead of the deprecated page APIs. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/inode.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 2f831a3a91af..5146b9d7aba3 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -254,7 +254,7 @@ static int udf_write_begin(struct file *file, struct address_space *mapping, struct page **pagep, void **fsdata) { struct udf_inode_info *iinfo = UDF_I(file_inode(file)); - struct page *page; + struct folio *folio; int ret; if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { @@ -266,12 +266,13 @@ static int udf_write_begin(struct file *file, struct address_space *mapping, } if (WARN_ON_ONCE(pos >= PAGE_SIZE)) return -EIO; - page = grab_cache_page_write_begin(mapping, 0); - if (!page) - return -ENOMEM; - *pagep = page; - if (!PageUptodate(page)) - udf_adinicb_readpage(page); + folio = __filemap_get_folio(mapping, 0, FGP_WRITEBEGIN, + mapping_gfp_mask(mapping)); + if (IS_ERR(folio)) + return PTR_ERR(folio); + *pagep = &folio->page; + if (!folio_test_uptodate(folio)) + udf_adinicb_readpage(&folio->page); return 0; } From patchwork Wed Apr 17 15:04:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633507 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 D4596146A9A for ; Wed, 17 Apr 2024 15:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; cv=none; b=jpXSXq8a1T8nz3xTTmQ8TyXnXSZJSX1HxiY01S3a7KyVN1HRytCjRhnjAk2oCOh9bYz8W0WkKka7qPq5mBLQZLq1wockAHivW59tUfrQeKYAVA6CZ83htlHnrPbfQh9zqHRHQ/5RJSgzHRyB6ODOw7R9i1/e+ldGtaldhjZxrm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; c=relaxed/simple; bh=FsjzqX+a4HYeyiseOqrJ01AOLc8cwhapu1WucD6kSaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q2kLbmveZ9DpH4v6aEateTh83TSERQoLf6gNcLqLLSQnVyW6ORy3gpcVicGfzyJHa+zkdeX4kbOV1TdmyD00WiDGT63HO9X21tdq/bxnDdZDGHLExkqH8i6dDb1PaLgK0/+moZbSPQQuxt+oJqRSiwsHrJBsM1CFlFB82G20Q/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=KtSc5Fy0; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KtSc5Fy0" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=lQh5a+kJfL+KjL2wabh1P3qwQDd4h6SC46qZPxpB8P0=; b=KtSc5Fy0oawy5NvWFOyigC+sfN oynPjFUF+cLn/Qg8iQYVVX2Lcy1bgvUvQ/vUBi0lN6EcK8nnX/BXzF0iWRvQ8BIAAKdr9gzT873hB w8zZI+wLEM/IVtVq0TBDhuX04D3FZdR9bxEDPmL2YMMLZmsf8V2a+RPFuB13jEzo/QpACxwnm3xrE qRgSPA/MNbis7Ka70/mjmwU9o/T591wjuBxKxmol86YZo5CSAHpsyPwrfdF6iq6hRDX1YPTbt68IF L//Nua9J5zM26XwaybEAcrpYrMBmhnUpxp81sPMMmriEh88VdNOG8gjjWVMj45t1U/gMnErRx+Ekk h07bDkbQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039sj-17M5; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 3/7] udf: Convert udf_expand_file_adinicb() to use a folio Date: Wed, 17 Apr 2024 16:04:09 +0100 Message-ID: <20240417150416.752929-4-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the folio APIs throughout this function. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/inode.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 5146b9d7aba3..59215494e6f6 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -342,7 +342,7 @@ const struct address_space_operations udf_aops = { */ int udf_expand_file_adinicb(struct inode *inode) { - struct page *page; + struct folio *folio; struct udf_inode_info *iinfo = UDF_I(inode); int err; @@ -358,12 +358,13 @@ int udf_expand_file_adinicb(struct inode *inode) return 0; } - page = find_or_create_page(inode->i_mapping, 0, GFP_KERNEL); - if (!page) - return -ENOMEM; + folio = __filemap_get_folio(inode->i_mapping, 0, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, GFP_KERNEL); + if (IS_ERR(folio)) + return PTR_ERR(folio); - if (!PageUptodate(page)) - udf_adinicb_readpage(page); + if (!folio_test_uptodate(folio)) + udf_adinicb_readpage(&folio->page); down_write(&iinfo->i_data_sem); memset(iinfo->i_data + iinfo->i_lenEAttr, 0x00, iinfo->i_lenAlloc); @@ -372,22 +373,22 @@ int udf_expand_file_adinicb(struct inode *inode) iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; else iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; - set_page_dirty(page); - unlock_page(page); + folio_mark_dirty(folio); + folio_unlock(folio); up_write(&iinfo->i_data_sem); err = filemap_fdatawrite(inode->i_mapping); if (err) { /* Restore everything back so that we don't lose data... */ - lock_page(page); + folio_lock(folio); down_write(&iinfo->i_data_sem); - memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr, - inode->i_size); - unlock_page(page); + memcpy_from_folio(iinfo->i_data + iinfo->i_lenEAttr, + folio, 0, inode->i_size); + folio_unlock(folio); iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; iinfo->i_lenAlloc = inode->i_size; up_write(&iinfo->i_data_sem); } - put_page(page); + folio_put(folio); mark_inode_dirty(inode); return err; From patchwork Wed Apr 17 15:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633509 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 52953146A9E for ; Wed, 17 Apr 2024 15:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; cv=none; b=ufYgYtngrBPI/jT+/BBr2PNStCZ9184D++bft1HemGmyGrI2xYMytPrXKxbtcqhIjPc0kzi4Bgoo71UCw7euqRhNF/qeueYnrWAp7uXohuKQomKfYh6CLKuZg1OAmYSrHoOfg+CfDg81Rfco+FoqreoBtNRcHxAkS+QBGWQggvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; c=relaxed/simple; bh=7O0u5lB+BmlszWBGnHO/LsZjCsJNEOZv+Oo0NZvOvuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SbmKpR7+3aeCeY6aHv4mACb9BcqwDPGbPMvaaRJx1YMqL3QBanpOmkxDLohyby2NwyKXF/FVcLjkjjo6rhDTzP8mTchOJHHY8ZTQ03NuUWjc/6yTWbmtcR/gWqjkJGxglBinfvLp0f7O8v/Zj5N7LH4WtO6dQDdP0NuPv8oOLB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=cxPKqzo/; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cxPKqzo/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=0o+p509pKU2i7VIZ+04GOQ1tLaLmzCNckDGYLl7pmZs=; b=cxPKqzo/+sQOaHo3GBHlQZBSR4 It5ICjihkJSAa00dQaIpDidALWqN3A+zpHjb77XwTZJpL0LmPFpDqjApTUfQUXvrtldhkRLJiy6uj azsfQp0xGuL4jq9vOfUqXBsYYBxrnendf884IzrUztIDX5K2qr2PqiIsWqAMvLuxUeVB/7O9qkZvf wGR1jbhOALsunI80Yb9D0dCRiBOxmCpiax+gZKANTHE149+yRn+TM7kQiaYeYP1m7V82Aj05vI7o1 4KUsyUediumsbUv8ylUHgxAwtxALn7OypKH/vP7rKjafj8OSqTyQwr9gqQ8Ii2gVzUkcfuuvdG/G+ Fdb13ykg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039sp-1c44; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 4/7] udf: Convert udf_adinicb_readpage() to udf_adinicb_read_folio() Date: Wed, 17 Apr 2024 16:04:10 +0100 Message-ID: <20240417150416.752929-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that all three callers have a folio, convert this function to take a folio, and use the folio APIs. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/inode.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 59215494e6f6..d34562156522 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -208,19 +208,14 @@ static int udf_writepages(struct address_space *mapping, return write_cache_pages(mapping, wbc, udf_adinicb_writepage, NULL); } -static void udf_adinicb_readpage(struct page *page) +static void udf_adinicb_read_folio(struct folio *folio) { - struct inode *inode = page->mapping->host; - char *kaddr; + struct inode *inode = folio->mapping->host; struct udf_inode_info *iinfo = UDF_I(inode); loff_t isize = i_size_read(inode); - kaddr = kmap_local_page(page); - memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize); - memset(kaddr + isize, 0, PAGE_SIZE - isize); - flush_dcache_page(page); - SetPageUptodate(page); - kunmap_local(kaddr); + folio_fill_tail(folio, 0, iinfo->i_data + iinfo->i_lenEAttr, isize); + folio_mark_uptodate(folio); } static int udf_read_folio(struct file *file, struct folio *folio) @@ -228,7 +223,7 @@ static int udf_read_folio(struct file *file, struct folio *folio) struct udf_inode_info *iinfo = UDF_I(file_inode(file)); if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { - udf_adinicb_readpage(&folio->page); + udf_adinicb_read_folio(folio); folio_unlock(folio); return 0; } @@ -272,7 +267,7 @@ static int udf_write_begin(struct file *file, struct address_space *mapping, return PTR_ERR(folio); *pagep = &folio->page; if (!folio_test_uptodate(folio)) - udf_adinicb_readpage(&folio->page); + udf_adinicb_read_folio(folio); return 0; } @@ -364,7 +359,7 @@ int udf_expand_file_adinicb(struct inode *inode) return PTR_ERR(folio); if (!folio_test_uptodate(folio)) - udf_adinicb_readpage(&folio->page); + udf_adinicb_read_folio(folio); down_write(&iinfo->i_data_sem); memset(iinfo->i_data + iinfo->i_lenEAttr, 0x00, iinfo->i_lenAlloc); From patchwork Wed Apr 17 15:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633512 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 5592E146D41 for ; Wed, 17 Apr 2024 15:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366265; cv=none; b=AdkrA+qtsD1yhYPPNhTWP6v2EJvedHj7TT6w5It/o0qbo3dLrJkl1X2WHO7IfzyIBdPZ7Z4YngtGdze9aBsGHvLiSWC1yd41Y4ZCQOx/PyfGHNdQyozBn8JLADbF1duJbwQ3zL9USi0e3QYOfO447uFHMJW7O0sziL4MhhZbIN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366265; c=relaxed/simple; bh=Gw7OnBH2/oRSRi2jh77j+Are39dCP5m7V6ZD88+U5gY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CMkOJFszKkCVE2Egl3cuVa8Og9kBceQVGck4IVa4LU6kwk3lmgUlwBva8e3bwB55NVPVMac7/dMFZHWVY2dSq1QO2I3zszRZITLLr16+iM8tWugyWnzO1znQEEoYawBlMDqoFJJX0QBcEeJ/Q8e+zuZvxari/PQcLYw5810HI8k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=R7aOuWCC; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="R7aOuWCC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=abJreXktpiF5PI7nmRuI16aBaDcs1cBZcegeYCHMuLI=; b=R7aOuWCCDHQUGWsIgDMgMXh9yF J9V5Nokd7a1DyeXtDPcRSongN4JxFKb4oOiyv6E7+YMD7sy+SwRJwciEgahaHILJPbpVtFVBuHenN lVoNinKzvxpEXtRjSOgxccrrMxx4DN/sGRf4CHL3rvWDbGQuW8T5RSLMVtlK384rWsplMkIf9HAjt C4EswqtXL0HGq6GztHMTfdIxLuhGnFChypHVfO3yh0U+mQ14/ecSdM3FzlKyoqLYYwYJr/sZ0UAs6 nuXQgy0PCCAaBI14kzh/jUzfe+oSeiSsXFIINLhynSandoHyIYSpTEvYw5V4FMhQHJ14V3voz53zs gUFuQk3Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039sv-266E; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 5/7] udf: Convert udf_symlink_getattr() to use a folio Date: Wed, 17 Apr 2024 16:04:11 +0100 Message-ID: <20240417150416.752929-6-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We're getting this from the page cache, so it's definitely a folio. Saves a call to compound_head() hidden in put_page(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/symlink.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index 0105e7e2ba3d..fe03745d09b1 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c @@ -137,12 +137,12 @@ static int udf_symlink_getattr(struct mnt_idmap *idmap, { struct dentry *dentry = path->dentry; struct inode *inode = d_backing_inode(dentry); - struct page *page; + struct folio *folio; generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); - page = read_mapping_page(inode->i_mapping, 0, NULL); - if (IS_ERR(page)) - return PTR_ERR(page); + folio = read_mapping_folio(inode->i_mapping, 0, NULL); + if (IS_ERR(folio)) + return PTR_ERR(folio); /* * UDF uses non-trivial encoding of symlinks so i_size does not match * number of characters reported by readlink(2) which apparently some @@ -152,8 +152,8 @@ static int udf_symlink_getattr(struct mnt_idmap *idmap, * let's report the length of string returned by readlink(2) for * st_size. */ - stat->size = strlen(page_address(page)); - put_page(page); + stat->size = strlen(folio_address(folio)); + folio_put(folio); return 0; } From patchwork Wed Apr 17 15:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633508 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 529FF146D40 for ; Wed, 17 Apr 2024 15:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; cv=none; b=qaEb51ux8/PXk3pOzxzCK79el9AuWvAF8TPQhsPgEP4+SxIz1/ZCGj1siS1MBhwm+DCmoofMg7QB5Z+gOymC3bsJgFgWzrfI09Q5hZ+xdk2AG4a5f5iG22tZxfv+yAqJ3LWZ7v/H4apNhlS3sjTSgzja+eG6mW1/FsoAf6oLlfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366262; c=relaxed/simple; bh=CKnFD4W3HDhCyIRZ0petwnRRfYgEsVpZNgTNAZ3PHXA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sfCeamgQy8o+6/2xR/iQpcHTW+y06BdGfJehLyVpi63/VaqgjgnHTGFDPyMbktcY2Zr0wh54aptdbLzTq87YdnjAIJLWTqnWiDma/8I/VDlEkB/tI/Gg3rAPp64c2fxLibs+O5wfzlqWPDgLTOAM6Lo6j5a2lfWXrbI4/iUheeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=AncebMGz; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AncebMGz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=5exut3IUoYS+5VCh4E/3WqH0HK1vj6xrm96VSe/1PFM=; b=AncebMGzDAN0LyVTM9cEp2aVJT lzatPHQcBkQ/4YE9540FOjnyQ9kwU5Xyfy3UPQjbtvSjWrPSmAGmzDACZycukTsSWhEqlOcYlIQMn eEqC/kn09JXBywG45WLt5njWgGk/42Xhtd1YJ7pBIBaFv2YcOlsH7OiFeiEKJew6kOF9swDIr9ak5 qgRSqTkmgnODhw7d7fsH74pNS8JFIHkj42jud5Hr8FZnZqiRJT4BZxZUl65CHMIZsqZmz1RbDYPpo y5cfX+Y3DwWm81ALjaYMQrIfG4ewubKN2ASO+zalt5PrNjY7Joj6QU0yV5jaV5IDlPXzeP7eHFgKa NDQmzACg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039t1-2erw; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 6/7] udf: Convert udf_page_mkwrite() to use a folio Date: Wed, 17 Apr 2024 16:04:12 +0100 Message-ID: <20240417150416.752929-7-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert the vm_fault page to a folio, then use it throughout. Replaces five calls to compound_head() with one. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/file.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/udf/file.c b/fs/udf/file.c index 0ceac4b5937c..97c59585208c 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -39,7 +39,7 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf) struct vm_area_struct *vma = vmf->vma; struct inode *inode = file_inode(vma->vm_file); struct address_space *mapping = inode->i_mapping; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); loff_t size; unsigned int end; vm_fault_t ret = VM_FAULT_LOCKED; @@ -48,31 +48,31 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf) sb_start_pagefault(inode->i_sb); file_update_time(vma->vm_file); filemap_invalidate_lock_shared(mapping); - lock_page(page); + folio_lock(folio); size = i_size_read(inode); - if (page->mapping != inode->i_mapping || page_offset(page) >= size) { - unlock_page(page); + if (folio->mapping != inode->i_mapping || folio_pos(folio) >= size) { + folio_unlock(folio); ret = VM_FAULT_NOPAGE; goto out_unlock; } /* Space is already allocated for in-ICB file */ if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) goto out_dirty; - if (page->index == size >> PAGE_SHIFT) + if (folio->index == size >> PAGE_SHIFT) end = size & ~PAGE_MASK; else end = PAGE_SIZE; - err = __block_write_begin(page, 0, end, udf_get_block); + err = __block_write_begin(&folio->page, 0, end, udf_get_block); if (err) { - unlock_page(page); + folio_unlock(folio); ret = vmf_fs_error(err); goto out_unlock; } - block_commit_write(page, 0, end); + block_commit_write(&folio->page, 0, end); out_dirty: - set_page_dirty(page); - wait_for_stable_page(page); + folio_mark_dirty(folio); + folio_wait_stable(folio); out_unlock: filemap_invalidate_unlock_shared(mapping); sb_end_pagefault(inode->i_sb); From patchwork Wed Apr 17 15:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13633511 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 529A0146A9F for ; Wed, 17 Apr 2024 15:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366264; cv=none; b=UeQsEUEuqLZrFRoPhVJQrmfqyF942qT0kmdzsuXPGkMf2DiRXweH+s9w0aC7cx0MueEmTZn1WtsatjYFzmc8NbSy9avjgic3nluox8w0yGIE/6ZpBolrn8jOVnt+esILvxTQRWjawfmv3z6Qv0HyjveO23wwEshuQmKkcyjrtxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366264; c=relaxed/simple; bh=HVWsxR2Un2M5Z5ebwBlh8hoXkg2xrCwmeygtf0PH4Ag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VsXIouOJ4enCDzbTkkbBJP95m9uBZp7Zcv+u/zl+XF+ZMUrCEYa3/az4Phzyc2kshr62t24I7x3ubIwj9K49pZDIJh8T2xdTObK9rWFFZynTE+Jv7oC6i76VlKf7s2W5eTuZ9uZVG02RSjU2THYqx+zV3tLOSlHHnfuzGNSeKeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=lednZond; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lednZond" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=atvJsVViKIgijLIaxFyBy0beNeCZrTimkQEKk/ptVdQ=; b=lednZondKJpU39cOmQjS249Y4u mFoqRPM+oV/6Lu51O/haUPli/kB2gT4pFR1afS5A/iaRpQjA2cYxr345s/+XlMtmG73I+8DMVtA5n qSEcBxDj/ir9x/FOXWtGv4AO60u/4/01wsWrMtsP/NGG5KyngOgeN383xYPx22NRovmAsMb7J2ZaM hw5Z0dyfolao03QYGVSm4Mvmq3RXI/RfL1xlJK/s3Nd8ab7znaiCP8g9+ufroZ5pF8ERLVWI2UYXV /qIZ0ehxInb71zMTZYkBnb0J9UYXsStFBh4WXUqGJOP6ec1Bm7OTKE59KoDx+pMVCswfMhAa8oICD hlylBaMg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx6pe-000000039t8-3CD4; Wed, 17 Apr 2024 15:04:18 +0000 From: "Matthew Wilcox (Oracle)" To: Jan Kara Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 7/7] udf: Use a folio in udf_write_end() Date: Wed, 17 Apr 2024 16:04:13 +0100 Message-ID: <20240417150416.752929-8-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417150416.752929-1-willy@infradead.org> References: <20240417150416.752929-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert the page to a folio and use the folio APIs. Replaces three calls to compound_head() with one. Signed-off-by: Matthew Wilcox (Oracle) --- fs/udf/inode.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index d34562156522..2fb21c5ffccf 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -276,17 +276,19 @@ static int udf_write_end(struct file *file, struct address_space *mapping, struct page *page, void *fsdata) { struct inode *inode = file_inode(file); + struct folio *folio; loff_t last_pos; if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) return generic_write_end(file, mapping, pos, len, copied, page, fsdata); + folio = page_folio(page); last_pos = pos + copied; if (last_pos > inode->i_size) i_size_write(inode, last_pos); - set_page_dirty(page); - unlock_page(page); - put_page(page); + folio_mark_dirty(folio); + folio_unlock(folio); + folio_put(folio); return copied; }