From patchwork Wed Jul 10 01:23:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728776 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 383E3B663 for ; Wed, 10 Jul 2024 01:23:36 +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=1720574617; cv=none; b=sgq1QzmUv8vpAEtnkkPArnk8zpe3ORv6UVwcE8bUgIaUskDCv8LKtJ4Jax8TisO7+UkakLZJdotafwjc8i+4T9eLPtYFNSgrn2/TC8f5nsk1bnROTXIX9I9jFR6AbYaJSms6DpqK95FannFMnFV8eVT3nLaUcyNP/J8ohCqwx/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574617; c=relaxed/simple; bh=NivbZcmLgMpmzujOxK6y9Pe4yDRdjDLGJyA1fFQl4gg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y8QkRIEE2OhDYRwGvb/xFm2789zoIDJ/LY8yo1nge24QtI0fsqda7H6M2LqxXb9FJCRCwCu34xnPodBPj6VmJW0CcUO45S3F0twMFbquWch/w2oPr/kI/Ei41Qbvx6wc/QBAUbK3LrTWcj10WEzNSImhXqrBfF6xaP8SjjEgLOI= 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=nOC/WZjK; 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="nOC/WZjK" 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=VFllkMF1W9oko966gGZClOgAWQwliQxlwFZLV1nQGFw=; b=nOC/WZjKpNERhcqI8OgEZCK6Wj urEujYjSOYAuyVCRDSYiHJsJxsnxRC6cOLwUryMtxbhHcLaR8SJHpVJeNLHpIb/x40HYPxV0ZEXDX SDve/QLN6lS5Y7/ZwA/xJHQtjnnLaCZTMDBWm03eLQObmpkMzbc3PL2NME82M82xsLDCfqw44ZUEG IVTFzDePxqxM2+AyfRCHGIRmnXEfA5gvxJGZGBEWo8i07WY12DrBElP8ZescaTJcHIgKFjXI8kcxD RTaEDUfyB+Evem5/eFP6ugfpW/oYqjpLjSbwlqC50WFLAVbS38uw+R6e2+xmwX+OH2VW3wa8Eipm5 V6mXk6cA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008YZy-1oIi; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 1/7] minixfs: Convert dir_get_page() to dir_get_folio() Date: Wed, 10 Jul 2024 02:23:15 +0100 Message-ID: <20240710012323.2039519-2-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-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 a few conversions between page and folio. Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index a224cf222570..41e6c0c2e243 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -64,14 +64,15 @@ static int minix_handle_dirsync(struct inode *dir) return err; } -static void *dir_get_page(struct inode *dir, unsigned long n, struct page **p) +static void *dir_get_folio(struct inode *dir, unsigned long n, + struct folio **foliop) { - struct address_space *mapping = dir->i_mapping; - struct page *page = read_mapping_page(mapping, n, NULL); - if (IS_ERR(page)) - return ERR_CAST(page); - *p = page; - return kmap_local_page(page); + struct folio *folio = read_mapping_folio(dir->i_mapping, n, NULL); + + if (IS_ERR(folio)) + return ERR_CAST(folio); + *foliop = folio; + return kmap_local_folio(folio, 0); } static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi) @@ -99,9 +100,9 @@ static int minix_readdir(struct file *file, struct dir_context *ctx) for ( ; n < npages; n++, offset = 0) { char *p, *kaddr, *limit; - struct page *page; + struct folio *folio; - kaddr = dir_get_page(inode, n, &page); + kaddr = dir_get_folio(inode, n, &folio); if (IS_ERR(kaddr)) continue; p = kaddr+offset; @@ -122,13 +123,13 @@ static int minix_readdir(struct file *file, struct dir_context *ctx) unsigned l = strnlen(name, sbi->s_namelen); if (!dir_emit(ctx, name, l, inumber, DT_UNKNOWN)) { - unmap_and_put_page(page, p); + folio_release_kmap(folio, p); return 0; } } ctx->pos += chunk_size; } - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); } return 0; } @@ -158,7 +159,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) struct minix_sb_info * sbi = minix_sb(sb); unsigned long n; unsigned long npages = dir_pages(dir); - struct page *page = NULL; + struct folio *folio = NULL; char *p; char *namx; @@ -168,7 +169,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) for (n = 0; n < npages; n++) { char *kaddr, *limit; - kaddr = dir_get_page(dir, n, &page); + kaddr = dir_get_folio(dir, n, &folio); if (IS_ERR(kaddr)) continue; @@ -188,12 +189,12 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) if (namecompare(namelen, sbi->s_namelen, name, namx)) goto found; } - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); } return NULL; found: - *res_page = page; + *res_page = &folio->page; return (minix_dirent *)p; } @@ -204,7 +205,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) int namelen = dentry->d_name.len; struct super_block * sb = dir->i_sb; struct minix_sb_info * sbi = minix_sb(sb); - struct page *page = NULL; + struct folio *folio = NULL; unsigned long npages = dir_pages(dir); unsigned long n; char *kaddr, *p; @@ -223,10 +224,10 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) for (n = 0; n <= npages; n++) { char *limit, *dir_end; - kaddr = dir_get_page(dir, n, &page); + kaddr = dir_get_folio(dir, n, &folio); if (IS_ERR(kaddr)) return PTR_ERR(kaddr); - lock_page(page); + folio_lock(folio); dir_end = kaddr + minix_last_byte(dir, n); limit = kaddr + PAGE_SIZE - sbi->s_dirsize; for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) { @@ -253,15 +254,15 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) if (namecompare(namelen, sbi->s_namelen, name, namx)) goto out_unlock; } - unlock_page(page); - unmap_and_put_page(page, kaddr); + folio_unlock(folio); + folio_release_kmap(folio, kaddr); } BUG(); return -EINVAL; got_it: - pos = page_offset(page) + offset_in_page(p); - err = minix_prepare_chunk(page, pos, sbi->s_dirsize); + pos = folio_pos(folio) + offset_in_folio(folio, p); + err = minix_prepare_chunk(&folio->page, pos, sbi->s_dirsize); if (err) goto out_unlock; memcpy (namx, name, namelen); @@ -272,15 +273,15 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) memset (namx + namelen, 0, sbi->s_dirsize - namelen - 2); de->inode = inode->i_ino; } - dir_commit_chunk(page, pos, sbi->s_dirsize); + dir_commit_chunk(&folio->page, pos, sbi->s_dirsize); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); mark_inode_dirty(dir); err = minix_handle_dirsync(dir); out_put: - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); return err; out_unlock: - unlock_page(page); + folio_unlock(folio); goto out_put; } @@ -357,7 +358,7 @@ int minix_make_empty(struct inode *inode, struct inode *dir) */ int minix_empty_dir(struct inode * inode) { - struct page *page = NULL; + struct folio *folio = NULL; unsigned long i, npages = dir_pages(inode); struct minix_sb_info *sbi = minix_sb(inode->i_sb); char *name, *kaddr; @@ -366,7 +367,7 @@ int minix_empty_dir(struct inode * inode) for (i = 0; i < npages; i++) { char *p, *limit; - kaddr = dir_get_page(inode, i, &page); + kaddr = dir_get_folio(inode, i, &folio); if (IS_ERR(kaddr)) continue; @@ -395,12 +396,12 @@ int minix_empty_dir(struct inode * inode) goto not_empty; } } - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); } return 1; not_empty: - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); return 0; } @@ -431,11 +432,14 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page, struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p) { + struct folio *folio; struct minix_sb_info *sbi = minix_sb(dir->i_sb); - struct minix_dir_entry *de = dir_get_page(dir, 0, p); + struct minix_dir_entry *de = dir_get_folio(dir, 0, &folio); - if (!IS_ERR(de)) + if (!IS_ERR(de)) { + *p = &folio->page; return minix_next_entry(de, sbi); + } return NULL; } From patchwork Wed Jul 10 01:23:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728774 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 6B50C79C0 for ; Wed, 10 Jul 2024 01:23:30 +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=1720574611; cv=none; b=My1Nyty2aob3vzs/N3Sm/wadH0eGNIi4A7BMK2t6f1Uutv0ORc1HxmJD9eVaUjTCmOCyuuKepV3NpyOqfTtJT6A0mq3BKG+38Tb9CE5o41QiL7OHHi5udx4gognf5fLMXn2iUbdgNz1XwXw2v5q1UDl+rjtR2q6Tge9dFIMis+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574611; c=relaxed/simple; bh=gUTx3L7j0mxdzjFHXXTjqcqGJ+9PXUPMqj94Q350TfA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jlnKDxQD//vn6ga0QTlfZBVFD4ouUhQYVOUW41kSfJT+Oi/HrN5U7/mOOk28PL9ZMbr052UbMCKRmMimOvBAi1gr7YbJ/ZV6BeQ8XFUEUpOBBEo3ka55PPtXapcRCk8qTA96qhhYZTAxpcQ2XFLYOwraWpKYc+6tnNr9P3NEmyQ= 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=ZqHjM3Of; 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="ZqHjM3Of" 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=tQT2phDWusyoq7TdZJ5e81MyD1YuneUr3UVIvKIUcWc=; b=ZqHjM3OfsY3HdY/nwu89hccA62 znJLWBHFGaoAuU2Le4LYxmK6IouKg6obHxRBxrv34yCPLGp9uaTqPZjnwRD9kChOwRMc90F8gkIsD 1veoNENiGosy38y9A9/CO5GAOHI0XBndmHOP/uG5ObO48HOlL9NwsdUI/348DRys0H2E3+JeE2RC4 MFb8niaNae3DwRiv3fUw+YrCvO2Bm0tIf8VXv/DbjnlWNkqsd6zkCtn0xR8BtPXK+rHTUjG6HWkdE qrCANEqInbcg0D//W+D8VFAwNb5VBmy9YolYBIobRYcQKPdlGqEktkaKdDfUM6PNODNP0Xmna1QRu sYzEU9pA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008Ya0-2Cdi; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 2/7] minixfs: Convert minix_find_entry() to take a folio Date: Wed, 10 Jul 2024 02:23:16 +0100 Message-ID: <20240710012323.2039519-3-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-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 a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 25 +++++++++++-------------- fs/minix/minix.h | 14 +++++++------- fs/minix/namei.c | 25 ++++++++++++------------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 41e6c0c2e243..3bbfac32d520 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -145,12 +145,13 @@ static inline int namecompare(int len, int maxlen, /* * minix_find_entry() * - * finds an entry in the specified directory with the wanted name. It - * returns the cache buffer in which the entry was found, and the entry - * itself (as a parameter - res_dir). It does NOT read the inode of the + * finds an entry in the specified directory with the wanted name. + * It does NOT read the inode of the * entry - you'll have to do that yourself if you want to. + * + * On Success folio_release_kmap() should be called on *foliop. */ -minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) +minix_dirent *minix_find_entry(struct dentry *dentry, struct folio **foliop) { const char * name = dentry->d_name.name; int namelen = dentry->d_name.len; @@ -159,17 +160,15 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) struct minix_sb_info * sbi = minix_sb(sb); unsigned long n; unsigned long npages = dir_pages(dir); - struct folio *folio = NULL; char *p; char *namx; __u32 inumber; - *res_page = NULL; for (n = 0; n < npages; n++) { char *kaddr, *limit; - kaddr = dir_get_folio(dir, n, &folio); + kaddr = dir_get_folio(dir, n, foliop); if (IS_ERR(kaddr)) continue; @@ -189,12 +188,11 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) if (namecompare(namelen, sbi->s_namelen, name, namx)) goto found; } - folio_release_kmap(folio, kaddr); + folio_release_kmap(*foliop, kaddr); } return NULL; found: - *res_page = &folio->page; return (minix_dirent *)p; } @@ -445,20 +443,19 @@ struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p) ino_t minix_inode_by_name(struct dentry *dentry) { - struct page *page; - struct minix_dir_entry *de = minix_find_entry(dentry, &page); + struct folio *folio; + struct minix_dir_entry *de = minix_find_entry(dentry, &folio); ino_t res = 0; if (de) { - struct address_space *mapping = page->mapping; - struct inode *inode = mapping->host; + struct inode *inode = folio->mapping->host; struct minix_sb_info *sbi = minix_sb(inode->i_sb); if (sbi->s_version == MINIX_V3) res = ((minix3_dirent *) de)->inode; else res = de->inode; - unmap_and_put_page(page, de); + folio_release_kmap(folio, de); } return res; } diff --git a/fs/minix/minix.h b/fs/minix/minix.h index d493507c064f..a290dd483e69 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -64,15 +64,15 @@ extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int); extern unsigned V1_minix_blocks(loff_t, struct super_block *); extern unsigned V2_minix_blocks(loff_t, struct super_block *); -extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**); -extern int minix_add_link(struct dentry*, struct inode*); -extern int minix_delete_entry(struct minix_dir_entry*, struct page*); -extern int minix_make_empty(struct inode*, struct inode*); -extern int minix_empty_dir(struct inode*); +struct minix_dir_entry *minix_find_entry(struct dentry *, struct folio **); +int minix_add_link(struct dentry*, struct inode*); +int minix_delete_entry(struct minix_dir_entry*, struct page*); +int minix_make_empty(struct inode*, struct inode*); +int minix_empty_dir(struct inode*); int minix_set_link(struct minix_dir_entry *de, struct page *page, struct inode *inode); -extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); -extern ino_t minix_inode_by_name(struct dentry*); +struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); +ino_t minix_inode_by_name(struct dentry*); extern const struct inode_operations minix_file_inode_operations; extern const struct inode_operations minix_dir_inode_operations; diff --git a/fs/minix/namei.c b/fs/minix/namei.c index d6031acc34f0..117264877bd7 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -141,15 +141,15 @@ static int minix_mkdir(struct mnt_idmap *idmap, struct inode *dir, static int minix_unlink(struct inode * dir, struct dentry *dentry) { struct inode * inode = d_inode(dentry); - struct page * page; + struct folio *folio; struct minix_dir_entry * de; int err; - de = minix_find_entry(dentry, &page); + de = minix_find_entry(dentry, &folio); if (!de) return -ENOENT; - err = minix_delete_entry(de, page); - unmap_and_put_page(page, de); + err = minix_delete_entry(de, &folio->page); + folio_release_kmap(folio, de); if (err) return err; @@ -182,14 +182,14 @@ static int minix_rename(struct mnt_idmap *idmap, struct inode * new_inode = d_inode(new_dentry); struct page * dir_page = NULL; struct minix_dir_entry * dir_de = NULL; - struct page * old_page; + struct folio *old_folio; struct minix_dir_entry * old_de; int err = -ENOENT; if (flags & ~RENAME_NOREPLACE) return -EINVAL; - old_de = minix_find_entry(old_dentry, &old_page); + old_de = minix_find_entry(old_dentry, &old_folio); if (!old_de) goto out; @@ -201,7 +201,7 @@ static int minix_rename(struct mnt_idmap *idmap, } if (new_inode) { - struct page * new_page; + struct folio *new_folio; struct minix_dir_entry * new_de; err = -ENOTEMPTY; @@ -209,12 +209,11 @@ static int minix_rename(struct mnt_idmap *idmap, goto out_dir; err = -ENOENT; - new_de = minix_find_entry(new_dentry, &new_page); + new_de = minix_find_entry(new_dentry, &new_folio); if (!new_de) goto out_dir; - err = minix_set_link(new_de, new_page, old_inode); - kunmap(new_page); - put_page(new_page); + err = minix_set_link(new_de, &new_folio->page, old_inode); + folio_release_kmap(new_folio, new_de); if (err) goto out_dir; inode_set_ctime_current(new_inode); @@ -229,7 +228,7 @@ static int minix_rename(struct mnt_idmap *idmap, inode_inc_link_count(new_dir); } - err = minix_delete_entry(old_de, old_page); + err = minix_delete_entry(old_de, &old_folio->page); if (err) goto out_dir; @@ -244,7 +243,7 @@ static int minix_rename(struct mnt_idmap *idmap, if (dir_de) unmap_and_put_page(dir_page, dir_de); out_old: - unmap_and_put_page(old_page, old_de); + folio_release_kmap(old_folio, old_de); out: return err; } From patchwork Wed Jul 10 01:23:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728773 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 9489E1C32 for ; Wed, 10 Jul 2024 01:23:27 +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=1720574610; cv=none; b=m3+02Kbl6SsiAOS7Y5RirIMNhxLDmnk7mojFYHXkRiNCvclmOV3A74TgYpsaOyrFgMxf5J32QRcjPITxedFKjkswUKaK6TmH88MAcgVdnq3ZOMMWwq5iPa4IFOeOIO+0efjeaMcIPI4s6OksvssLTY+o8TIwHpg24oUUIFxZj14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574610; c=relaxed/simple; bh=4Uqbeq9H77rqiyVY/EWYQ7o8CegpGuL9dA0nBX4iRxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QGUGV7DKA2g7DRAnhIsNChfpnDIyZqyALevilPvOIA8LelUwIQiuSDQQx7hQ7lokGlGnimovq+ZCgNrhT30y0tPK771Z6NQ/7IgySJZ+oVoU7Py1gZd8WOfJ+kzywDczniheY1cBDWGqGDTqlkeCcILPLTgDeJ0QzJEdwUFoGnE= 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=AtgtjWOn; 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="AtgtjWOn" 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=eYh0Ab03KUbPmTadz0BnuNQytEK0MKxv/++YJo48SK8=; b=AtgtjWOnTlLZ07pakbi/YkB5GM g42JOEbkNbIHs5WTh1Qlz0EAuMjE5go9TVP5nV5MyRIyIyPy+FdH2FOte+7SYEeRlLG9cRGy8GJ6U Wq/n692JoAxu4yooGl/rAsH7P1FX8SbiQ1xvxev7eRVvooOLm2tZdc5SfSji5uLa3I87G4Lh3atkJ 9HaPQQJqVrwSGwJXWGm+AVmrP8odTB/sBEXtnBsub0BgoAuNMRfs0wzOEoVqCEyvqNVkOzapGJxjD C9G4CP3AWlJj8JPhRHyhv0GC/6VfpXDFYoqe59JsUcqzvftEtRtpB95aPnzF2AaAbW/4WDF4U0k7i ocqZf0Rg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008Ya2-2agQ; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 3/7] minifs: Convert minix_set_link() and minix_dotdot() to take a folio Date: Wed, 10 Jul 2024 02:23:17 +0100 Message-ID: <20240710012323.2039519-4-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This matches ext2 and removes a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 23 ++++++++++------------- fs/minix/minix.h | 4 ++-- fs/minix/namei.c | 10 +++++----- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 3bbfac32d520..c32d182c2d74 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -404,40 +404,37 @@ int minix_empty_dir(struct inode * inode) } /* Releases the page */ -int minix_set_link(struct minix_dir_entry *de, struct page *page, +int minix_set_link(struct minix_dir_entry *de, struct folio *folio, struct inode *inode) { - struct inode *dir = page->mapping->host; + struct inode *dir = folio->mapping->host; struct minix_sb_info *sbi = minix_sb(dir->i_sb); - loff_t pos = page_offset(page) + offset_in_page(de); + loff_t pos = folio_pos(folio) + offset_in_folio(folio, de); int err; - lock_page(page); - err = minix_prepare_chunk(page, pos, sbi->s_dirsize); + folio_lock(folio); + err = minix_prepare_chunk(&folio->page, pos, sbi->s_dirsize); if (err) { - unlock_page(page); + folio_unlock(folio); return err; } if (sbi->s_version == MINIX_V3) ((minix3_dirent *)de)->inode = inode->i_ino; else de->inode = inode->i_ino; - dir_commit_chunk(page, pos, sbi->s_dirsize); + dir_commit_chunk(&folio->page, pos, sbi->s_dirsize); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); mark_inode_dirty(dir); return minix_handle_dirsync(dir); } -struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p) +struct minix_dir_entry *minix_dotdot(struct inode *dir, struct folio **foliop) { - struct folio *folio; struct minix_sb_info *sbi = minix_sb(dir->i_sb); - struct minix_dir_entry *de = dir_get_folio(dir, 0, &folio); + struct minix_dir_entry *de = dir_get_folio(dir, 0, foliop); - if (!IS_ERR(de)) { - *p = &folio->page; + if (!IS_ERR(de)) return minix_next_entry(de, sbi); - } return NULL; } diff --git a/fs/minix/minix.h b/fs/minix/minix.h index a290dd483e69..6ed34209ed33 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -69,9 +69,9 @@ int minix_add_link(struct dentry*, struct inode*); int minix_delete_entry(struct minix_dir_entry*, struct page*); int minix_make_empty(struct inode*, struct inode*); int minix_empty_dir(struct inode*); -int minix_set_link(struct minix_dir_entry *de, struct page *page, +int minix_set_link(struct minix_dir_entry *de, struct folio *folio, struct inode *inode); -struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); +struct minix_dir_entry *minix_dotdot(struct inode*, struct folio **); ino_t minix_inode_by_name(struct dentry*); extern const struct inode_operations minix_file_inode_operations; diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 117264877bd7..ba82fa3332f1 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -180,7 +180,7 @@ static int minix_rename(struct mnt_idmap *idmap, { struct inode * old_inode = d_inode(old_dentry); struct inode * new_inode = d_inode(new_dentry); - struct page * dir_page = NULL; + struct folio * dir_folio = NULL; struct minix_dir_entry * dir_de = NULL; struct folio *old_folio; struct minix_dir_entry * old_de; @@ -195,7 +195,7 @@ static int minix_rename(struct mnt_idmap *idmap, if (S_ISDIR(old_inode->i_mode)) { err = -EIO; - dir_de = minix_dotdot(old_inode, &dir_page); + dir_de = minix_dotdot(old_inode, &dir_folio); if (!dir_de) goto out_old; } @@ -212,7 +212,7 @@ static int minix_rename(struct mnt_idmap *idmap, new_de = minix_find_entry(new_dentry, &new_folio); if (!new_de) goto out_dir; - err = minix_set_link(new_de, &new_folio->page, old_inode); + err = minix_set_link(new_de, new_folio, old_inode); folio_release_kmap(new_folio, new_de); if (err) goto out_dir; @@ -235,13 +235,13 @@ static int minix_rename(struct mnt_idmap *idmap, mark_inode_dirty(old_inode); if (dir_de) { - err = minix_set_link(dir_de, dir_page, new_dir); + err = minix_set_link(dir_de, dir_folio, new_dir); if (!err) inode_dec_link_count(old_dir); } out_dir: if (dir_de) - unmap_and_put_page(dir_page, dir_de); + folio_release_kmap(dir_folio, dir_de); out_old: folio_release_kmap(old_folio, old_de); out: From patchwork Wed Jul 10 01:23:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728771 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 948FC161 for ; Wed, 10 Jul 2024 01:23:27 +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=1720574610; cv=none; b=XeOKLOUTFR6UVpgxGDzlaS2s7wOR6W+lsE/lAxKJVsqF3dPyVH8eRy+bu2ECd2iVYO5SQq2qKtgf2ban2oBou6ZZFkweBxFTWSCCMMwfxntmAVQUTy7jL8pGkOZMzHqbbwbjoOSa4yb1Rano92CElwSaiKvUnSkVO7grteoGoBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574610; c=relaxed/simple; bh=+ADFq/zJRlm0GjW455ZvqAiqba1I/IlVDTpRuckK5Nw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rxTjcvAfkzv0OPXq/vPeWpe5S3h+AWNWdJmcMkZJTkFkoKAdRM2j+w/1D9oCgvZLBj3idNRXezcxJ3GS3UlvGJ9jCDXamZQyc1WQiWPvHKhLaGEuZracxu60rzLP8voqr6uuqM0rJCe5D9EJT/DDyWJQgOB1pnhKM0TjdqJTjP4= 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=R/ezJcwj; 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="R/ezJcwj" 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=s99geBaEHd3Jj/GLOadEwCGC+Kc34Qbf018qXjTELGY=; b=R/ezJcwjBQju7RIFhPF0XcPuDj 1LbXs+w/gzt6LdfMOkFZRbpM6lx+JYacvK62pLhsGFy2dVmEcc7+3f+yeGLz2US7qvbYP/tZjO/Z+ h9NhentWm4RYlZp5Tkhfsb3uVM2f0qEHBllDZvLQ/1ACR2m2ZiK7/WYypUiLNa6MJb4G+gnoKPqQz JyRjs5Sv8hqJwCnCXAEF/j6kA+TBzFYSUB8WNKasar31HZ7MQXis3H+86aFMiwE12KPIsvd7tN488 4t9Vc1DUAK5PAHnjWqaWDZNgPdUC4vceyVWouMQ0H6ShsIOkNPbzNVPMSq9B68kXn8qb+mkxzCLp8 pJFLdTBw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008Ya4-2yZ2; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 4/7] minixfs: Convert minix_delete_entry() to work on a folio Date: Wed, 10 Jul 2024 02:23:18 +0100 Message-ID: <20240710012323.2039519-5-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Match ext2 and remove a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 14 +++++++------- fs/minix/minix.h | 2 +- fs/minix/namei.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index c32d182c2d74..994bbbd3dea2 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -283,25 +283,25 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) goto out_put; } -int minix_delete_entry(struct minix_dir_entry *de, struct page *page) +int minix_delete_entry(struct minix_dir_entry *de, struct folio *folio) { - struct inode *inode = page->mapping->host; - loff_t pos = page_offset(page) + offset_in_page(de); + struct inode *inode = folio->mapping->host; + loff_t pos = folio_pos(folio) + offset_in_folio(folio, de); struct minix_sb_info *sbi = minix_sb(inode->i_sb); unsigned len = sbi->s_dirsize; int err; - lock_page(page); - err = minix_prepare_chunk(page, pos, len); + folio_lock(folio); + err = minix_prepare_chunk(&folio->page, pos, len); if (err) { - unlock_page(page); + folio_unlock(folio); return err; } if (sbi->s_version == MINIX_V3) ((minix3_dirent *)de)->inode = 0; else de->inode = 0; - dir_commit_chunk(page, pos, len); + dir_commit_chunk(&folio->page, pos, len); inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); mark_inode_dirty(inode); return minix_handle_dirsync(inode); diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 6ed34209ed33..063bab8faa6b 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -66,7 +66,7 @@ extern unsigned V2_minix_blocks(loff_t, struct super_block *); struct minix_dir_entry *minix_find_entry(struct dentry *, struct folio **); int minix_add_link(struct dentry*, struct inode*); -int minix_delete_entry(struct minix_dir_entry*, struct page*); +int minix_delete_entry(struct minix_dir_entry *, struct folio *); int minix_make_empty(struct inode*, struct inode*); int minix_empty_dir(struct inode*); int minix_set_link(struct minix_dir_entry *de, struct folio *folio, diff --git a/fs/minix/namei.c b/fs/minix/namei.c index ba82fa3332f1..5d9c1406fe27 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -148,7 +148,7 @@ static int minix_unlink(struct inode * dir, struct dentry *dentry) de = minix_find_entry(dentry, &folio); if (!de) return -ENOENT; - err = minix_delete_entry(de, &folio->page); + err = minix_delete_entry(de, folio); folio_release_kmap(folio, de); if (err) @@ -228,7 +228,7 @@ static int minix_rename(struct mnt_idmap *idmap, inode_inc_link_count(new_dir); } - err = minix_delete_entry(old_de, &old_folio->page); + err = minix_delete_entry(old_de, old_folio); if (err) goto out_dir; From patchwork Wed Jul 10 01:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728769 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 948D12566 for ; Wed, 10 Jul 2024 01:23:27 +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=1720574609; cv=none; b=ftXwvO0m38iibmz2XO/s9Cgwqz01J9K4XJ23NNd29Jxn3f7rRhejggrQ/Fm80ozJZEazKTyOd3x60G34Xw/0m1Y3+tPg6Nk6JEIHq6HVWG2PicRic5VemGHRS26VBxhOqoDo8HltWbPDXdei53LEwVwitg6XSO6hi5YdE41L5Ak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574609; c=relaxed/simple; bh=UkawOYDzSih/dnAYjFZDxTf4D97cB6+NvFnrtStYr4c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qTth4Om99YamSdwYlMRb5zOep9Fe3MhjuyqL+RBr3WAwCu2WUoIyDu9jKArSEz+VyGbKakT3lmOuE+Ph2cd1MUeJTkzkvme7ZS5USpMAefKuc873mn9ZW2xzMdZyhfVGGqj1Lxu59D91GwibfG4Jb1yvzxKZdG8GMSvEgd1dFrA= 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=At1YkZhA; 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="At1YkZhA" 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=LCJ2oxqA9TRGO6xMAamg+HEiAooFaPR2RqIubURQO/Y=; b=At1YkZhArE6JaB1QRI7Bc4U2So S8N4AMbQTNoBCpfYp+MBWOjNG1MHNXmq4kpnpk8OLt7QyqKPlUHc88HpG9qRjwljm3Vw+cD0Eim1G Q6NIG+iVYAQUsDi+TSKT4+tVXFL4JdOlCKees0nDLQRbTN4TECoxeubaSRBNk3Inwb6S8OiUagllB c0TQTbr9kzQ/A/MjqKIcObzB4CjhySEe65aIP5gz6aPvpYhMq8VpnYq7e5AT6D/8KGlJ3KruybL2/ lYDKsSS/iPklhqdI9moJp2QqERPS1S3GM8FKj2NNii+K8SmV/xc+eo1h/ho/bmA829TRPgypXRkRE KYcTCGZw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008YaA-3RdM; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 5/7] minixfs: Convert minix_make_empty() to use a folio Date: Wed, 10 Jul 2024 02:23:19 +0100 Message-ID: <20240710012323.2039519-6-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removes a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 994bbbd3dea2..15b3ef1e473c 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -309,21 +309,21 @@ int minix_delete_entry(struct minix_dir_entry *de, struct folio *folio) int minix_make_empty(struct inode *inode, struct inode *dir) { - struct page *page = grab_cache_page(inode->i_mapping, 0); + struct folio *folio = filemap_grab_folio(inode->i_mapping, 0); struct minix_sb_info *sbi = minix_sb(inode->i_sb); char *kaddr; int err; - if (!page) - return -ENOMEM; - err = minix_prepare_chunk(page, 0, 2 * sbi->s_dirsize); + if (IS_ERR(folio)) + return PTR_ERR(folio); + err = minix_prepare_chunk(&folio->page, 0, 2 * sbi->s_dirsize); if (err) { - unlock_page(page); + folio_unlock(folio); goto fail; } - kaddr = kmap_local_page(page); - memset(kaddr, 0, PAGE_SIZE); + kaddr = kmap_local_folio(folio, 0); + memset(kaddr, 0, folio_size(folio)); if (sbi->s_version == MINIX_V3) { minix3_dirent *de3 = (minix3_dirent *)kaddr; @@ -344,10 +344,10 @@ int minix_make_empty(struct inode *inode, struct inode *dir) } kunmap_local(kaddr); - dir_commit_chunk(page, 0, 2 * sbi->s_dirsize); + dir_commit_chunk(&folio->page, 0, 2 * sbi->s_dirsize); err = minix_handle_dirsync(inode); fail: - put_page(page); + folio_put(folio); return err; } From patchwork Wed Jul 10 01:23:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728772 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 9486810FF for ; Wed, 10 Jul 2024 01:23:27 +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=1720574610; cv=none; b=lHvw6xBdPYk/zNTMCn9JSM35YTeK1yx5fD4YN6wdQ0zL2dzn3pxLTTH4C9tp8be+9BrXX5dnm5MBo1U/TkEzQEHpXSZDBueNtPO4Ir9DRo4K8ybWyBT3ZTVS5S5bxqkuXIPyJjsDjaIftdOxVWyGbN39kYC8XJAO6VXbF+mHIpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574610; c=relaxed/simple; bh=at+hOssBnO21BOqu4rSvyICPpJkqsx5QjEhsfVofSQ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uI7iZt7dPEXYYm5XZs0ctsXA8YaToIXQzlngGETVq8rcKVGmhPxeUsQeUipQlajZsi/ZcWmCZhSvdxk5oTMcLfy25bWFveH6LWhtIe6RaWoP7dFCjX5HLMB3P2AJNO0M8xuHyNuD1mVqowYtEdMiULqStM42qSbRWm24toPwzOU= 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=k65KVAfz; 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="k65KVAfz" 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=myylJ+DP1qvMQUFEQCUZX8G3MEKHMxoSQ/ebW6yjIh4=; b=k65KVAfz1q5KRC9Yahuq4b+mzz AAwcFRBf7qSsgF1W3WO8Kobs3J6BndIzeGubN+W/uWPicviL1n+eE7dtb60ZP7FTs4FQ+dxK1JeIh GGM7trjeWoi4DEYPclYZxt9KFd2emXX9ZLVA0Cr8RYoxzdfOT/lJSeYWAojjkuzS/KSZ2uOjFJIQS j8Gptep4L8TuHIwMKbvNtTaxsGm3FYeWbQx35S4KFU+HG9AqCG5ujlOKs8+dnng5aMBhBKSj7yakj HsMI3jKe+LBzC5xFBiN7elF3ldy5mwEagc/h5mmYOt8jgLjD5S9aHQtYgD3OFJQ8loYsZrR5Yi8vD LunGqq1w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3J-00000008YaL-3w29; Wed, 10 Jul 2024 01:23:25 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 6/7] minixfs: Convert minix_prepare_chunk() to take a folio Date: Wed, 10 Jul 2024 02:23:20 +0100 Message-ID: <20240710012323.2039519-7-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All callers now have a folio, so convert minix_prepare_chunk() to take one. Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 8 ++++---- fs/minix/inode.c | 4 ++-- fs/minix/minix.h | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 15b3ef1e473c..26bfea508028 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -260,7 +260,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) got_it: pos = folio_pos(folio) + offset_in_folio(folio, p); - err = minix_prepare_chunk(&folio->page, pos, sbi->s_dirsize); + err = minix_prepare_chunk(folio, pos, sbi->s_dirsize); if (err) goto out_unlock; memcpy (namx, name, namelen); @@ -292,7 +292,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct folio *folio) int err; folio_lock(folio); - err = minix_prepare_chunk(&folio->page, pos, len); + err = minix_prepare_chunk(folio, pos, len); if (err) { folio_unlock(folio); return err; @@ -316,7 +316,7 @@ int minix_make_empty(struct inode *inode, struct inode *dir) if (IS_ERR(folio)) return PTR_ERR(folio); - err = minix_prepare_chunk(&folio->page, 0, 2 * sbi->s_dirsize); + err = minix_prepare_chunk(folio, 0, 2 * sbi->s_dirsize); if (err) { folio_unlock(folio); goto fail; @@ -413,7 +413,7 @@ int minix_set_link(struct minix_dir_entry *de, struct folio *folio, int err; folio_lock(folio); - err = minix_prepare_chunk(&folio->page, pos, sbi->s_dirsize); + err = minix_prepare_chunk(folio, pos, sbi->s_dirsize); if (err) { folio_unlock(folio); return err; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 1c3df63162ef..0002337977e0 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -427,9 +427,9 @@ static int minix_read_folio(struct file *file, struct folio *folio) return block_read_full_folio(folio, minix_get_block); } -int minix_prepare_chunk(struct page *page, loff_t pos, unsigned len) +int minix_prepare_chunk(struct folio *folio, loff_t pos, unsigned len) { - return __block_write_begin(page, pos, len, minix_get_block); + return __block_write_begin(&folio->page, pos, len, minix_get_block); } static void minix_write_failed(struct address_space *mapping, loff_t to) diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 063bab8faa6b..d54273c3c9ff 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -42,18 +42,18 @@ struct minix_sb_info { unsigned short s_version; }; -extern struct inode *minix_iget(struct super_block *, unsigned long); -extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); -extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); -extern struct inode * minix_new_inode(const struct inode *, umode_t); -extern void minix_free_inode(struct inode * inode); -extern unsigned long minix_count_free_inodes(struct super_block *sb); -extern int minix_new_block(struct inode * inode); -extern void minix_free_block(struct inode *inode, unsigned long block); -extern unsigned long minix_count_free_blocks(struct super_block *sb); -extern int minix_getattr(struct mnt_idmap *, const struct path *, - struct kstat *, u32, unsigned int); -extern int minix_prepare_chunk(struct page *page, loff_t pos, unsigned len); +struct inode *minix_iget(struct super_block *, unsigned long); +struct minix_inode *minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); +struct minix2_inode *minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); +struct inode *minix_new_inode(const struct inode *, umode_t); +void minix_free_inode(struct inode *inode); +unsigned long minix_count_free_inodes(struct super_block *sb); +int minix_new_block(struct inode *inode); +void minix_free_block(struct inode *inode, unsigned long block); +unsigned long minix_count_free_blocks(struct super_block *sb); +int minix_getattr(struct mnt_idmap *, const struct path *, + struct kstat *, u32, unsigned int); +int minix_prepare_chunk(struct folio *folio, loff_t pos, unsigned len); extern void V1_minix_truncate(struct inode *); extern void V2_minix_truncate(struct inode *); From patchwork Wed Jul 10 01:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13728770 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 F36F24404 for ; Wed, 10 Jul 2024 01:23:27 +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=1720574610; cv=none; b=nl2IeRGnv5dAB3H/1dq8l6uTCH69CROI0nQDPWxLqAp9bKQoTulpeksr5+qY2nmWT9j0kgltgVMo50Ys/XEifUx1qjfmYSxfKwC5/nM0Ube6pwVZhWF+gk4PWASMaON4JlhAzu+Kclna4+B/5o2KzzNfJMDmET3GO4f7MBo7YTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574610; c=relaxed/simple; bh=Hf4RMDAzB6taNFp95sdzEHYjPc/97ix66CTFGOU4K2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IhN1+GX30C6Llihrg1Cf/iTDcMBn8ElUQSdQyJr21M2VbH2gLUBuLqWpUcKyJKStCVNcGcDDYF7PRHMbLkiG7a/IRe+SrBYoJCebOzITNb7VPY1+FuH80k01FWTdgTZzWOp835wDc/OLAnMxcmpKSZ/kxycxBoL9qX/nIRMVWfE= 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=GGmkEOMQ; 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="GGmkEOMQ" 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=O5l/mAhq29kMWF4ipW8yxBh9WqFVmHcoBQ77yoDMVcI=; b=GGmkEOMQQ09SHvgq86eN9zpfpe UcQii31iIbrKV1FrJmI09PaH+vJcevDaS6rdIX6CVsq4nEb5lBSZENrj8VfZyN1UV2Bt6mOG3bZQb q9yfr1M23uBfEEtlSxqjG9ax0AkMFZV9wQBxs/+pmVvKTcHNp6t7q8rWteZnbqyiAWKVnB0gib6bW DQg9xNu2c3gMbkh/grlBTAd0pDP5C+1wNgQNvvtk2+pWr4lwq5ELhhBd8P2usp32aNxyAMeIpOyJn yoqavyhJJ4TMJQRvUXdeUidYHAEydnSyhA0gJvFFBi5y99bArve1budY++HCbG1vY6fmWNLKul8sS UhSa1nyQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRM3K-00000008YaS-0Cyq; Wed, 10 Jul 2024 01:23:26 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Al Viro , Christoph Hellwig Subject: [PATCH 7/7] minixfs: Convert dir_commit_chunk() to take a folio Date: Wed, 10 Jul 2024 02:23:21 +0100 Message-ID: <20240710012323.2039519-8-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710012323.2039519-1-willy@infradead.org> References: <20240710012323.2039519-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All callers now have a folio, so pass it in. Saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/minix/dir.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 26bfea508028..5f9e2fc91003 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -40,18 +40,18 @@ minix_last_byte(struct inode *inode, unsigned long page_nr) return last_byte; } -static void dir_commit_chunk(struct page *page, loff_t pos, unsigned len) +static void dir_commit_chunk(struct folio *folio, loff_t pos, unsigned len) { - struct address_space *mapping = page->mapping; + struct address_space *mapping = folio->mapping; struct inode *dir = mapping->host; - block_write_end(NULL, mapping, pos, len, len, page, NULL); + block_write_end(NULL, mapping, pos, len, len, &folio->page, NULL); if (pos+len > dir->i_size) { i_size_write(dir, pos+len); mark_inode_dirty(dir); } - unlock_page(page); + folio_unlock(folio); } static int minix_handle_dirsync(struct inode *dir) @@ -271,7 +271,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) memset (namx + namelen, 0, sbi->s_dirsize - namelen - 2); de->inode = inode->i_ino; } - dir_commit_chunk(&folio->page, pos, sbi->s_dirsize); + dir_commit_chunk(folio, pos, sbi->s_dirsize); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); mark_inode_dirty(dir); err = minix_handle_dirsync(dir); @@ -301,7 +301,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct folio *folio) ((minix3_dirent *)de)->inode = 0; else de->inode = 0; - dir_commit_chunk(&folio->page, pos, len); + dir_commit_chunk(folio, pos, len); inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); mark_inode_dirty(inode); return minix_handle_dirsync(inode); @@ -344,7 +344,7 @@ int minix_make_empty(struct inode *inode, struct inode *dir) } kunmap_local(kaddr); - dir_commit_chunk(&folio->page, 0, 2 * sbi->s_dirsize); + dir_commit_chunk(folio, 0, 2 * sbi->s_dirsize); err = minix_handle_dirsync(inode); fail: folio_put(folio); @@ -422,7 +422,7 @@ int minix_set_link(struct minix_dir_entry *de, struct folio *folio, ((minix3_dirent *)de)->inode = inode->i_ino; else de->inode = inode->i_ino; - dir_commit_chunk(&folio->page, pos, sbi->s_dirsize); + dir_commit_chunk(folio, pos, sbi->s_dirsize); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); mark_inode_dirty(dir); return minix_handle_dirsync(dir);