]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/ntfs3: Refactoring and comments
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 25 Sep 2023 07:47:07 +0000 (10:47 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Thu, 28 Sep 2023 12:04:01 +0000 (15:04 +0300)
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/attrib.c
fs/ntfs3/file.c
fs/ntfs3/inode.c
fs/ntfs3/namei.c
fs/ntfs3/ntfs.h
fs/ntfs3/ntfs_fs.h
fs/ntfs3/record.c
fs/ntfs3/super.c

index a9d82bbb4729ecf1b65984ed05a2d8c259d2028f..e16487764282ee24b5a58396d0d6296952142f59 100644 (file)
@@ -1106,10 +1106,10 @@ repack:
                }
        }
 
-       /* 
+       /*
         * The code below may require additional cluster (to extend attribute list)
-        * and / or one MFT record 
-        * It is too complex to undo operations if -ENOSPC occurs deep inside 
+        * and / or one MFT record
+        * It is too complex to undo operations if -ENOSPC occurs deep inside
         * in 'ni_insert_nonresident'.
         * Return in advance -ENOSPC here if there are no free cluster and no free MFT.
         */
index 962f12ce6c0a62c183236e3658b666f23c02ab58..1f7a194983c5db46e45c96d88966f6420581066c 100644 (file)
@@ -745,8 +745,8 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
 }
 
 static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos,
-                                    struct pipe_inode_info *pipe,
-                                    size_t len, unsigned int flags)
+                                    struct pipe_inode_info *pipe, size_t len,
+                                    unsigned int flags)
 {
        struct inode *inode = in->f_mapping->host;
        struct ntfs_inode *ni = ntfs_i(inode);
index 2f76dc055c1f35950160ace359109244b9a92a2b..d6d021e19aaa23ed8cd32e785798a61095411b45 100644 (file)
@@ -1660,7 +1660,8 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
        d_instantiate(dentry, inode);
 
        /* Set original time. inode times (i_ctime) may be changed in ntfs_init_acl. */
-       inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, ni->i_crtime);
+       inode->i_atime = inode->i_mtime =
+               inode_set_ctime_to_ts(inode, ni->i_crtime);
        dir->i_mtime = inode_set_ctime_to_ts(dir, ni->i_crtime);
 
        mark_inode_dirty(dir);
index ad430d50bd79836dca326afe3190cbcd47adfb2a..eedacf94edd80552791181407382d0e68dd8e191 100644 (file)
@@ -156,8 +156,8 @@ static int ntfs_link(struct dentry *ode, struct inode *dir, struct dentry *de)
        err = ntfs_link_inode(inode, de);
 
        if (!err) {
-               dir->i_mtime = inode_set_ctime_to_ts(inode,
-                                                    inode_set_ctime_current(dir));
+               dir->i_mtime = inode_set_ctime_to_ts(
+                       inode, inode_set_ctime_current(dir));
                mark_inode_dirty(inode);
                mark_inode_dirty(dir);
                d_instantiate(de, inode);
@@ -373,7 +373,7 @@ static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
 
 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
        if (IS_POSIXACL(dir)) {
-               /* 
+               /*
                 * Load in cache current acl to avoid ni_lock(dir):
                 * ntfs_create_inode -> ntfs_init_acl -> posix_acl_create ->
                 * ntfs_get_acl -> ntfs_get_acl_ex -> ni_lock
index 98b76d1b09e78774acbc614ed7f33c42b608912f..86aecbb01a92f282ab621a26df9897b70b65df28 100644 (file)
@@ -847,7 +847,7 @@ struct OBJECT_ID {
        // Birth Volume Id is the Object Id of the Volume on.
        // which the Object Id was allocated. It never changes.
        struct GUID BirthVolumeId; //0x10:
-       
+
        // Birth Object Id is the first Object Id that was
        // ever assigned to this MFT Record. I.e. If the Object Id
        // is changed for some reason, this field will reflect the
index 788567d71d939a355ba34ddbbfa614897f2bb2c2..0e6a2777870c3e26d1ae2219b31f89c92b22f2ca 100644 (file)
@@ -497,8 +497,6 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
                 struct kstat *stat, u32 request_mask, u32 flags);
 int ntfs3_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
                  struct iattr *attr);
-void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
-                        CLST len);
 int ntfs_file_open(struct inode *inode, struct file *file);
 int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                __u64 start, __u64 len);
index 02cc91ed88357c6b27876d59754a17b5b62ab3f8..53629b1f65e995978cef9b312462447305cb578d 100644 (file)
@@ -189,6 +189,12 @@ out:
        return err;
 }
 
+/*
+ * mi_enum_attr - start/continue attributes enumeration in record.
+ *
+ * NOTE: mi->mrec - memory of size sbi->record_size
+ * here we sure that mi->mrec->total == sbi->record_size (see mi_read)
+ */
 struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
 {
        const struct MFT_REC *rec = mi->mrec;
index d2951b23f52a50cd8650b54e21de7d880d742e81..f9a2143671135b4064d582b18318c6871da53331 100644 (file)
@@ -488,7 +488,6 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
 {
        int err;
        struct super_block *sb = pde_data(file_inode(file));
-       struct ntfs_sb_info *sbi = sb->s_fs_info;
        ssize_t ret = count;
        u8 *label = kmalloc(count, GFP_NOFS);
 
@@ -502,7 +501,7 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
        while (ret > 0 && label[ret - 1] == '\n')
                ret -= 1;
 
-       err = ntfs_set_label(sbi, label, ret);
+       err = ntfs_set_label(sb->s_fs_info, label, ret);
 
        if (err < 0) {
                ntfs_err(sb, "failed (%d) to write label", err);
@@ -1082,10 +1081,10 @@ check_boot:
 
        if (bh->b_blocknr && !sb_rdonly(sb)) {
                /*
-            * Alternative boot is ok but primary is not ok.
-            * Do not update primary boot here 'cause it may be faked boot.
-            * Let ntfs to be mounted and update boot later.
-            */
+                * Alternative boot is ok but primary is not ok.
+                * Do not update primary boot here 'cause it may be faked boot.
+                * Let ntfs to be mounted and update boot later.
+                */
                *boot2 = kmemdup(boot, sizeof(*boot), GFP_NOFS | __GFP_NOWARN);
        }
 
@@ -1549,9 +1548,9 @@ load_root:
 
        if (boot2) {
                /*
-            * Alternative boot is ok but primary is not ok.
-            * Volume is recognized as NTFS. Update primary boot.
-            */
+                * Alternative boot is ok but primary is not ok.
+                * Volume is recognized as NTFS. Update primary boot.
+                */
                struct buffer_head *bh0 = sb_getblk(sb, 0);
                if (bh0) {
                        if (buffer_locked(bh0))
@@ -1785,7 +1784,6 @@ static int __init init_ntfs_fs(void)
        if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS))
                pr_info("ntfs3: Read-only LZX/Xpress compression included\n");
 
-
 #ifdef CONFIG_PROC_FS
        /* Create "/proc/fs/ntfs3" */
        proc_info_root = proc_mkdir("fs/ntfs3", NULL);
@@ -1827,7 +1825,6 @@ static void __exit exit_ntfs_fs(void)
        if (proc_info_root)
                remove_proc_entry("fs/ntfs3", NULL);
 #endif
-
 }
 
 MODULE_LICENSE("GPL");