Skip to content
Snippets Groups Projects
Select Git revision
6 results Searching

kallsyms.c

Blame
  • super.c 47.94 KiB
    // SPDX-License-Identifier: GPL-2.0
    /*
     *  linux/fs/super.c
     *
     *  Copyright (C) 1991, 1992  Linus Torvalds
     *
     *  super.c contains code to handle: - mount structures
     *                                   - super-block tables
     *                                   - filesystem drivers list
     *                                   - mount system call
     *                                   - umount system call
     *                                   - ustat system call
     *
     * GK 2/5/95  -  Changed to support mounting the root fs via NFS
     *
     *  Added kerneld support: Jacques Gelinas and Bjorn Ekwall
     *  Added change_root: Werner Almesberger & Hans Lermen, Feb '96
     *  Added options to /proc/mounts:
     *    Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996.
     *  Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998
     *  Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
     */
    
    #include <linux/export.h>
    #include <linux/slab.h>
    #include <linux/blkdev.h>
    #include <linux/mount.h>
    #include <linux/security.h>
    #include <linux/writeback.h>		/* for the emergency remount stuff */
    #include <linux/idr.h>
    #include <linux/mutex.h>
    #include <linux/backing-dev.h>
    #include <linux/rculist_bl.h>
    #include <linux/cleancache.h>
    #include <linux/fscrypt.h>
    #include <linux/fsnotify.h>
    #include <linux/lockdep.h>
    #include <linux/user_namespace.h>
    #include <linux/fs_context.h>
    #include <uapi/linux/mount.h>
    #include "internal.h"
    
    static int thaw_super_locked(struct super_block *sb);
    
    static LIST_HEAD(super_blocks);
    static DEFINE_SPINLOCK(sb_lock);
    
    static char *sb_writers_name[SB_FREEZE_LEVELS] = {
    	"sb_writers",
    	"sb_pagefaults",
    	"sb_internal",
    };
    
    /*
     * One thing we have to be careful of with a per-sb shrinker is that we don't
     * drop the last active reference to the superblock from within the shrinker.
     * If that happens we could trigger unregistering the shrinker from within the
     * shrinker path and that leads to deadlock on the shrinker_rwsem. Hence we
     * take a passive reference to the superblock to avoid this from occurring.
     */
    static unsigned long super_cache_scan(struct shrinker *shrink,
    				      struct shrink_control *sc)
    {
    	struct super_block *sb;
    	long	fs_objects = 0;
    	long	total_objects;
    	long	freed = 0;
    	long	dentries;
    	long	inodes;