mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
fs/ntfs3: format code, deal with comments
format code according to .clang-format, add useful comments and remove non-useful comments. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
a82fbf4815
commit
723325dc91
|
|
@ -1152,7 +1152,7 @@ int attr_data_get_block_locked(struct ntfs_inode *ni, CLST vcn, CLST clen,
|
|||
struct ATTRIB *attr2;
|
||||
|
||||
attr2 = ni_find_attr(ni, attr_b, &le_b, ATTR_DATA, NULL,
|
||||
0, &vcn0, &mi);
|
||||
0, &vcn0, &mi);
|
||||
if (!attr2) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -1855,8 +1855,8 @@ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr,
|
|||
static struct folio *ntfs_lock_new_page(struct address_space *mapping,
|
||||
pgoff_t index, gfp_t gfp)
|
||||
{
|
||||
struct folio *folio = __filemap_get_folio(mapping, index,
|
||||
FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp);
|
||||
struct folio *folio = __filemap_get_folio(
|
||||
mapping, index, FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp);
|
||||
|
||||
if (IS_ERR(folio))
|
||||
return folio;
|
||||
|
|
|
|||
|
|
@ -2654,7 +2654,6 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len)
|
|||
struct ATTRIB *attr;
|
||||
u32 uni_bytes;
|
||||
struct ntfs_inode *ni = sbi->volume.ni;
|
||||
/* Allocate PATH_MAX bytes. */
|
||||
struct cpu_str *uni = kmalloc(PATH_MAX, GFP_KERNEL);
|
||||
|
||||
if (!uni)
|
||||
|
|
|
|||
|
|
@ -1623,7 +1623,8 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
const struct NTFS_DE *new_de,
|
||||
struct NTFS_DE *root_de, const void *ctx,
|
||||
struct ntfs_fnd *fnd, bool undo, NTFS_CMP_FUNC cmp)
|
||||
struct ntfs_fnd *fnd, bool undo,
|
||||
NTFS_CMP_FUNC cmp)
|
||||
{
|
||||
int err = 0;
|
||||
struct NTFS_DE *e, *e0, *re;
|
||||
|
|
@ -1848,13 +1849,15 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
* Attempt to insert an entry into an Index Allocation Buffer.
|
||||
* If necessary, it will split the buffer.
|
||||
*/
|
||||
static int
|
||||
indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
struct INDEX_ROOT *root, const struct NTFS_DE *new_de,
|
||||
const void *ctx, int level, struct ntfs_fnd *fnd, NTFS_CMP_FUNC cmp)
|
||||
static int indx_insert_into_buffer(struct ntfs_index *indx,
|
||||
struct ntfs_inode *ni,
|
||||
struct INDEX_ROOT *root,
|
||||
const struct NTFS_DE *new_de,
|
||||
const void *ctx, int level,
|
||||
struct ntfs_fnd *fnd, NTFS_CMP_FUNC cmp)
|
||||
{
|
||||
int err;
|
||||
const struct NTFS_DE *sp;
|
||||
const struct NTFS_DE *sp; /* split_point */
|
||||
struct NTFS_DE *e, *de_t, *up_e;
|
||||
struct indx_node *n2;
|
||||
struct indx_node *n1 = fnd->nodes[level];
|
||||
|
|
@ -1880,10 +1883,9 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
* No space to insert into buffer. Split it.
|
||||
* To split we:
|
||||
* - Save split point ('cause index buffers will be changed)
|
||||
* - Allocate NewBuffer and copy all entries <= sp into new buffer
|
||||
* - Remove all entries (sp including) from TargetBuffer
|
||||
* - Insert NewEntry into left or right buffer (depending on sp <=>
|
||||
* NewEntry)
|
||||
* - Allocate new buffer (up_e) and copy all entries <= sp into new buffer
|
||||
* - Remove all entries (sp including) from hdr1
|
||||
* - Insert new_de into left or right buffer (depending on sp <=> new_de)
|
||||
* - Insert sp into parent buffer (or root)
|
||||
* - Make sp a parent for new buffer
|
||||
*/
|
||||
|
|
@ -1897,6 +1899,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
return -ENOMEM;
|
||||
memcpy(up_e, sp, sp_size);
|
||||
|
||||
/* Make a copy for undo. */
|
||||
used1 = le32_to_cpu(hdr1->used);
|
||||
|
||||
/*
|
||||
|
|
@ -1960,8 +1963,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
*/
|
||||
hdr_insert_de(indx,
|
||||
(*cmp)(new_de + 1, le16_to_cpu(new_de->key_size),
|
||||
up_e + 1, le16_to_cpu(up_e->key_size),
|
||||
ctx) < 0 ?
|
||||
up_e + 1, le16_to_cpu(up_e->key_size), ctx) < 0 ?
|
||||
hdr2 :
|
||||
hdr1,
|
||||
new_de, NULL, ctx, cmp);
|
||||
|
|
@ -1978,11 +1980,13 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
* insert the promoted entry into the parent.
|
||||
*/
|
||||
if (!level) {
|
||||
/* Insert in root. */
|
||||
err = indx_insert_into_root(indx, ni, up_e, NULL, ctx, fnd, 0, cmp);
|
||||
/* Insert split_point in root. */
|
||||
err = indx_insert_into_root(indx, ni, up_e, NULL, ctx, fnd, 0,
|
||||
cmp);
|
||||
} else {
|
||||
/*
|
||||
* The target buffer's parent is another index buffer.
|
||||
* Insert split_point in parent index ( call itself recursively )
|
||||
* TODO: Remove recursion.
|
||||
*/
|
||||
err = indx_insert_into_buffer(indx, ni, root, up_e, ctx,
|
||||
|
|
|
|||
|
|
@ -592,7 +592,6 @@ static void ntfs_iomap_read_end_io(struct bio *bio)
|
|||
u32 f_size = folio_size(folio);
|
||||
loff_t f_pos = folio_pos(folio);
|
||||
|
||||
|
||||
if (valid < f_pos + f_size) {
|
||||
u32 z_from = valid <= f_pos ?
|
||||
0 :
|
||||
|
|
@ -765,7 +764,7 @@ static int ntfs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
|
|||
clen_max = bytes_to_cluster(sbi, endbyte) - vcn;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Force to allocate clusters if directIO(write) or writeback_range.
|
||||
* NOTE: attr_data_get_block allocates clusters only for sparse file.
|
||||
* Normal file allocates clusters in attr_set_size.
|
||||
|
|
@ -830,7 +829,6 @@ static int ntfs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
|
|||
iomap->type = IOMAP_DELALLOC;
|
||||
iomap->addr = IOMAP_NULL_ADDR;
|
||||
} else {
|
||||
|
||||
/* Translate clusters into bytes. */
|
||||
iomap->addr = ((loff_t)lcn << cluster_bits) + off;
|
||||
if (length && iomap->length > length)
|
||||
|
|
@ -987,7 +985,6 @@ static ssize_t ntfs_writeback_range(struct iomap_writepage_ctx *wpc,
|
|||
return iomap_add_to_ioend(wpc, folio, offset, end_pos, len);
|
||||
}
|
||||
|
||||
|
||||
static const struct iomap_writeback_ops ntfs_writeback_ops = {
|
||||
.writeback_range = ntfs_writeback_range,
|
||||
.writeback_submit = iomap_ioend_writeback_submit,
|
||||
|
|
@ -1000,7 +997,7 @@ static int ntfs_writepages(struct address_space *mapping,
|
|||
struct inode *inode = mapping->host;
|
||||
struct ntfs_inode *ni = ntfs_i(inode);
|
||||
struct iomap_writepage_ctx wpc = {
|
||||
.inode = mapping->host,
|
||||
.inode = inode,
|
||||
.wbc = wbc,
|
||||
.ops = &ntfs_writeback_ops,
|
||||
};
|
||||
|
|
@ -1280,7 +1277,6 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
|
|||
if (!(mode & 0222))
|
||||
fa |= FILE_ATTRIBUTE_READONLY;
|
||||
|
||||
/* Allocate PATH_MAX bytes. */
|
||||
new_de = kzalloc(PATH_MAX, GFP_KERNEL);
|
||||
if (!new_de) {
|
||||
err = -ENOMEM;
|
||||
|
|
@ -1719,7 +1715,6 @@ int ntfs_link_inode(struct inode *inode, struct dentry *dentry)
|
|||
struct ntfs_sb_info *sbi = inode->i_sb->s_fs_info;
|
||||
struct NTFS_DE *de;
|
||||
|
||||
/* Allocate PATH_MAX bytes. */
|
||||
de = kzalloc(PATH_MAX, GFP_KERNEL);
|
||||
if (!de)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user