Re: [PATCH] dcache: rename d_genocide()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 11, 2024 at 8:44 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Feb 11, 2024 at 10:00:03AM +0200, Amir Goldstein wrote:
>
> > > whole d_genocide() thing is quite likely to disappear, turning
> > > kill_litter_super() into an alias for kill_anon_super().
> >
> > 2-in-1, getting rid of cruelty in the human and animal kingdom ;)
>
> FWIW, "litter" in the above is in the sense of "trash", not "collection
> of animal offspring from the same birth"...

Well either way, it is not clear by this name when the function should be used.
The current documentation of when kill_litter_super() should be used is
"use it for fs that set FS_LITTER flag, oh, BTW, there is no FS_LITTER flag":

Documentation/filesystems/porting.rst:
---
new file_system_type method - kill_sb(superblock).  If you are converting
an existing filesystem, set it according to ->fs_flags::

        FS_REQUIRES_DEV         -       kill_block_super
        FS_LITTER               -       kill_litter_super
        neither                 -       kill_anon_super

FS_LITTER is gone - just remove it from fs_flags.
---

If you are going to make kill_litter_super() an alias of kill_anon_super()
I suggest going the extra mile and replacing the remaining 30 instances of
kill_litter_super().

If the rules become straight forward for the default ->kill_sb(),
then maybe we should even make ->kill_sb() optional and do:

diff --git a/fs/super.c b/fs/super.c
index d35e85295489..6200cac0e4f8 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -458,6 +458,18 @@ static void kill_super_notify(struct super_block *sb)
        super_wake(sb, SB_DEAD);
 }

+static void kill_sb(struct super_block *s)
+{
+       struct file_system_type *fs = s->s_type;
+
+       if (fs->kill_sb)
+               fs->kill_sb(s);
+       else if (fs->fs_flags & FS_REQUIRES_DEV)
+               kill_block_super(s);
+       else
+               kill_anon_super(s);
+}
+
 /**
  *     deactivate_locked_super -       drop an active reference to superblock
  *     @s: superblock to deactivate
@@ -474,7 +486,7 @@ void deactivate_locked_super(struct super_block *s)
        struct file_system_type *fs = s->s_type;
        if (atomic_dec_and_test(&s->s_active)) {
                shrinker_free(s->s_shrink);
-               fs->kill_sb(s);
+               kill_sb(s);

                kill_super_notify(s);
 --

Thanks,
Amir.





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux