Re: [PATCH v6 02/10] fs/ntfs3: Add initialization of super block

From: Vitaly Lipatov
Date: Sat Oct 03 2020 - 18:39:01 EST



This adds initialization of super block

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
...

+static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf)
+{
+ struct super_block *sb = dentry->d_sb;
+ struct ntfs_sb_info *sbi = sb->s_fs_info;
+ struct wnd_bitmap *wnd = &sbi->used.bitmap;
+
+ buf->f_type = sb->s_magic;
+ buf->f_bsize = sbi->cluster_size;
+ buf->f_blocks = wnd->nbits;
+
+ buf->f_bfree = buf->f_bavail = wnd_zeroes(wnd);
+ buf->f_fsid.val[0] = (u32)sbi->volume.ser_num;
+ buf->f_fsid.val[1] = (u32)(sbi->volume.ser_num >> 32);
+ buf->f_namelen = NTFS_NAME_LEN;
namelen field of kstatfs (also as statfs struct from statfs system call) contains
maximum length of filenames on your file system for user space. It is the number of bytes for filenames.
But NTFS_NAME_LEN (255) is a length of filenames in UCS2 chars, so it can be up to 3*255 bytes in UTF-8.

--
Vitaly Lipatov
Etersoft