STRUCT THE_NILFS(9)
π struct the_nilfs(9) π
okay so bestie, welcome to the Kernel API Manual β yes that's the manual name, we're fancy now β and today's main character is struct the_nilfs, the struct that supervises multiple nilfs mount points. like, all of them. she's the momager. π
β¨ NAME β¨
struct the_nilfs β the struct that supervises multiple nilfs mount points. she runs the whole friend group, no cap. π
πΈ SYNOPSIS πΈ
struct the_nilfs {
unsigned long ns_flags;
int ns_flushed_device;
struct super_block *ns_sb;
struct block_device *ns_bdev;
struct rw_semaphore ns_sem;
struct mutex ns_snapshot_mount_mutex;
struct buffer_head *ns_sbh[2];
struct nilfs_super_block *ns_sbp[2];
time64_t ns_sbwtime;
unsigned int ns_sbwcount;
unsigned int ns_sbsize;
unsigned int ns_mount_state;
unsigned int ns_sb_update_freq;
u64 ns_seg_seq;
__u64 ns_segnum;
__u64 ns_nextnum;
unsigned long ns_pseg_offset;
__u64 ns_cno;
time64_t ns_ctime;
time64_t ns_nongc_ctime;
atomic_t ns_ndirtyblks;
spinlock_t ns_last_segment_lock;
sector_t ns_last_pseg;
u64 ns_last_seq;
__u64 ns_last_cno;
u64 ns_prot_seq;
u64 ns_prev_seq;
struct nilfs_sc_info *ns_writer;
struct rw_semaphore ns_segctor_sem;
struct inode *ns_dat;
struct inode *ns_cpfile;
struct inode *ns_sufile;
struct rb_root ns_cptree;
spinlock_t ns_cptree_lock;
struct list_head ns_dirty_files;
spinlock_t ns_inode_lock;
struct list_head ns_gc_inodes;
unsigned long ns_mount_opt;
uid_t ns_resuid;
gid_t ns_resgid;
unsigned long ns_interval;
unsigned long ns_watermark;
unsigned int ns_blocksize_bits;
unsigned int ns_blocksize;
unsigned long ns_nsegments;
unsigned long ns_blocks_per_segment;
unsigned long ns_r_segments_percentage;
unsigned long ns_nrsvsegs;
unsigned long ns_first_data_block;
int ns_inode_size;
unsigned int ns_first_ino;
u32 ns_crc_seed;
struct kobject ns_dev_kobj;
struct completion ns_dev_kobj_unregister;
struct nilfs_sysfs_dev_subgroups *ns_dev_subgroups;
};
like, look at her. that's a lot of fields and every single one is doing her part. we love a hardworking queen. π«Ά
π¦ DESCRIPTION π¦
she's the struct that supervises multiple nilfs mount points. literally her whole job. now let's meet the members one by one, because they all deserve their moment. π
π MEMBERS π
ns_flagsβ flags. short, sweet, iconic.ns_flushed_deviceβ a flag indicating if all volatile data was flushed. basically the "did everyone make it home safe" check. πns_sbβ back pointer to the super block instance.ns_bdevβ the block device.ns_semβ semaphore for shared states. sharing is caring but lock it first, bestie.ns_snapshot_mount_mutexβ mutex to protect snapshot mounts. do not skip the mutex, i'm begging. πns_sbhβ buffer heads of on-disk super blocks.ns_sbpβ pointers to super block data.ns_sbwtimeβ previous write time of super block.ns_sbwcountβ write count of super block.ns_sbsizeβ size of valid data in super block.ns_mount_stateβ file system state.ns_sb_update_freqβ interval of periodical update of superblocks (in seconds). yes, seconds, keep the units, they matter. β°ns_seg_seqβ segment sequence counter.ns_segnumβ index number of the latest full segment.ns_nextnumβ index number of the full segment index to be used next.ns_pseg_offsetβ offset of next partial segment in the current full segment.ns_cnoβ next checkpoint number.ns_ctimeβ write time of the last segment.ns_nongc_ctimeβ write time of the last segment not for cleaner operation. not the cleaner's, okay? different vibe entirely.ns_ndirtyblksβ Number of dirty data blocks. capital N, that's canon, we don't question the source.ns_last_segment_lockβ lock protecting fields for the latest segment.ns_last_psegβ start block number of the latest segment.ns_last_seqβ sequence value of the latest segment.ns_last_cnoβ checkpoint number of the latest segment.ns_prot_seqβ least sequence number of segments which must not be reclaimed. hands off, protected, do not touch. π«ns_prev_seqβ base sequence number used to decide if advance log cursor.ns_writerβ log writer. the scribe. the note-taker of the group chat. βοΈns_segctor_semβ semaphore protecting log write.ns_datβ DAT file inode.ns_cpfileβ checkpoint file inode.ns_sufileβ segusage file inode.ns_cptreeβ rb-tree of all mounted checkpoints (nilfs_root).ns_cptree_lockβ lock protectingns_cptree.ns_dirty_filesβ list of dirty files.ns_inode_lockβ lock protectingns_dirty_files. see how she pairs them up? iconic behavior.ns_gc_inodesβ dummy inodes to keep live blocks.ns_mount_optβ mount options.ns_resuidβ uid for reserved blocks.ns_resgidβ gid for reserved blocks.ns_intervalβ checkpoint creation interval.ns_watermarkβ watermark for the number of dirty buffers.ns_blocksize_bitsβ bit length of block size.ns_blocksizeβ block size.ns_nsegmentsβ number of segments in filesystem.ns_blocks_per_segmentβ number of blocks per segment.ns_r_segments_percentageβ reserved segments percentage.ns_nrsvsegsβ number of reserved segments.ns_first_data_blockβ block number of first data block.ns_inode_sizeβ size of on-disk inode.ns_first_inoβ first not-special inode number.ns_crc_seedβ seed value of CRC32 calculation.ns_dev_kobjβ literally/sys/fs/<nilfs>/<device>. she lives there rent free. πns_dev_kobj_unregisterβ completion state.ns_dev_subgroupsβ<device>subgroups pointer.
π₯ SEE ALSO π₯
- Kernel file
./fs/nilfs2/the_nilfs.h struct nilfs_root(9)
ok but fr fr, go read ./fs/nilfs2/the_nilfs.h when you're done here. iykyk. πβ¨
and that's the whole page, bestie β brought to you by the source ./fs/nilfs2, dated October 2026. periodt. π
ππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms