Skip to content

Commit f684073

Browse files
fs/ntfs3: Refactoring and comments
Signed-off-by: Konstantin Komarov <[email protected]>
1 parent dcc852e commit f684073

File tree

8 files changed

+25
-23
lines changed

8 files changed

+25
-23
lines changed

fs/ntfs3/attrib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,10 +1106,10 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
11061106
}
11071107
}
11081108

1109-
/*
1109+
/*
11101110
* The code below may require additional cluster (to extend attribute list)
1111-
* and / or one MFT record
1112-
* It is too complex to undo operations if -ENOSPC occurs deep inside
1111+
* and / or one MFT record
1112+
* It is too complex to undo operations if -ENOSPC occurs deep inside
11131113
* in 'ni_insert_nonresident'.
11141114
* Return in advance -ENOSPC here if there are no free cluster and no free MFT.
11151115
*/

fs/ntfs3/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
745745
}
746746

747747
static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos,
748-
struct pipe_inode_info *pipe,
749-
size_t len, unsigned int flags)
748+
struct pipe_inode_info *pipe, size_t len,
749+
unsigned int flags)
750750
{
751751
struct inode *inode = in->f_mapping->host;
752752
struct ntfs_inode *ni = ntfs_i(inode);

fs/ntfs3/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,8 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
16601660
d_instantiate(dentry, inode);
16611661

16621662
/* Set original time. inode times (i_ctime) may be changed in ntfs_init_acl. */
1663-
inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, ni->i_crtime);
1663+
inode->i_atime = inode->i_mtime =
1664+
inode_set_ctime_to_ts(inode, ni->i_crtime);
16641665
dir->i_mtime = inode_set_ctime_to_ts(dir, ni->i_crtime);
16651666

16661667
mark_inode_dirty(dir);

fs/ntfs3/namei.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ static int ntfs_link(struct dentry *ode, struct inode *dir, struct dentry *de)
156156
err = ntfs_link_inode(inode, de);
157157

158158
if (!err) {
159-
dir->i_mtime = inode_set_ctime_to_ts(inode,
160-
inode_set_ctime_current(dir));
159+
dir->i_mtime = inode_set_ctime_to_ts(
160+
inode, inode_set_ctime_current(dir));
161161
mark_inode_dirty(inode);
162162
mark_inode_dirty(dir);
163163
d_instantiate(de, inode);
@@ -373,7 +373,7 @@ static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
373373

374374
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
375375
if (IS_POSIXACL(dir)) {
376-
/*
376+
/*
377377
* Load in cache current acl to avoid ni_lock(dir):
378378
* ntfs_create_inode -> ntfs_init_acl -> posix_acl_create ->
379379
* ntfs_get_acl -> ntfs_get_acl_ex -> ni_lock

fs/ntfs3/ntfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ struct OBJECT_ID {
847847
// Birth Volume Id is the Object Id of the Volume on.
848848
// which the Object Id was allocated. It never changes.
849849
struct GUID BirthVolumeId; //0x10:
850-
850+
851851
// Birth Object Id is the first Object Id that was
852852
// ever assigned to this MFT Record. I.e. If the Object Id
853853
// is changed for some reason, this field will reflect the

fs/ntfs3/ntfs_fs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,6 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
497497
struct kstat *stat, u32 request_mask, u32 flags);
498498
int ntfs3_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
499499
struct iattr *attr);
500-
void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
501-
CLST len);
502500
int ntfs_file_open(struct inode *inode, struct file *file);
503501
int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
504502
__u64 start, __u64 len);

fs/ntfs3/record.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ int mi_read(struct mft_inode *mi, bool is_mft)
189189
return err;
190190
}
191191

192+
/*
193+
* mi_enum_attr - start/continue attributes enumeration in record.
194+
*
195+
* NOTE: mi->mrec - memory of size sbi->record_size
196+
* here we sure that mi->mrec->total == sbi->record_size (see mi_read)
197+
*/
192198
struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
193199
{
194200
const struct MFT_REC *rec = mi->mrec;

fs/ntfs3/super.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
488488
{
489489
int err;
490490
struct super_block *sb = pde_data(file_inode(file));
491-
struct ntfs_sb_info *sbi = sb->s_fs_info;
492491
ssize_t ret = count;
493492
u8 *label = kmalloc(count, GFP_NOFS);
494493

@@ -502,7 +501,7 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
502501
while (ret > 0 && label[ret - 1] == '\n')
503502
ret -= 1;
504503

505-
err = ntfs_set_label(sbi, label, ret);
504+
err = ntfs_set_label(sb->s_fs_info, label, ret);
506505

507506
if (err < 0) {
508507
ntfs_err(sb, "failed (%d) to write label", err);
@@ -1082,10 +1081,10 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
10821081

10831082
if (bh->b_blocknr && !sb_rdonly(sb)) {
10841083
/*
1085-
* Alternative boot is ok but primary is not ok.
1086-
* Do not update primary boot here 'cause it may be faked boot.
1087-
* Let ntfs to be mounted and update boot later.
1088-
*/
1084+
* Alternative boot is ok but primary is not ok.
1085+
* Do not update primary boot here 'cause it may be faked boot.
1086+
* Let ntfs to be mounted and update boot later.
1087+
*/
10891088
*boot2 = kmemdup(boot, sizeof(*boot), GFP_NOFS | __GFP_NOWARN);
10901089
}
10911090

@@ -1549,9 +1548,9 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
15491548

15501549
if (boot2) {
15511550
/*
1552-
* Alternative boot is ok but primary is not ok.
1553-
* Volume is recognized as NTFS. Update primary boot.
1554-
*/
1551+
* Alternative boot is ok but primary is not ok.
1552+
* Volume is recognized as NTFS. Update primary boot.
1553+
*/
15551554
struct buffer_head *bh0 = sb_getblk(sb, 0);
15561555
if (bh0) {
15571556
if (buffer_locked(bh0))
@@ -1785,7 +1784,6 @@ static int __init init_ntfs_fs(void)
17851784
if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS))
17861785
pr_info("ntfs3: Read-only LZX/Xpress compression included\n");
17871786

1788-
17891787
#ifdef CONFIG_PROC_FS
17901788
/* Create "/proc/fs/ntfs3" */
17911789
proc_info_root = proc_mkdir("fs/ntfs3", NULL);
@@ -1827,7 +1825,6 @@ static void __exit exit_ntfs_fs(void)
18271825
if (proc_info_root)
18281826
remove_proc_entry("fs/ntfs3", NULL);
18291827
#endif
1830-
18311828
}
18321829

18331830
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)