ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: Restyle comments to better align with kernel-doc
@ 2021-08-31 16:38 Konstantin Komarov
  2021-08-31 19:56 ` Kari Argillander
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Komarov @ 2021-08-31 16:38 UTC (permalink / raw)
  To: ntfs3; +Cc: linux-kernel, sfr

Capitalize comments and end with period for better reading.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/ntfs3/attrib.c  | 18 +++++++++++-------
 fs/ntfs3/bitmap.c  |  5 ++---
 fs/ntfs3/file.c    | 18 +++++++++---------
 fs/ntfs3/frecord.c | 27 +++++++++++++--------------
 fs/ntfs3/fslog.c   | 11 +++++++----
 fs/ntfs3/fsntfs.c  |  8 ++++----
 fs/ntfs3/index.c   |  8 +++++---
 fs/ntfs3/inode.c   | 20 ++++++++++----------
 fs/ntfs3/lznt.c    |  5 +++--
 fs/ntfs3/ntfs.h    |  2 +-
 fs/ntfs3/ntfs_fs.h | 24 ++++++++++++------------
 fs/ntfs3/record.c  |  2 +-
 fs/ntfs3/super.c   |  2 +-
 fs/ntfs3/upcase.c  |  2 +-
 fs/ntfs3/xattr.c   |  7 ++++---
 15 files changed, 84 insertions(+), 75 deletions(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index ffc323bacc9f..34c4cbf7e29b 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -199,6 +199,7 @@ int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
 
 		/* Add new fragment into run storage. */
 		if (!run_add_entry(run, vcn, lcn, flen, opt == ALLOCATE_MFT)) {
+			/* Undo last 'ntfs_look_for_free_space' */
 			down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS);
 			wnd_set_free(wnd, lcn, flen);
 			up_write(&wnd->rw_lock);
@@ -351,7 +352,6 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
 	run_close(run);
 out1:
 	kfree(attr_s);
-	/* Reinsert le. */
 out:
 	return err;
 }
@@ -1153,14 +1153,18 @@ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
 	u16 ro;
 
 	attr = ni_find_attr(ni, NULL, NULL, type, name, name_len, &vcn, NULL);
-	if (!attr)
+	if (!attr) {
+		/* Is record corrupted? */
 		return -ENOENT;
+	}
 
 	svcn = le64_to_cpu(attr->nres.svcn);
 	evcn = le64_to_cpu(attr->nres.evcn);
 
-	if (evcn < vcn || vcn < svcn)
+	if (evcn < vcn || vcn < svcn) {
+		/* Is record corrupted? */
 		return -EINVAL;
+	}
 
 	ro = le16_to_cpu(attr->nres.run_off);
 	err = run_unpack_ex(run, ni->mi.sbi, ni->mi.rno, svcn, evcn, svcn,
@@ -1171,7 +1175,7 @@ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
 }
 
 /*
- * attr_wof_load_runs_range - Load runs for given range [from to).
+ * attr_load_runs_range - Load runs for given range [from to).
  */
 int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
 			 const __le16 *name, u8 name_len, struct runs_tree *run,
@@ -1974,7 +1978,7 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size)
 	total_size = le64_to_cpu(attr_b->nres.total_size);
 
 	if (vbo >= alloc_size) {
-		// NOTE: It is allowed.
+		/* NOTE: It is allowed. */
 		return 0;
 	}
 
@@ -1986,9 +1990,9 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size)
 	bytes -= vbo;
 
 	if ((vbo & mask) || (bytes & mask)) {
-		/* We have to zero a range(s)*/
+		/* We have to zero a range(s). */
 		if (frame_size == NULL) {
-			/* Caller insists range is aligned */
+			/* Caller insists range is aligned. */
 			return -EINVAL;
 		}
 		*frame_size = mask + 1;
diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index 06ae38adb8ad..831501555009 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -29,7 +29,6 @@ struct rb_node_key {
 	size_t key;
 };
 
-/* Tree is sorted by start (key). */
 struct e_node {
 	struct rb_node_key start; /* Tree sorted by start. */
 	struct rb_node_key count; /* Tree sorted by len. */
@@ -1117,7 +1116,7 @@ size_t wnd_find(struct wnd_bitmap *wnd, size_t to_alloc, size_t hint,
 	sb = wnd->sb;
 	log2_bits = sb->s_blocksize_bits + 3;
 
-	/* At most two ranges [hint, max_alloc) + [0, hint) */
+	/* At most two ranges [hint, max_alloc) + [0, hint). */
 Again:
 
 	/* TODO: Optimize request for case nbits > wbits. */
@@ -1241,7 +1240,7 @@ size_t wnd_find(struct wnd_bitmap *wnd, size_t to_alloc, size_t hint,
 			continue;
 		}
 
-		/* Read window */
+		/* Read window. */
 		bh = wnd_map(wnd, iw);
 		if (IS_ERR(bh)) {
 			// TODO: Error.
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 62ebfa324bff..89557d60a9b0 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -190,7 +190,8 @@ static int ntfs_extend_initialized_size(struct file *file,
 
 /*
  * ntfs_zero_range - Helper function for punch_hole.
- * It zeroes a range [vbo, vbo_to)
+ *
+ * It zeroes a range [vbo, vbo_to).
  */
 static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
 {
@@ -231,12 +232,12 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
 
 			if (!buffer_mapped(bh)) {
 				ntfs_get_block(inode, iblock, bh, 0);
-				/* unmapped? It's a hole - nothing to do */
+				/* Unmapped? It's a hole - nothing to do. */
 				if (!buffer_mapped(bh))
 					continue;
 			}
 
-			/* Ok, it's mapped. Make sure it's up-to-date */
+			/* Ok, it's mapped. Make sure it's up-to-date. */
 			if (PageUptodate(page))
 				set_buffer_uptodate(bh);
 
@@ -272,9 +273,8 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
 }
 
 /*
- * ntfs_sparse_cluster
+ * ntfs_sparse_cluster - Helper function to zero a new allocated clusters.
  *
- * Helper function to zero a new allocated clusters
  * NOTE: 512 <= cluster size <= 2M
  */
 void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
@@ -588,7 +588,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
 		truncate_pagecache(inode, vbo_down);
 
 		if (!is_sparsed(ni) && !is_compressed(ni)) {
-			/* normal file */
+			/* Normal file. */
 			err = ntfs_zero_range(inode, vbo, end);
 			goto out;
 		}
@@ -599,7 +599,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
 		if (err != E_NTFS_NOTALIGNED)
 			goto out;
 
-		/* process not aligned punch */
+		/* Process not aligned punch. */
 		mask = frame_size - 1;
 		vbo_a = (vbo + mask) & ~mask;
 		end_a = end & ~mask;
@@ -647,7 +647,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
 		if (err)
 			goto out;
 
-		/* Wait for existing dio to complete */
+		/* Wait for existing dio to complete. */
 		inode_dio_wait(inode);
 
 		truncate_pagecache(inode, vbo_down);
@@ -1127,7 +1127,7 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 		goto out;
 
 	if (WARN_ON(ni->ni_flags & NI_FLAG_COMPRESSED_MASK)) {
-		/* Should never be here, see ntfs_file_open() */
+		/* Should never be here, see ntfs_file_open(). */
 		ret = -EOPNOTSUPP;
 		goto out;
 	}
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 3f48b612ec96..938b12d56ca6 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -56,7 +56,7 @@ static struct mft_inode *ni_find_mi(struct ntfs_inode *ni, CLST rno)
 
 /*
  * ni_add_mi - Add new mft_inode into ntfs_inode.
-*/
+ */
 static void ni_add_mi(struct ntfs_inode *ni, struct mft_inode *mi)
 {
 	ni_ins_mi(ni, &ni->mi_tree, mi->rno, &mi->node);
@@ -70,9 +70,8 @@ void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi)
 	rb_erase(&mi->node, &ni->mi_tree);
 }
 
-/* ni_std
- *
- * Return: Pointer into std_info from primary record.
+/*
+ * ni_std - Return: Pointer into std_info from primary record.
  */
 struct ATTR_STD_INFO *ni_std(struct ntfs_inode *ni)
 {
@@ -385,7 +384,7 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi)
 
 /*
  * ni_remove_attr - Remove all attributes for the given type/name/id.
-*/
+ */
 int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
 		   const __le16 *name, size_t name_len, bool base_only,
 		   const __le16 *id)
@@ -740,7 +739,7 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
 
 /*
  * ni_create_attr_list - Generates an attribute list for this primary record.
-*/
+ */
 int ni_create_attr_list(struct ntfs_inode *ni)
 {
 	struct ntfs_sb_info *sbi = ni->mi.sbi;
@@ -939,7 +938,7 @@ static int ni_ins_attr_ext(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le,
 		if (is_mft_data &&
 		    (mi_enum_attr(mi, NULL) ||
 		     vbo <= ((u64)mi->rno << sbi->record_bits))) {
-			/* We can't accept this record 'case MFT's bootstrapping. */
+			/* We can't accept this record 'cause MFT's bootstrapping. */
 			continue;
 		}
 		if (is_mft &&
@@ -1078,7 +1077,7 @@ static int ni_insert_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
 	 */
 	max_free = free;
 
-	/* Estimate the result of moving all possible attributes away.*/
+	/* Estimate the result of moving all possible attributes away. */
 	attr = NULL;
 
 	while ((attr = mi_enum_attr(&ni->mi, attr))) {
@@ -1095,7 +1094,7 @@ static int ni_insert_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
 		goto out;
 	}
 
-	/* Start real attribute moving */
+	/* Start real attribute moving. */
 	attr = NULL;
 
 	for (;;) {
@@ -1542,7 +1541,7 @@ int ni_delete_all(struct ntfs_inode *ni)
 		node = next;
 	}
 
-	/* Free base record */
+	/* Free base record. */
 	clear_rec_inuse(ni->mi.mrec);
 	ni->mi.dirty = true;
 	err = mi_write(&ni->mi, 0);
@@ -2243,7 +2242,7 @@ int ni_decompress_file(struct ntfs_inode *ni)
 	}
 
 	if (attr->non_res && is_attr_sparsed(attr)) {
-		/* Sarsed attribute header is 8 bytes bigger than normal. */
+		/* Sparsed attribute header is 8 bytes bigger than normal. */
 		struct MFT_REC *rec = mi->mrec;
 		u32 used = le32_to_cpu(rec->used);
 		u32 asize = le32_to_cpu(attr->size);
@@ -2324,7 +2323,7 @@ static int decompress_lzx_xpress(struct ntfs_sb_info *sbi, const char *cmpr,
 		mutex_lock(&sbi->compress.mtx_xpress);
 		ctx = sbi->compress.xpress;
 		if (!ctx) {
-			/* Lazy initialize Xpress decompress context */
+			/* Lazy initialize Xpress decompress context. */
 			ctx = xpress_allocate_decompressor();
 			if (!ctx) {
 				err = -ENOMEM;
@@ -2348,7 +2347,7 @@ static int decompress_lzx_xpress(struct ntfs_sb_info *sbi, const char *cmpr,
 /*
  * ni_read_frame
  *
- * Pages - array of locked pages.
+ * Pages - Array of locked pages.
  */
 int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
 		  u32 pages_per_frame)
@@ -2740,7 +2739,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
 		lznt = NULL;
 	}
 
-	/* Compress: frame_mem -> frame_ondisk. */
+	/* Compress: frame_mem -> frame_ondisk */
 	compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk,
 				   frame_size, sbi->compress.lznt);
 	mutex_unlock(&sbi->compress.mtx_lznt);
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 6f6057129fdd..b5853aed0e25 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -1362,7 +1362,8 @@ static void log_create(struct ntfs_log *log, u32 l_size, const u64 last_lsn,
 	/* Compute the log page values. */
 	log->data_off = ALIGN(
 		offsetof(struct RECORD_PAGE_HDR, fixups) +
-		sizeof(short) * ((log->page_size >> SECTOR_SHIFT) + 1), 8);
+			sizeof(short) * ((log->page_size >> SECTOR_SHIFT) + 1),
+		8);
 	log->data_size = log->page_size - log->data_off;
 	log->record_header_len = sizeof(struct LFS_RECORD_HDR);
 
@@ -1372,7 +1373,9 @@ static void log_create(struct ntfs_log *log, u32 l_size, const u64 last_lsn,
 	/* Compute the restart page values. */
 	log->ra_off = ALIGN(
 		offsetof(struct RESTART_HDR, fixups) +
-		sizeof(short) * ((log->sys_page_size >> SECTOR_SHIFT) + 1), 8);
+			sizeof(short) *
+				((log->sys_page_size >> SECTOR_SHIFT) + 1),
+		8);
 	log->restart_size = log->sys_page_size - log->ra_off;
 	log->ra_size = struct_size(log->ra, clients, 1);
 	log->current_openlog_count = open_log_count;
@@ -5132,8 +5135,8 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 	rh->sys_page_size = cpu_to_le32(log->page_size);
 	rh->page_size = cpu_to_le32(log->page_size);
 
-	t16 = ALIGN(offsetof(struct RESTART_HDR, fixups) +
-		    sizeof(short) * t16, 8);
+	t16 = ALIGN(offsetof(struct RESTART_HDR, fixups) + sizeof(short) * t16,
+		    8);
 	rh->ra_off = cpu_to_le16(t16);
 	rh->minor_ver = cpu_to_le16(1); // 0x1A:
 	rh->major_ver = cpu_to_le16(1); // 0x1C:
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 669249439217..91e3743e1442 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -312,7 +312,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi)
 	if (sb_rdonly(sb) || !initialized)
 		goto out;
 
-	/* Fill LogFile by '-1' if it is initialized.ssss */
+	/* Fill LogFile by '-1' if it is initialized. */
 	err = ntfs_bio_fill_1(sbi, &ni->file.run);
 
 out:
@@ -960,10 +960,10 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
 	/* verify(!ntfs_update_mftmirr()); */
 
 	/*
-	 * if we used wait=1, sync_inode_metadata waits for the io for the
+	 * If we used wait=1, sync_inode_metadata waits for the io for the
 	 * inode to finish. It hangs when media is removed.
 	 * So wait=0 is sent down to sync_inode_metadata
-	 * and filemap_fdatawrite is used for the data blocks
+	 * and filemap_fdatawrite is used for the data blocks.
 	 */
 	err = sync_inode_metadata(&ni->vfs_inode, 0);
 	if (!err)
@@ -1917,7 +1917,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
 	sbi->security.next_id = SECURITY_ID_FIRST;
 	/* Always write new security at the end of bucket. */
 	sbi->security.next_off =
-			ALIGN(sds_size - SecurityDescriptorsBlockSize, 16);
+		ALIGN(sds_size - SecurityDescriptorsBlockSize, 16);
 
 	off = 0;
 	ne = NULL;
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 1224b8e42b3e..0daca9adc54c 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -2624,17 +2624,19 @@ int indx_update_dup(struct ntfs_inode *ni, struct ntfs_sb_info *sbi,
 	e_fname = (struct ATTR_FILE_NAME *)(e + 1);
 
 	if (!memcmp(&e_fname->dup, dup, sizeof(*dup))) {
-		/* Nothing to update in index! Try to avoid this call. */
+		/*
+		 * Nothing to update in index! Try to avoid this call.
+		 */
 		goto out;
 	}
 
 	memcpy(&e_fname->dup, dup, sizeof(*dup));
 
 	if (fnd->level) {
-		/* directory entry in index */
+		/* Directory entry in index. */
 		err = indx_write(indx, ni, fnd->nodes[fnd->level - 1], sync);
 	} else {
-		/* directory entry in directory MFT record */
+		/* Directory entry in directory MFT record. */
 		mi->dirty = true;
 		if (sync)
 			err = mi_write(mi, 1);
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 8f72066b3229..db2a5a4c38e4 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -89,7 +89,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 	}
 
 	if (le32_to_cpu(rec->total) != sbi->record_size) {
-		// Bad inode?
+		/* Bad inode? */
 		err = -EINVAL;
 		goto out;
 	}
@@ -605,7 +605,7 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo,
 		if (vbo >= valid)
 			set_buffer_new(bh);
 	} else if (create) {
-		/*normal write*/
+		/* Normal write. */
 		if (bytes > bh->b_size)
 			bytes = bh->b_size;
 
@@ -1091,7 +1091,7 @@ int inode_write_data(struct inode *inode, const void *data, size_t bytes)
 /*
  * ntfs_reparse_bytes
  *
- * Number of bytes to for REPARSE_DATA_BUFFER(IO_REPARSE_TAG_SYMLINK)
+ * Number of bytes for REPARSE_DATA_BUFFER(IO_REPARSE_TAG_SYMLINK)
  * for unicode string of @uni_len length.
  */
 static inline u32 ntfs_reparse_bytes(u32 uni_len)
@@ -1205,13 +1205,13 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
 		return ERR_PTR(-EINVAL);
 
 	if (S_ISDIR(mode)) {
-		/* use parent's directory attributes */
+		/* Use parent's directory attributes. */
 		fa = dir_ni->std_fa | FILE_ATTRIBUTE_DIRECTORY |
 		     FILE_ATTRIBUTE_ARCHIVE;
 		/*
-		 * By default child directory inherits parent attributes
-		 * root directory is hidden + system
-		 * Make an exception for children in root
+		 * By default child directory inherits parent attributes.
+		 * Root directory is hidden + system.
+		 * Make an exception for children in root.
 		 */
 		if (dir->i_ino == MFT_REC_ROOT)
 			fa &= ~(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
@@ -1220,8 +1220,8 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
 		fa = FILE_ATTRIBUTE_REPARSE_POINT;
 
 		/*
-		 * linux: there are dir/file/symlink and so on.
-		 * NTFS: symlinks are "dir + reparse" or "file + reparse".
+		 * Linux: there are dir/file/symlink and so on.
+		 * NTFS: symlinks are "dir + reparse" or "file + reparse"
 		 * It is good idea to create:
 		 * dir + reparse if 'symname' points to directory
 		 * or
@@ -1860,7 +1860,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer,
 
 	default:
 		if (IsReparseTagMicrosoft(rp->ReparseTag)) {
-			/* unknown Microsoft Tag */
+			/* Unknown Microsoft Tag. */
 			goto out;
 		}
 		if (!IsReparseTagNameSurrogate(rp->ReparseTag) ||
diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
index 3acf0d9f0b15..f1f691a67cc4 100644
--- a/fs/ntfs3/lznt.c
+++ b/fs/ntfs3/lznt.c
@@ -296,8 +296,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
  */
 struct lznt *get_lznt_ctx(int level)
 {
-	struct lznt *r = kzalloc(level ? offsetof(struct lznt, hash) :
-					 sizeof(struct lznt), GFP_NOFS);
+	struct lznt *r = kzalloc(level ? offsetof(struct lznt, hash)
+				       : sizeof(struct lznt),
+				 GFP_NOFS);
 
 	if (r)
 		r->std = !level;
diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
index 0fd7bffb98d4..6bb3e595263b 100644
--- a/fs/ntfs3/ntfs.h
+++ b/fs/ntfs3/ntfs.h
@@ -262,7 +262,7 @@ enum RECORD_FLAG {
 	RECORD_FLAG_UNKNOWN	= cpu_to_le16(0x0008),
 };
 
-/* MFT Record structure, */
+/* MFT Record structure. */
 struct MFT_REC {
 	struct NTFS_RECORD_HEADER rhdr; // 'FILE'
 
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index f9436cbbc347..97e682ebcfb9 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -59,18 +59,18 @@ struct ntfs_mount_options {
 	u16 fs_fmask_inv;
 	u16 fs_dmask_inv;
 
-	unsigned uid : 1,	/* uid was set. */
-		gid : 1,	/* gid was set. */
-		fmask : 1,	/* fmask was set. */
-		dmask : 1,	/* dmask was set. */
-		sys_immutable : 1,/* Immutable system files. */
-		discard : 1,	/* Issue discard requests on deletions. */
-		sparse : 1,	/* Create sparse files. */
-		showmeta : 1,	/* Show meta files. */
-		nohidden : 1, 	/* Do not show hidden files. */
-		force : 1, 	/* Rw mount dirty volume. */
-		no_acs_rules : 1,/*Exclude acs rules. */
-		prealloc : 1	/* Preallocate space when file is growing. */
+	unsigned uid : 1, /* uid was set. */
+		gid : 1, /* gid was set. */
+		fmask : 1, /* fmask was set. */
+		dmask : 1, /* dmask was set. */
+		sys_immutable : 1, /* Immutable system files. */
+		discard : 1, /* Issue discard requests on deletions. */
+		sparse : 1, /* Create sparse files. */
+		showmeta : 1, /* Show meta files. */
+		nohidden : 1, /* Do not show hidden files. */
+		force : 1, /* Rw mount dirty volume. */
+		no_acs_rules : 1, /*Exclude acs rules. */
+		prealloc : 1 /* Preallocate space when file is growing. */
 		;
 };
 
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 61e3f2fb619f..103705c86772 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -219,7 +219,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
 
 		asize = le32_to_cpu(attr->size);
 		if (asize < SIZEOF_RESIDENT) {
-			/* Impossible 'cause we should not return such attribute */
+			/* Impossible 'cause we should not return such attribute. */
 			return NULL;
 		}
 
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 2fbab8a931ee..dbecf095da59 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1053,7 +1053,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
 
 	iput(inode);
 
-	/* Load $LogFile to replay. */
+	/* Load LogFile to replay. */
 	ref.low = cpu_to_le32(MFT_REC_LOG);
 	ref.seq = cpu_to_le16(MFT_REC_LOG);
 	inode = ntfs_iget5(sb, &ref, &NAME_LOGFILE);
diff --git a/fs/ntfs3/upcase.c b/fs/ntfs3/upcase.c
index eb65bbd939e8..bbeba778237e 100644
--- a/fs/ntfs3/upcase.c
+++ b/fs/ntfs3/upcase.c
@@ -34,7 +34,7 @@ static inline u16 upcase_unicode_char(const u16 *upcase, u16 chr)
  * - Case insensitive
  * - If name equals and 'bothcases' then
  * - Case sensitive
- * 'Straigth way' code scans input names twice in worst case.
+ * 'Straight way' code scans input names twice in worst case.
  * Optimized code scans input names only once.
  */
 int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2,
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 22fd5eb32c5b..b15d532e4a17 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -26,9 +26,10 @@
 static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
 {
 	return ea->size ? le32_to_cpu(ea->size)
-			: ALIGN(struct_size(
-			      ea, name,
-			      1 + ea->name_len + le16_to_cpu(ea->elength)), 4);
+			: ALIGN(struct_size(ea, name,
+					    1 + ea->name_len +
+						    le16_to_cpu(ea->elength)),
+				4);
 }
 
 static inline size_t packed_ea_size(const struct EA_FULL *ea)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/ntfs3: Restyle comments to better align with kernel-doc
  2021-08-31 16:38 [PATCH] fs/ntfs3: Restyle comments to better align with kernel-doc Konstantin Komarov
@ 2021-08-31 19:56 ` Kari Argillander
  0 siblings, 0 replies; 2+ messages in thread
From: Kari Argillander @ 2021-08-31 19:56 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: ntfs3, linux-kernel, sfr

sfr@canb.auug.org.au

This was in cc. Is this accident?

This is already in git repo. Please submit patch first to review process
before apply it to master. I still comment here as I do not know if you
are going to revert or rebase.

On Tue, Aug 31, 2021 at 07:38:27PM +0300, Konstantin Komarov wrote:
> Capitalize comments and end with period for better reading.

This is better commit header without "for better reading".

> 
> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
> ---
>  fs/ntfs3/attrib.c  | 18 +++++++++++-------
>  fs/ntfs3/bitmap.c  |  5 ++---
>  fs/ntfs3/file.c    | 18 +++++++++---------
>  fs/ntfs3/frecord.c | 27 +++++++++++++--------------
>  fs/ntfs3/fslog.c   | 11 +++++++----
>  fs/ntfs3/fsntfs.c  |  8 ++++----
>  fs/ntfs3/index.c   |  8 +++++---
>  fs/ntfs3/inode.c   | 20 ++++++++++----------
>  fs/ntfs3/lznt.c    |  5 +++--
>  fs/ntfs3/ntfs.h    |  2 +-
>  fs/ntfs3/ntfs_fs.h | 24 ++++++++++++------------
>  fs/ntfs3/record.c  |  2 +-
>  fs/ntfs3/super.c   |  2 +-
>  fs/ntfs3/upcase.c  |  2 +-
>  fs/ntfs3/xattr.c   |  7 ++++---
>  15 files changed, 84 insertions(+), 75 deletions(-)
> 
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index ffc323bacc9f..34c4cbf7e29b 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -199,6 +199,7 @@ int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
>  
>  		/* Add new fragment into run storage. */
>  		if (!run_add_entry(run, vcn, lcn, flen, opt == ALLOCATE_MFT)) {
> +			/* Undo last 'ntfs_look_for_free_space' */
>  			down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS);
>  			wnd_set_free(wnd, lcn, flen);
>  			up_write(&wnd->rw_lock);
> @@ -351,7 +352,6 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
>  	run_close(run);
>  out1:
>  	kfree(attr_s);
> -	/* Reinsert le. */
>  out:
>  	return err;
>  }
> @@ -1153,14 +1153,18 @@ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  	u16 ro;
>  
>  	attr = ni_find_attr(ni, NULL, NULL, type, name, name_len, &vcn, NULL);
> -	if (!attr)
> +	if (!attr) {
> +		/* Is record corrupted? */
>  		return -ENOENT;
> +	}
>  
>  	svcn = le64_to_cpu(attr->nres.svcn);
>  	evcn = le64_to_cpu(attr->nres.evcn);
>  
> -	if (evcn < vcn || vcn < svcn)
> +	if (evcn < vcn || vcn < svcn) {
> +		/* Is record corrupted? */
>  		return -EINVAL;
> +	}
>  
>  	ro = le16_to_cpu(attr->nres.run_off);
>  	err = run_unpack_ex(run, ni->mi.sbi, ni->mi.rno, svcn, evcn, svcn,
> @@ -1171,7 +1175,7 @@ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  }
>  
>  /*
> - * attr_wof_load_runs_range - Load runs for given range [from to).
> + * attr_load_runs_range - Load runs for given range [from to).
>   */
>  int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  			 const __le16 *name, u8 name_len, struct runs_tree *run,
> @@ -1974,7 +1978,7 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size)
>  	total_size = le64_to_cpu(attr_b->nres.total_size);
>  
>  	if (vbo >= alloc_size) {
> -		// NOTE: It is allowed.
> +		/* NOTE: It is allowed. */
>  		return 0;
>  	}
>  
> @@ -1986,9 +1990,9 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size)
>  	bytes -= vbo;
>  
>  	if ((vbo & mask) || (bytes & mask)) {
> -		/* We have to zero a range(s)*/
> +		/* We have to zero a range(s). */
>  		if (frame_size == NULL) {
> -			/* Caller insists range is aligned */
> +			/* Caller insists range is aligned. */
>  			return -EINVAL;
>  		}
>  		*frame_size = mask + 1;
> diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
> index 06ae38adb8ad..831501555009 100644
> --- a/fs/ntfs3/bitmap.c
> +++ b/fs/ntfs3/bitmap.c
> @@ -29,7 +29,6 @@ struct rb_node_key {
>  	size_t key;
>  };
>  
> -/* Tree is sorted by start (key). */
>  struct e_node {
>  	struct rb_node_key start; /* Tree sorted by start. */
>  	struct rb_node_key count; /* Tree sorted by len. */
> @@ -1117,7 +1116,7 @@ size_t wnd_find(struct wnd_bitmap *wnd, size_t to_alloc, size_t hint,
>  	sb = wnd->sb;
>  	log2_bits = sb->s_blocksize_bits + 3;
>  
> -	/* At most two ranges [hint, max_alloc) + [0, hint) */
> +	/* At most two ranges [hint, max_alloc) + [0, hint). */
>  Again:
>  
>  	/* TODO: Optimize request for case nbits > wbits. */
> @@ -1241,7 +1240,7 @@ size_t wnd_find(struct wnd_bitmap *wnd, size_t to_alloc, size_t hint,
>  			continue;
>  		}
>  
> -		/* Read window */
> +		/* Read window. */
>  		bh = wnd_map(wnd, iw);
>  		if (IS_ERR(bh)) {
>  			// TODO: Error.
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 62ebfa324bff..89557d60a9b0 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -190,7 +190,8 @@ static int ntfs_extend_initialized_size(struct file *file,
>  
>  /*
>   * ntfs_zero_range - Helper function for punch_hole.
> - * It zeroes a range [vbo, vbo_to)
> + *
> + * It zeroes a range [vbo, vbo_to).
>   */
>  static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
>  {
> @@ -231,12 +232,12 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
>  
>  			if (!buffer_mapped(bh)) {
>  				ntfs_get_block(inode, iblock, bh, 0);
> -				/* unmapped? It's a hole - nothing to do */
> +				/* Unmapped? It's a hole - nothing to do. */
>  				if (!buffer_mapped(bh))
>  					continue;
>  			}
>  
> -			/* Ok, it's mapped. Make sure it's up-to-date */
> +			/* Ok, it's mapped. Make sure it's up-to-date. */
>  			if (PageUptodate(page))
>  				set_buffer_uptodate(bh);
>  
> @@ -272,9 +273,8 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
>  }
>  
>  /*
> - * ntfs_sparse_cluster
> + * ntfs_sparse_cluster - Helper function to zero a new allocated clusters.
>   *
> - * Helper function to zero a new allocated clusters
>   * NOTE: 512 <= cluster size <= 2M
>   */
>  void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn,
> @@ -588,7 +588,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
>  		truncate_pagecache(inode, vbo_down);
>  
>  		if (!is_sparsed(ni) && !is_compressed(ni)) {
> -			/* normal file */
> +			/* Normal file. */
>  			err = ntfs_zero_range(inode, vbo, end);
>  			goto out;
>  		}
> @@ -599,7 +599,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
>  		if (err != E_NTFS_NOTALIGNED)
>  			goto out;
>  
> -		/* process not aligned punch */
> +		/* Process not aligned punch. */
>  		mask = frame_size - 1;
>  		vbo_a = (vbo + mask) & ~mask;
>  		end_a = end & ~mask;
> @@ -647,7 +647,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
>  		if (err)
>  			goto out;
>  
> -		/* Wait for existing dio to complete */
> +		/* Wait for existing dio to complete. */
>  		inode_dio_wait(inode);
>  
>  		truncate_pagecache(inode, vbo_down);
> @@ -1127,7 +1127,7 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  		goto out;
>  
>  	if (WARN_ON(ni->ni_flags & NI_FLAG_COMPRESSED_MASK)) {
> -		/* Should never be here, see ntfs_file_open() */
> +		/* Should never be here, see ntfs_file_open(). */
>  		ret = -EOPNOTSUPP;
>  		goto out;
>  	}
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 3f48b612ec96..938b12d56ca6 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -56,7 +56,7 @@ static struct mft_inode *ni_find_mi(struct ntfs_inode *ni, CLST rno)
>  
>  /*
>   * ni_add_mi - Add new mft_inode into ntfs_inode.
> -*/
> + */
>  static void ni_add_mi(struct ntfs_inode *ni, struct mft_inode *mi)
>  {
>  	ni_ins_mi(ni, &ni->mi_tree, mi->rno, &mi->node);
> @@ -70,9 +70,8 @@ void ni_remove_mi(struct ntfs_inode *ni, struct mft_inode *mi)
>  	rb_erase(&mi->node, &ni->mi_tree);
>  }
>  
> -/* ni_std
> - *
> - * Return: Pointer into std_info from primary record.
> +/*
> + * ni_std - Return: Pointer into std_info from primary record.

If we want to follow kernel doc style then Return should be like it was.

>   */
>  struct ATTR_STD_INFO *ni_std(struct ntfs_inode *ni)
>  {
> @@ -385,7 +384,7 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi)
>  
>  /*
>   * ni_remove_attr - Remove all attributes for the given type/name/id.
> -*/
> + */
>  int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  		   const __le16 *name, size_t name_len, bool base_only,
>  		   const __le16 *id)
> @@ -740,7 +739,7 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
>  
>  /*
>   * ni_create_attr_list - Generates an attribute list for this primary record.
> -*/
> + */
>  int ni_create_attr_list(struct ntfs_inode *ni)
>  {
>  	struct ntfs_sb_info *sbi = ni->mi.sbi;
> @@ -939,7 +938,7 @@ static int ni_ins_attr_ext(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le,
>  		if (is_mft_data &&
>  		    (mi_enum_attr(mi, NULL) ||
>  		     vbo <= ((u64)mi->rno << sbi->record_bits))) {
> -			/* We can't accept this record 'case MFT's bootstrapping. */
> +			/* We can't accept this record 'cause MFT's bootstrapping. */

This should be splitted if we want kinda follow <= 80 rule.

>  			continue;
>  		}
>  		if (is_mft &&
> @@ -1078,7 +1077,7 @@ static int ni_insert_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  	 */
>  	max_free = free;
>  
> -	/* Estimate the result of moving all possible attributes away.*/
> +	/* Estimate the result of moving all possible attributes away. */
>  	attr = NULL;
>  
>  	while ((attr = mi_enum_attr(&ni->mi, attr))) {
> @@ -1095,7 +1094,7 @@ static int ni_insert_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
>  		goto out;
>  	}
>  
> -	/* Start real attribute moving */
> +	/* Start real attribute moving. */
>  	attr = NULL;
>  
>  	for (;;) {
> @@ -1542,7 +1541,7 @@ int ni_delete_all(struct ntfs_inode *ni)
>  		node = next;
>  	}
>  
> -	/* Free base record */
> +	/* Free base record. */
>  	clear_rec_inuse(ni->mi.mrec);
>  	ni->mi.dirty = true;
>  	err = mi_write(&ni->mi, 0);
> @@ -2243,7 +2242,7 @@ int ni_decompress_file(struct ntfs_inode *ni)
>  	}
>  
>  	if (attr->non_res && is_attr_sparsed(attr)) {
> -		/* Sarsed attribute header is 8 bytes bigger than normal. */
> +		/* Sparsed attribute header is 8 bytes bigger than normal. */
>  		struct MFT_REC *rec = mi->mrec;
>  		u32 used = le32_to_cpu(rec->used);
>  		u32 asize = le32_to_cpu(attr->size);
> @@ -2324,7 +2323,7 @@ static int decompress_lzx_xpress(struct ntfs_sb_info *sbi, const char *cmpr,
>  		mutex_lock(&sbi->compress.mtx_xpress);
>  		ctx = sbi->compress.xpress;
>  		if (!ctx) {
> -			/* Lazy initialize Xpress decompress context */
> +			/* Lazy initialize Xpress decompress context. */
>  			ctx = xpress_allocate_decompressor();
>  			if (!ctx) {
>  				err = -ENOMEM;
> @@ -2348,7 +2347,7 @@ static int decompress_lzx_xpress(struct ntfs_sb_info *sbi, const char *cmpr,
>  /*
>   * ni_read_frame
>   *
> - * Pages - array of locked pages.
> + * Pages - Array of locked pages.
>   */
>  int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
>  		  u32 pages_per_frame)
> @@ -2740,7 +2739,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
>  		lznt = NULL;
>  	}
>  
> -	/* Compress: frame_mem -> frame_ondisk. */
> +	/* Compress: frame_mem -> frame_ondisk */
>  	compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk,
>  				   frame_size, sbi->compress.lznt);
>  	mutex_unlock(&sbi->compress.mtx_lznt);
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 6f6057129fdd..b5853aed0e25 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -1362,7 +1362,8 @@ static void log_create(struct ntfs_log *log, u32 l_size, const u64 last_lsn,
>  	/* Compute the log page values. */
>  	log->data_off = ALIGN(
>  		offsetof(struct RECORD_PAGE_HDR, fixups) +
> -		sizeof(short) * ((log->page_size >> SECTOR_SHIFT) + 1), 8);
> +			sizeof(short) * ((log->page_size >> SECTOR_SHIFT) + 1),
> +		8);

This is not comment like commit message says.

>  	log->data_size = log->page_size - log->data_off;
>  	log->record_header_len = sizeof(struct LFS_RECORD_HDR);
>  
> @@ -1372,7 +1373,9 @@ static void log_create(struct ntfs_log *log, u32 l_size, const u64 last_lsn,
>  	/* Compute the restart page values. */
>  	log->ra_off = ALIGN(
>  		offsetof(struct RESTART_HDR, fixups) +
> -		sizeof(short) * ((log->sys_page_size >> SECTOR_SHIFT) + 1), 8);
> +			sizeof(short) *
> +				((log->sys_page_size >> SECTOR_SHIFT) + 1),
> +		8);

Same here.

>  	log->restart_size = log->sys_page_size - log->ra_off;
>  	log->ra_size = struct_size(log->ra, clients, 1);
>  	log->current_openlog_count = open_log_count;
> @@ -5132,8 +5135,8 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
>  	rh->sys_page_size = cpu_to_le32(log->page_size);
>  	rh->page_size = cpu_to_le32(log->page_size);
>  
> -	t16 = ALIGN(offsetof(struct RESTART_HDR, fixups) +
> -		    sizeof(short) * t16, 8);
> +	t16 = ALIGN(offsetof(struct RESTART_HDR, fixups) + sizeof(short) * t16,
> +		    8);

Same here.

>  	rh->ra_off = cpu_to_le16(t16);
>  	rh->minor_ver = cpu_to_le16(1); // 0x1A:
>  	rh->major_ver = cpu_to_le16(1); // 0x1C:
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index 669249439217..91e3743e1442 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -312,7 +312,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi)
>  	if (sb_rdonly(sb) || !initialized)
>  		goto out;
>  
> -	/* Fill LogFile by '-1' if it is initialized.ssss */
> +	/* Fill LogFile by '-1' if it is initialized. */
>  	err = ntfs_bio_fill_1(sbi, &ni->file.run);
>  
>  out:
> @@ -960,10 +960,10 @@ int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty)
>  	/* verify(!ntfs_update_mftmirr()); */
>  
>  	/*
> -	 * if we used wait=1, sync_inode_metadata waits for the io for the
> +	 * If we used wait=1, sync_inode_metadata waits for the io for the
>  	 * inode to finish. It hangs when media is removed.
>  	 * So wait=0 is sent down to sync_inode_metadata
> -	 * and filemap_fdatawrite is used for the data blocks
> +	 * and filemap_fdatawrite is used for the data blocks.
>  	 */
>  	err = sync_inode_metadata(&ni->vfs_inode, 0);
>  	if (!err)
> @@ -1917,7 +1917,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  	sbi->security.next_id = SECURITY_ID_FIRST;
>  	/* Always write new security at the end of bucket. */
>  	sbi->security.next_off =
> -			ALIGN(sds_size - SecurityDescriptorsBlockSize, 16);
> +		ALIGN(sds_size - SecurityDescriptorsBlockSize, 16);

Not comment.

>  
>  	off = 0;
>  	ne = NULL;
> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
> index 1224b8e42b3e..0daca9adc54c 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c
> @@ -2624,17 +2624,19 @@ int indx_update_dup(struct ntfs_inode *ni, struct ntfs_sb_info *sbi,
>  	e_fname = (struct ATTR_FILE_NAME *)(e + 1);
>  
>  	if (!memcmp(&e_fname->dup, dup, sizeof(*dup))) {
> -		/* Nothing to update in index! Try to avoid this call. */
> +		/*
> +		 * Nothing to update in index! Try to avoid this call.
> +		 */

What is the point of multiline?

>  		goto out;
>  	}
>  
>  	memcpy(&e_fname->dup, dup, sizeof(*dup));
>  
>  	if (fnd->level) {
> -		/* directory entry in index */
> +		/* Directory entry in index. */
>  		err = indx_write(indx, ni, fnd->nodes[fnd->level - 1], sync);
>  	} else {
> -		/* directory entry in directory MFT record */
> +		/* Directory entry in directory MFT record. */
>  		mi->dirty = true;
>  		if (sync)
>  			err = mi_write(mi, 1);
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index 8f72066b3229..db2a5a4c38e4 100644
> --- a/fs/ntfs3/inode.c
> +++ b/fs/ntfs3/inode.c
> @@ -89,7 +89,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
>  	}
>  
>  	if (le32_to_cpu(rec->total) != sbi->record_size) {
> -		// Bad inode?
> +		/* Bad inode? */
>  		err = -EINVAL;
>  		goto out;
>  	}
> @@ -605,7 +605,7 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo,
>  		if (vbo >= valid)
>  			set_buffer_new(bh);
>  	} else if (create) {
> -		/*normal write*/
> +		/* Normal write. */
>  		if (bytes > bh->b_size)
>  			bytes = bh->b_size;
>  
> @@ -1091,7 +1091,7 @@ int inode_write_data(struct inode *inode, const void *data, size_t bytes)
>  /*
>   * ntfs_reparse_bytes
>   *
> - * Number of bytes to for REPARSE_DATA_BUFFER(IO_REPARSE_TAG_SYMLINK)
> + * Number of bytes for REPARSE_DATA_BUFFER(IO_REPARSE_TAG_SYMLINK)
>   * for unicode string of @uni_len length.
>   */
>  static inline u32 ntfs_reparse_bytes(u32 uni_len)
> @@ -1205,13 +1205,13 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
>  		return ERR_PTR(-EINVAL);
>  
>  	if (S_ISDIR(mode)) {
> -		/* use parent's directory attributes */
> +		/* Use parent's directory attributes. */
>  		fa = dir_ni->std_fa | FILE_ATTRIBUTE_DIRECTORY |
>  		     FILE_ATTRIBUTE_ARCHIVE;
>  		/*
> -		 * By default child directory inherits parent attributes
> -		 * root directory is hidden + system
> -		 * Make an exception for children in root
> +		 * By default child directory inherits parent attributes.
> +		 * Root directory is hidden + system.
> +		 * Make an exception for children in root.
>  		 */
>  		if (dir->i_ino == MFT_REC_ROOT)
>  			fa &= ~(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
> @@ -1220,8 +1220,8 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
>  		fa = FILE_ATTRIBUTE_REPARSE_POINT;
>  
>  		/*
> -		 * linux: there are dir/file/symlink and so on.
> -		 * NTFS: symlinks are "dir + reparse" or "file + reparse".
> +		 * Linux: there are dir/file/symlink and so on.
> +		 * NTFS: symlinks are "dir + reparse" or "file + reparse"
>  		 * It is good idea to create:
>  		 * dir + reparse if 'symname' points to directory
>  		 * or
> @@ -1860,7 +1860,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer,
>  
>  	default:
>  		if (IsReparseTagMicrosoft(rp->ReparseTag)) {
> -			/* unknown Microsoft Tag */
> +			/* Unknown Microsoft Tag. */
>  			goto out;
>  		}
>  		if (!IsReparseTagNameSurrogate(rp->ReparseTag) ||
> diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
> index 3acf0d9f0b15..f1f691a67cc4 100644
> --- a/fs/ntfs3/lznt.c
> +++ b/fs/ntfs3/lznt.c
> @@ -296,8 +296,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
>   */
>  struct lznt *get_lznt_ctx(int level)
>  {
> -	struct lznt *r = kzalloc(level ? offsetof(struct lznt, hash) :
> -					 sizeof(struct lznt), GFP_NOFS);
> +	struct lznt *r = kzalloc(level ? offsetof(struct lznt, hash)
> +				       : sizeof(struct lznt),
> +				 GFP_NOFS);

Not comment.

>  
>  	if (r)
>  		r->std = !level;
> diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
> index 0fd7bffb98d4..6bb3e595263b 100644
> --- a/fs/ntfs3/ntfs.h
> +++ b/fs/ntfs3/ntfs.h
> @@ -262,7 +262,7 @@ enum RECORD_FLAG {
>  	RECORD_FLAG_UNKNOWN	= cpu_to_le16(0x0008),
>  };
>  
> -/* MFT Record structure, */
> +/* MFT Record structure. */
>  struct MFT_REC {
>  	struct NTFS_RECORD_HEADER rhdr; // 'FILE'
>  
> diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
> index f9436cbbc347..97e682ebcfb9 100644
> --- a/fs/ntfs3/ntfs_fs.h
> +++ b/fs/ntfs3/ntfs_fs.h
> @@ -59,18 +59,18 @@ struct ntfs_mount_options {
>  	u16 fs_fmask_inv;
>  	u16 fs_dmask_inv;
>  
> -	unsigned uid : 1,	/* uid was set. */
> -		gid : 1,	/* gid was set. */
> -		fmask : 1,	/* fmask was set. */
> -		dmask : 1,	/* dmask was set. */
> -		sys_immutable : 1,/* Immutable system files. */
> -		discard : 1,	/* Issue discard requests on deletions. */
> -		sparse : 1,	/* Create sparse files. */
> -		showmeta : 1,	/* Show meta files. */
> -		nohidden : 1, 	/* Do not show hidden files. */
> -		force : 1, 	/* Rw mount dirty volume. */
> -		no_acs_rules : 1,/*Exclude acs rules. */
> -		prealloc : 1	/* Preallocate space when file is growing. */
> +	unsigned uid : 1, /* uid was set. */
> +		gid : 1, /* gid was set. */
> +		fmask : 1, /* fmask was set. */
> +		dmask : 1, /* dmask was set. */
> +		sys_immutable : 1, /* Immutable system files. */
> +		discard : 1, /* Issue discard requests on deletions. */
> +		sparse : 1, /* Create sparse files. */
> +		showmeta : 1, /* Show meta files. */
> +		nohidden : 1, /* Do not show hidden files. */
> +		force : 1, /* Rw mount dirty volume. */
> +		no_acs_rules : 1, /*Exclude acs rules. */
> +		prealloc : 1 /* Preallocate space when file is growing. */
>  		;
>  };
>  
> diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
> index 61e3f2fb619f..103705c86772 100644
> --- a/fs/ntfs3/record.c
> +++ b/fs/ntfs3/record.c
> @@ -219,7 +219,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
>  
>  		asize = le32_to_cpu(attr->size);
>  		if (asize < SIZEOF_RESIDENT) {
> -			/* Impossible 'cause we should not return such attribute */
> +			/* Impossible 'cause we should not return such attribute. */

Over > 80

>  			return NULL;
>  		}
>  
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index 2fbab8a931ee..dbecf095da59 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -1053,7 +1053,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	iput(inode);
>  
> -	/* Load $LogFile to replay. */
> +	/* Load LogFile to replay. */

I feel like we should leave $ mark. I know that checkpatch will
complain, but we can try to change checkpatch behavier so that it will
not false alarm about these. I will add that to my todo list.

>  	ref.low = cpu_to_le32(MFT_REC_LOG);
>  	ref.seq = cpu_to_le16(MFT_REC_LOG);
>  	inode = ntfs_iget5(sb, &ref, &NAME_LOGFILE);
> diff --git a/fs/ntfs3/upcase.c b/fs/ntfs3/upcase.c
> index eb65bbd939e8..bbeba778237e 100644
> --- a/fs/ntfs3/upcase.c
> +++ b/fs/ntfs3/upcase.c
> @@ -34,7 +34,7 @@ static inline u16 upcase_unicode_char(const u16 *upcase, u16 chr)
>   * - Case insensitive
>   * - If name equals and 'bothcases' then
>   * - Case sensitive
> - * 'Straigth way' code scans input names twice in worst case.
> + * 'Straight way' code scans input names twice in worst case.
>   * Optimized code scans input names only once.
>   */
>  int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2,
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index 22fd5eb32c5b..b15d532e4a17 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -26,9 +26,10 @@
>  static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
>  {
>  	return ea->size ? le32_to_cpu(ea->size)
> -			: ALIGN(struct_size(
> -			      ea, name,
> -			      1 + ea->name_len + le16_to_cpu(ea->elength)), 4);
> +			: ALIGN(struct_size(ea, name,
> +					    1 + ea->name_len +
> +						    le16_to_cpu(ea->elength)),
> +				4);

Not a comment.

>  }
>  
>  static inline size_t packed_ea_size(const struct EA_FULL *ea)
> -- 
> 2.28.0
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-31 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 16:38 [PATCH] fs/ntfs3: Restyle comments to better align with kernel-doc Konstantin Komarov
2021-08-31 19:56 ` Kari Argillander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).