ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: <ntfs3@lists.linux.dev>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 3/3] fs/ntfs3: Change destroy_inode to free_inode
Date: Mon, 12 Sep 2022 19:40:42 +0300	[thread overview]
Message-ID: <b1dbef1a-d52e-5096-c179-fde8c5f0f2b2@paragon-software.com> (raw)
In-Reply-To: <59960918-0adb-6d53-2d77-8172e666bf40@paragon-software.com>

Many filesystems already use free_inode callback,
so we will use it too from now on.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
  fs/ntfs3/super.c | 20 ++++----------------
  1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 067a0e9cf590..744c1f15ba2a 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -438,27 +438,18 @@ static struct inode *ntfs_alloc_inode(struct super_block *sb)
  		return NULL;
  
  	memset(ni, 0, offsetof(struct ntfs_inode, vfs_inode));
-
  	mutex_init(&ni->ni_lock);
-
  	return &ni->vfs_inode;
  }
  
-static void ntfs_i_callback(struct rcu_head *head)
+static void ntfs_free_inode(struct inode *inode)
  {
-	struct inode *inode = container_of(head, struct inode, i_rcu);
  	struct ntfs_inode *ni = ntfs_i(inode);
  
  	mutex_destroy(&ni->ni_lock);
-
  	kmem_cache_free(ntfs_inode_cachep, ni);
  }
  
-static void ntfs_destroy_inode(struct inode *inode)
-{
-	call_rcu(&inode->i_rcu, ntfs_i_callback);
-}
-
  static void init_once(void *foo)
  {
  	struct ntfs_inode *ni = foo;
@@ -624,7 +615,7 @@ static int ntfs_sync_fs(struct super_block *sb, int wait)
  
  static const struct super_operations ntfs_sops = {
  	.alloc_inode = ntfs_alloc_inode,
-	.destroy_inode = ntfs_destroy_inode,
+	.free_inode = ntfs_free_inode,
  	.evict_inode = ntfs_evict_inode,
  	.put_super = ntfs_put_super,
  	.statfs = ntfs_statfs,
@@ -1520,11 +1511,8 @@ static int __init init_ntfs_fs(void)
  
  static void __exit exit_ntfs_fs(void)
  {
-	if (ntfs_inode_cachep) {
-		rcu_barrier();
-		kmem_cache_destroy(ntfs_inode_cachep);
-	}
-
+	rcu_barrier();
+	kmem_cache_destroy(ntfs_inode_cachep);
  	unregister_filesystem(&ntfs_fs_type);
  	ntfs3_exit_bitmap();
  }
-- 
2.37.0



      parent reply	other threads:[~2022-09-12 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 16:37 [PATCH 0/3] fs/ntfs3: Refactoring and hidedotfiles option Konstantin Komarov
2022-09-12 16:39 ` [PATCH 1/3] fs/ntfs3: Add comments about cluster size Konstantin Komarov
2022-09-12 16:40 ` [PATCH 2/3] fs/ntfs3: Add hidedotfiles option Konstantin Komarov
2022-10-03 22:51   ` Daniel Pinto
2022-09-12 16:40 ` Konstantin Komarov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1dbef1a-d52e-5096-c179-fde8c5f0f2b2@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).