Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: filesystems: vfs: actualize struct super_operations description

Added/updated descriptions for super_operations:
- free_inode method
- evict_inode method
- freeze_super/thaw_super method
- show_{devname,path,stats} procfs-related methods
- get_dquots method

Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Miklos Szeredi <mszeredi@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20230313130718.253708-3-aleksandr.mikhalitsyn@canonical.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Alexander Mikhalitsyn and committed by
Jonathan Corbet
592d8072 85bf9a0e

+59 -15
+59 -15
Documentation/filesystems/vfs.rst
··· 245 245 ----------------------- 246 246 247 247 This describes how the VFS can manipulate the superblock of your 248 - filesystem. As of kernel 2.6.22, the following members are defined: 248 + filesystem. The following members are defined: 249 249 250 250 .. code-block:: c 251 251 252 252 struct super_operations { 253 253 struct inode *(*alloc_inode)(struct super_block *sb); 254 254 void (*destroy_inode)(struct inode *); 255 + void (*free_inode)(struct inode *); 255 256 256 257 void (*dirty_inode) (struct inode *, int flags); 257 - int (*write_inode) (struct inode *, int); 258 - void (*drop_inode) (struct inode *); 259 - void (*delete_inode) (struct inode *); 258 + int (*write_inode) (struct inode *, struct writeback_control *wbc); 259 + int (*drop_inode) (struct inode *); 260 + void (*evict_inode) (struct inode *); 260 261 void (*put_super) (struct super_block *); 261 262 int (*sync_fs)(struct super_block *sb, int wait); 263 + int (*freeze_super) (struct super_block *); 262 264 int (*freeze_fs) (struct super_block *); 265 + int (*thaw_super) (struct super_block *); 263 266 int (*unfreeze_fs) (struct super_block *); 264 267 int (*statfs) (struct dentry *, struct kstatfs *); 265 268 int (*remount_fs) (struct super_block *, int *, char *); 266 - void (*clear_inode) (struct inode *); 267 269 void (*umount_begin) (struct super_block *); 268 270 269 271 int (*show_options)(struct seq_file *, struct dentry *); 272 + int (*show_devname)(struct seq_file *, struct dentry *); 273 + int (*show_path)(struct seq_file *, struct dentry *); 274 + int (*show_stats)(struct seq_file *, struct dentry *); 270 275 271 276 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 272 277 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 273 - int (*nr_cached_objects)(struct super_block *); 274 - void (*free_cached_objects)(struct super_block *, int); 278 + struct dquot **(*get_dquots)(struct inode *); 279 + 280 + long (*nr_cached_objects)(struct super_block *, 281 + struct shrink_control *); 282 + long (*free_cached_objects)(struct super_block *, 283 + struct shrink_control *); 275 284 }; 276 285 277 286 All methods are called without any locks being held, unless otherwise ··· 300 291 allocated for struct inode. It is only required if 301 292 ->alloc_inode was defined and simply undoes anything done by 302 293 ->alloc_inode. 294 + 295 + ``free_inode`` 296 + this method is called from RCU callback. If you use call_rcu() 297 + in ->destroy_inode to free 'struct inode' memory, then it's 298 + better to release memory in this method. 303 299 304 300 ``dirty_inode`` 305 301 this method is called by the VFS when an inode is marked dirty. ··· 333 319 practice of using "force_delete" in the put_inode() case, but 334 320 does not have the races that the "force_delete()" approach had. 335 321 336 - ``delete_inode`` 337 - called when the VFS wants to delete an inode 322 + ``evict_inode`` 323 + called when the VFS wants to evict an inode. Caller does 324 + *not* evict the pagecache or inode-associated metadata buffers; 325 + the method has to use truncate_inode_pages_final() to get rid 326 + of those. Caller makes sure async writeback cannot be running for 327 + the inode while (or after) ->evict_inode() is called. Optional. 338 328 339 329 ``put_super`` 340 330 called when the VFS wishes to free the superblock ··· 349 331 superblock. The second parameter indicates whether the method 350 332 should wait until the write out has been completed. Optional. 351 333 334 + ``freeze_super`` 335 + Called instead of ->freeze_fs callback if provided. 336 + Main difference is that ->freeze_super is called without taking 337 + down_write(&sb->s_umount). If filesystem implements it and wants 338 + ->freeze_fs to be called too, then it has to call ->freeze_fs 339 + explicitly from this callback. Optional. 340 + 352 341 ``freeze_fs`` 353 342 called when VFS is locking a filesystem and forcing it into a 354 343 consistent state. This method is currently used by the Logical 355 - Volume Manager (LVM). 344 + Volume Manager (LVM) and ioctl(FIFREEZE). Optional. 345 + 346 + ``thaw_super`` 347 + called when VFS is unlocking a filesystem and making it writable 348 + again after ->freeze_super. Optional. 356 349 357 350 ``unfreeze_fs`` 358 351 called when VFS is unlocking a filesystem and making it writable 359 - again. 352 + again after ->freeze_fs. Optional. 360 353 361 354 ``statfs`` 362 355 called when the VFS needs to get filesystem statistics. ··· 376 347 called when the filesystem is remounted. This is called with 377 348 the kernel lock held 378 349 379 - ``clear_inode`` 380 - called then the VFS clears the inode. Optional 381 - 382 350 ``umount_begin`` 383 351 called when the VFS is unmounting a filesystem. 384 352 385 353 ``show_options`` 386 - called by the VFS to show mount options for /proc/<pid>/mounts. 354 + called by the VFS to show mount options for /proc/<pid>/mounts 355 + and /proc/<pid>/mountinfo. 387 356 (see "Mount Options" section) 357 + 358 + ``show_devname`` 359 + Optional. Called by the VFS to show device name for 360 + /proc/<pid>/{mounts,mountinfo,mountstats}. If not provided then 361 + '(struct mount).mnt_devname' will be used. 362 + 363 + ``show_path`` 364 + Optional. Called by the VFS (for /proc/<pid>/mountinfo) to show 365 + the mount root dentry path relative to the filesystem root. 366 + 367 + ``show_stats`` 368 + Optional. Called by the VFS (for /proc/<pid>/mountstats) to show 369 + filesystem-specific mount statistics. 388 370 389 371 ``quota_read`` 390 372 called by the VFS to read from filesystem quota file. 391 373 392 374 ``quota_write`` 393 375 called by the VFS to write to filesystem quota file. 376 + 377 + ``get_dquots`` 378 + called by quota to get 'struct dquot' array for a particular inode. 379 + Optional. 394 380 395 381 ``nr_cached_objects`` 396 382 called by the sb cache shrinking function for the filesystem to