Commit 54033c13 authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Added comments to frecord functions

Added some comments in frecord.c for more context.
Also changed run_lookup to static because it's an internal function.
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 42f66a7f
...@@ -1393,9 +1393,8 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) ...@@ -1393,9 +1393,8 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
void wnd_zone_set(struct wnd_bitmap *wnd, size_t lcn, size_t len) void wnd_zone_set(struct wnd_bitmap *wnd, size_t lcn, size_t len)
{ {
size_t zlen; size_t zlen = wnd->zone_end - wnd->zone_bit;
zlen = wnd->zone_end - wnd->zone_bit;
if (zlen) if (zlen)
wnd_add_free_ext(wnd, wnd->zone_bit, zlen, false); wnd_add_free_ext(wnd, wnd->zone_bit, zlen, false);
......
...@@ -1287,7 +1287,7 @@ static int ni_expand_mft_list(struct ntfs_inode *ni) ...@@ -1287,7 +1287,7 @@ static int ni_expand_mft_list(struct ntfs_inode *ni)
done = asize - run_size - SIZEOF_NONRESIDENT; done = asize - run_size - SIZEOF_NONRESIDENT;
le32_sub_cpu(&ni->mi.mrec->used, done); le32_sub_cpu(&ni->mi.mrec->used, done);
/* Estimate the size of second part: run_buf=NULL. */ /* Estimate packed size (run_buf=NULL). */
err = run_pack(run, svcn, evcn + 1 - svcn, NULL, sbi->record_size, err = run_pack(run, svcn, evcn + 1 - svcn, NULL, sbi->record_size,
&plen); &plen);
if (err < 0) if (err < 0)
...@@ -1317,6 +1317,7 @@ static int ni_expand_mft_list(struct ntfs_inode *ni) ...@@ -1317,6 +1317,7 @@ static int ni_expand_mft_list(struct ntfs_inode *ni)
attr->name_off = SIZEOF_NONRESIDENT_LE; attr->name_off = SIZEOF_NONRESIDENT_LE;
attr->flags = 0; attr->flags = 0;
/* This function can't fail - cause already checked above. */
run_pack(run, svcn, evcn + 1 - svcn, Add2Ptr(attr, SIZEOF_NONRESIDENT), run_pack(run, svcn, evcn + 1 - svcn, Add2Ptr(attr, SIZEOF_NONRESIDENT),
run_size, &plen); run_size, &plen);
...@@ -1392,8 +1393,6 @@ int ni_expand_list(struct ntfs_inode *ni) ...@@ -1392,8 +1393,6 @@ int ni_expand_list(struct ntfs_inode *ni)
/* Split MFT data as much as possible. */ /* Split MFT data as much as possible. */
err = ni_expand_mft_list(ni); err = ni_expand_mft_list(ni);
if (err)
goto out;
out: out:
return !err && !done ? -EOPNOTSUPP : err; return !err && !done ? -EOPNOTSUPP : err;
...@@ -1419,6 +1418,7 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type, ...@@ -1419,6 +1418,7 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type,
u32 run_size, asize; u32 run_size, asize;
struct ntfs_sb_info *sbi = ni->mi.sbi; struct ntfs_sb_info *sbi = ni->mi.sbi;
/* Estimate packed size (run_buf=NULL). */
err = run_pack(run, svcn, len, NULL, sbi->max_bytes_per_attr - run_off, err = run_pack(run, svcn, len, NULL, sbi->max_bytes_per_attr - run_off,
&plen); &plen);
if (err < 0) if (err < 0)
...@@ -1448,12 +1448,12 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type, ...@@ -1448,12 +1448,12 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type,
attr->name_off = cpu_to_le16(name_off); attr->name_off = cpu_to_le16(name_off);
attr->flags = flags; attr->flags = flags;
/* This function can't fail - cause already checked above. */
run_pack(run, svcn, len, Add2Ptr(attr, run_off), run_size, &plen); run_pack(run, svcn, len, Add2Ptr(attr, run_off), run_size, &plen);
attr->nres.svcn = cpu_to_le64(svcn); attr->nres.svcn = cpu_to_le64(svcn);
attr->nres.evcn = cpu_to_le64((u64)svcn + len - 1); attr->nres.evcn = cpu_to_le64((u64)svcn + len - 1);
err = 0;
if (new_attr) if (new_attr)
*new_attr = attr; *new_attr = attr;
......
...@@ -773,7 +773,6 @@ bool run_lookup_entry(const struct runs_tree *run, CLST vcn, CLST *lcn, ...@@ -773,7 +773,6 @@ bool run_lookup_entry(const struct runs_tree *run, CLST vcn, CLST *lcn,
void run_truncate(struct runs_tree *run, CLST vcn); void run_truncate(struct runs_tree *run, CLST vcn);
void run_truncate_head(struct runs_tree *run, CLST vcn); void run_truncate_head(struct runs_tree *run, CLST vcn);
void run_truncate_around(struct runs_tree *run, CLST vcn); void run_truncate_around(struct runs_tree *run, CLST vcn);
bool run_lookup(const struct runs_tree *run, CLST vcn, size_t *index);
bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len, bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len,
bool is_mft); bool is_mft);
bool run_collapse_range(struct runs_tree *run, CLST vcn, CLST len); bool run_collapse_range(struct runs_tree *run, CLST vcn, CLST len);
......
...@@ -31,7 +31,7 @@ struct ntfs_run { ...@@ -31,7 +31,7 @@ struct ntfs_run {
* Case of entry missing from list 'index' will be set to * Case of entry missing from list 'index' will be set to
* point to insertion position for the entry question. * point to insertion position for the entry question.
*/ */
bool run_lookup(const struct runs_tree *run, CLST vcn, size_t *index) static bool run_lookup(const struct runs_tree *run, CLST vcn, size_t *index)
{ {
size_t min_idx, max_idx, mid_idx; size_t min_idx, max_idx, mid_idx;
struct ntfs_run *r; struct ntfs_run *r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment