Skip to content

Commit

Permalink
fs/ntfs3: Code formatting
Browse files Browse the repository at this point in the history
clang-format-15 was used to format code according kernel's .clang-format.

Signed-off-by: Konstantin Komarov <[email protected]>
  • Loading branch information
aalexandrovich committed Jul 2, 2023
1 parent f1d325b commit f037776
Show file tree
Hide file tree
Showing 14 changed files with 92 additions and 83 deletions.
2 changes: 1 addition & 1 deletion fs/ntfs3/attrib.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type,
sbi, run, vcn, lcn, to_allocate, &pre_alloc,
is_mft ? ALLOCATE_MFT : ALLOCATE_DEF, &alen,
is_mft ? 0 :
(sbi->record_size -
(sbi->record_size -
le32_to_cpu(rec->used) + 8) /
3 +
1,
Expand Down
10 changes: 5 additions & 5 deletions fs/ntfs3/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ static void wnd_add_free_ext(struct wnd_bitmap *wnd, size_t bit, size_t len,
/* Check bits before 'bit'. */
ib = wnd->zone_bit == wnd->zone_end ||
bit < wnd->zone_end ?
0 :
wnd->zone_end;
0 :
wnd->zone_end;

while (bit > ib && wnd_is_free_hlp(wnd, bit - 1, 1)) {
bit -= 1;
Expand All @@ -298,8 +298,8 @@ static void wnd_add_free_ext(struct wnd_bitmap *wnd, size_t bit, size_t len,
/* Check bits after 'end_in'. */
ib = wnd->zone_bit == wnd->zone_end ||
end_in > wnd->zone_bit ?
wnd->nbits :
wnd->zone_bit;
wnd->nbits :
wnd->zone_bit;

while (end_in < ib && wnd_is_free_hlp(wnd, end_in, 1)) {
end_in += 1;
Expand Down Expand Up @@ -418,7 +418,7 @@ static void wnd_remove_free_ext(struct wnd_bitmap *wnd, size_t bit, size_t len)
n3 = rb_first(&wnd->count_tree);
wnd->extent_max =
n3 ? rb_entry(n3, struct e_node, count.node)->count.key :
0;
0;
return;
}

Expand Down
4 changes: 2 additions & 2 deletions fs/ntfs3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
for (; idx < idx_end; idx += 1, from = 0) {
page_off = (loff_t)idx << PAGE_SHIFT;
to = (page_off + PAGE_SIZE) > vbo_to ? (vbo_to - page_off) :
PAGE_SIZE;
PAGE_SIZE;
iblock = page_off >> inode->i_blkbits;

page = find_or_create_page(mapping, idx,
Expand Down Expand Up @@ -1052,7 +1052,7 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
goto out;

ret = is_compressed(ni) ? ntfs_compress_write(iocb, from) :
__generic_file_write_iter(iocb, from);
__generic_file_write_iter(iocb, from);

out:
inode_unlock(inode);
Expand Down
16 changes: 10 additions & 6 deletions fs/ntfs3/frecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct ATTR_STD_INFO *ni_std(struct ntfs_inode *ni)

attr = mi_find_attr(&ni->mi, NULL, ATTR_STD, NULL, 0, NULL);
return attr ? resident_data_ex(attr, sizeof(struct ATTR_STD_INFO)) :
NULL;
NULL;
}

/*
Expand All @@ -92,7 +92,7 @@ struct ATTR_STD_INFO5 *ni_std5(struct ntfs_inode *ni)
attr = mi_find_attr(&ni->mi, NULL, ATTR_STD, NULL, 0, NULL);

return attr ? resident_data_ex(attr, sizeof(struct ATTR_STD_INFO5)) :
NULL;
NULL;
}

/*
Expand Down Expand Up @@ -517,6 +517,9 @@ ni_ins_new_attr(struct ntfs_inode *ni, struct mft_inode *mi,
*/
static int ni_repack(struct ntfs_inode *ni)
{
#if 1
return 0;
#else
int err = 0;
struct ntfs_sb_info *sbi = ni->mi.sbi;
struct mft_inode *mi, *mi_p = NULL;
Expand Down Expand Up @@ -639,6 +642,7 @@ static int ni_repack(struct ntfs_inode *ni)

run_close(&run);
return err;
#endif
}

/*
Expand Down Expand Up @@ -1758,8 +1762,8 @@ int ni_new_attr_flags(struct ntfs_inode *ni, enum FILE_ATTRIBUTE new_fa)

/* Resize nonresident empty attribute in-place only. */
new_asize = (new_aflags & (ATTR_FLAG_COMPRESSED | ATTR_FLAG_SPARSED)) ?
(SIZEOF_NONRESIDENT_EX + 8) :
(SIZEOF_NONRESIDENT + 8);
(SIZEOF_NONRESIDENT_EX + 8) :
(SIZEOF_NONRESIDENT + 8);

if (!mi_resize_attr(mi, attr, new_asize - le32_to_cpu(attr->size)))
return -EOPNOTSUPP;
Expand Down Expand Up @@ -3161,8 +3165,8 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup,
__le64 valid_le;

dup->alloc_size = is_attr_ext(attr) ?
attr->nres.total_size :
attr->nres.alloc_size;
attr->nres.total_size :
attr->nres.alloc_size;
dup->data_size = attr->nres.data_size;

if (new_valid > data_size)
Expand Down
40 changes: 20 additions & 20 deletions fs/ntfs3/fslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,8 @@ static inline struct RESTART_TABLE *extend_rsttbl(struct RESTART_TABLE *tbl,
memcpy(rt + 1, tbl + 1, esize * used);

rt->free_goal = free_goal == ~0u ?
cpu_to_le32(~0u) :
cpu_to_le32(sizeof(struct RESTART_TABLE) +
cpu_to_le32(~0u) :
cpu_to_le32(sizeof(struct RESTART_TABLE) +
free_goal * esize);

if (tbl->first_free) {
Expand Down Expand Up @@ -1090,8 +1090,8 @@ static inline u64 base_lsn(struct ntfs_log *log,
<< log->file_data_bits) +
((((is_log_record_end(hdr) &&
h_lsn <= le64_to_cpu(hdr->record_hdr.last_end_lsn)) ?
le16_to_cpu(hdr->record_hdr.next_record_off) :
log->page_size) +
le16_to_cpu(hdr->record_hdr.next_record_off) :
log->page_size) +
lsn) >>
3);

Expand Down Expand Up @@ -1299,8 +1299,8 @@ static void log_init_pg_hdr(struct ntfs_log *log, u32 sys_page_size,
log->clst_per_page = 1;

log->first_page = major_ver >= 2 ?
0x22 * page_size :
((sys_page_size << 1) + (page_size << 1));
0x22 * page_size :
((sys_page_size << 1) + (page_size << 1));
log->major_ver = major_ver;
log->minor_ver = minor_ver;
}
Expand Down Expand Up @@ -1513,18 +1513,18 @@ static u32 current_log_avail(struct ntfs_log *log)
* If there is no oldest lsn then start at the first page of the file.
*/
oldest_off = (log->l_flags & NTFSLOG_NO_OLDEST_LSN) ?
log->first_page :
(log->oldest_lsn_off & ~log->sys_page_mask);
log->first_page :
(log->oldest_lsn_off & ~log->sys_page_mask);

/*
* We will use the next log page offset to compute the next free page.
* If we are going to reuse this page go to the next page.
* If we are at the first page then use the end of the file.
*/
next_free_off = (log->l_flags & NTFSLOG_REUSE_TAIL) ?
log->next_page + log->page_size :
log->next_page + log->page_size :
log->next_page == log->first_page ? log->l_size :
log->next_page;
log->next_page;

/* If the two offsets are the same then there is no available space. */
if (oldest_off == next_free_off)
Expand All @@ -1535,8 +1535,8 @@ static u32 current_log_avail(struct ntfs_log *log)
*/
free_bytes =
oldest_off < next_free_off ?
log->total_avail_pages - (next_free_off - oldest_off) :
oldest_off - next_free_off;
log->total_avail_pages - (next_free_off - oldest_off) :
oldest_off - next_free_off;

free_bytes >>= log->page_bits;
return free_bytes * log->reserved;
Expand Down Expand Up @@ -1671,7 +1671,7 @@ static int last_log_lsn(struct ntfs_log *log)

best_lsn1 = first_tail ? base_lsn(log, first_tail, first_file_off) : 0;
best_lsn2 = second_tail ? base_lsn(log, second_tail, second_file_off) :
0;
0;

if (first_tail && second_tail) {
if (best_lsn1 > best_lsn2) {
Expand Down Expand Up @@ -1767,7 +1767,7 @@ static int last_log_lsn(struct ntfs_log *log)
page_cnt = page_pos = 1;

curpage_off = seq_base == log->seq_num ? min(log->next_page, page_off) :
log->next_page;
log->next_page;

wrapped_file =
curpage_off == log->first_page &&
Expand Down Expand Up @@ -1826,8 +1826,8 @@ static int last_log_lsn(struct ntfs_log *log)
((lsn_cur >> log->file_data_bits) +
((curpage_off <
(lsn_to_vbo(log, lsn_cur) & ~log->page_mask)) ?
1 :
0)) != expected_seq) {
1 :
0)) != expected_seq) {
goto check_tail;
}

Expand Down Expand Up @@ -2643,8 +2643,8 @@ static inline bool check_index_root(const struct ATTRIB *attr,
const struct INDEX_ROOT *root = resident_data(attr);
u8 index_bits = le32_to_cpu(root->index_block_size) >=
sbi->cluster_size ?
sbi->cluster_bits :
SECTOR_SHIFT;
sbi->cluster_bits :
SECTOR_SHIFT;
u8 block_clst = root->index_block_clst;

if (le32_to_cpu(attr->res.data_size) < sizeof(struct INDEX_ROOT) ||
Expand Down Expand Up @@ -3861,9 +3861,9 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)

/* If we have a valid page then grab a pointer to the restart area. */
ra2 = rst_info.valid_page ?
Add2Ptr(rst_info.r_page,
Add2Ptr(rst_info.r_page,
le16_to_cpu(rst_info.r_page->ra_off)) :
NULL;
NULL;

if (rst_info.chkdsk_was_run ||
(ra2 && ra2->client_idx[1] == LFS_NO_CLIENT_LE)) {
Expand Down
2 changes: 1 addition & 1 deletion fs/ntfs3/fsntfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes,

fo = le16_to_cpu(rhdr->fix_off);
fn = simple ? ((bytes >> SECTOR_SHIFT) + 1) :
le16_to_cpu(rhdr->fix_num);
le16_to_cpu(rhdr->fix_num);

/* Check errors. */
if ((fo & 1) || fo + fn * sizeof(short) > SECTOR_SIZE || !fn-- ||
Expand Down
14 changes: 7 additions & 7 deletions fs/ntfs3/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ static int scan_nres_bitmap(struct ntfs_inode *ni, struct ATTRIB *bitmap,
nbits = 8 * (data_size - vbo);

ok = nbits > from ?
(*fn)((ulong *)bh->b_data, from, nbits, ret) :
false;
(*fn)((ulong *)bh->b_data, from, nbits, ret) :
false;
put_bh(bh);

if (ok) {
Expand Down Expand Up @@ -1682,8 +1682,8 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,

/* Create alloc and bitmap attributes (if not). */
err = run_is_empty(&indx->alloc_run) ?
indx_create_allocate(indx, ni, &new_vbn) :
indx_add_allocate(indx, ni, &new_vbn);
indx_create_allocate(indx, ni, &new_vbn) :
indx_add_allocate(indx, ni, &new_vbn);

/* Layout of record may be changed, so rescan root. */
root = indx_get_root(indx, ni, &attr, &mi);
Expand Down Expand Up @@ -1874,8 +1874,8 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
(*indx->cmp)(new_de + 1, le16_to_cpu(new_de->key_size),
up_e + 1, le16_to_cpu(up_e->key_size),
ctx) < 0 ?
hdr2 :
hdr1,
hdr2 :
hdr1,
new_de, NULL, ctx);

indx_mark_used(indx, ni, new_vbn >> indx->idx2vbn_bits);
Expand Down Expand Up @@ -2346,7 +2346,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
re, ctx,
fnd->level - 1,
fnd) :
indx_insert_into_root(indx, ni, re, e,
indx_insert_into_root(indx, ni, re, e,
ctx, fnd, 0);
kfree(re);

Expand Down
18 changes: 9 additions & 9 deletions fs/ntfs3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
goto next_attr;

run = ino == MFT_REC_BITMAP ? &sbi->used.bitmap.run :
&ni->file.run;
&ni->file.run;
break;

case ATTR_ROOT:
Expand Down Expand Up @@ -291,8 +291,8 @@ static struct inode *ntfs_read_mft(struct inode *inode,
goto out;

mode = sb->s_root ?
(S_IFDIR | (0777 & sbi->options->fs_dmask_inv)) :
(S_IFDIR | 0777);
(S_IFDIR | (0777 & sbi->options->fs_dmask_inv)) :
(S_IFDIR | 0777);
goto next_attr;

case ATTR_ALLOC:
Expand Down Expand Up @@ -450,7 +450,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
inode->i_op = &ntfs_file_inode_operations;
inode->i_fop = &ntfs_file_operations;
inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
&ntfs_aops;
&ntfs_aops;
if (ino != MFT_REC_MFT)
init_rwsem(&ni->file.run_lock);
} else if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode) ||
Expand Down Expand Up @@ -787,7 +787,7 @@ static ssize_t ntfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)

ret = blockdev_direct_IO(iocb, inode, iter,
wr ? ntfs_get_block_direct_IO_W :
ntfs_get_block_direct_IO_R);
ntfs_get_block_direct_IO_R);

if (ret > 0)
end = vbo + ret;
Expand Down Expand Up @@ -1191,11 +1191,11 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname,
* - ntfs_symlink
* - ntfs_mkdir
* - ntfs_atomic_open
*
*
* NOTE: if fnd != NULL (ntfs_atomic_open) then @dir is locked
*/
struct inode *ntfs_create_inode(struct mnt_idmap *idmap,
struct inode *dir, struct dentry *dentry,
struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry,
const struct cpu_str *uni, umode_t mode,
dev_t dev, const char *symname, u32 size,
struct ntfs_fnd *fnd)
Expand Down Expand Up @@ -1605,7 +1605,7 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap,
inode->i_op = &ntfs_file_inode_operations;
inode->i_fop = &ntfs_file_operations;
inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
&ntfs_aops;
&ntfs_aops;
init_rwsem(&ni->file.run_lock);
} else {
inode->i_op = &ntfs_special_inode_operations;
Expand Down
6 changes: 3 additions & 3 deletions fs/ntfs3/lznt.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ 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),
sizeof(struct lznt),
GFP_NOFS);

if (r)
Expand Down Expand Up @@ -393,8 +393,8 @@ ssize_t decompress_lznt(const void *cmpr, size_t cmpr_size, void *unc,
} else {
/* This chunk does not contain compressed data. */
unc_use = unc_chunk + LZNT_CHUNK_SIZE > unc_end ?
unc_end - unc_chunk :
LZNT_CHUNK_SIZE;
unc_end - unc_chunk :
LZNT_CHUNK_SIZE;

if (cmpr_chunk + sizeof(chunk_hdr) + unc_use >
cmpr_end) {
Expand Down
Loading

0 comments on commit f037776

Please sign in to comment.