fs/ntfs/mft.c::ntfs_extent_mft_record_free().
- Splitt runlist related functions off from attrib.[hc] to runlist.[hc].
- Add vol->mft_data_pos and initialize it at mount time.
+ - Rename init_runlist() to ntfs_init_runlist(), ntfs_vcn_to_lcn() to
+ ntfs_rl_vcn_to_lcn(), decompress_mapping_pairs() to
+ ntfs_mapping_pairs_decompress() and adapt all callers.
2.1.19 - Many cleanups, improvements, and a minor bug fix.
/* Seek to element containing target vcn. */
while (rl->length && rl[1].vcn <= vcn)
rl++;
- lcn = ntfs_vcn_to_lcn(rl, vcn);
+ lcn = ntfs_rl_vcn_to_lcn(rl, vcn);
} else
lcn = (LCN)LCN_RL_NOT_MAPPED;
/* Successful remap. */
}
/* Hard error, zero out region. */
SetPageError(page);
- ntfs_error(vol->sb, "ntfs_vcn_to_lcn(vcn = 0x%llx) "
+ ntfs_error(vol->sb, "ntfs_rl_vcn_to_lcn(vcn = 0x%llx) "
"failed with error code 0x%llx%s.",
(unsigned long long)vcn,
(unsigned long long)-lcn,
// FIXME: Depending on vol->on_errors, do something.
}
/*
- * Either iblock was outside lblock limits or ntfs_vcn_to_lcn()
- * returned error. Just zero that portion of the page and set
- * the buffer uptodate.
+ * Either iblock was outside lblock limits or
+ * ntfs_rl_vcn_to_lcn() returned error. Just zero that portion
+ * of the page and set the buffer uptodate.
*/
handle_hole:
bh->b_blocknr = -1UL;
/* Seek to element containing target vcn. */
while (rl->length && rl[1].vcn <= vcn)
rl++;
- lcn = ntfs_vcn_to_lcn(rl, vcn);
+ lcn = ntfs_rl_vcn_to_lcn(rl, vcn);
} else
lcn = (LCN)LCN_RL_NOT_MAPPED;
/* Successful remap. */
}
/* Failed to map the buffer, even after retrying. */
bh->b_blocknr = -1UL;
- ntfs_error(vol->sb, "ntfs_vcn_to_lcn(vcn = 0x%llx) failed "
+ ntfs_error(vol->sb, "ntfs_rl_vcn_to_lcn(vcn = 0x%llx) failed "
"with error code 0x%llx%s.",
(unsigned long long)vcn,
(unsigned long long)-lcn,
/* Seek to element containing target vcn. */
while (rl->length && rl[1].vcn <= vcn)
rl++;
- lcn = ntfs_vcn_to_lcn(rl, vcn);
+ lcn = ntfs_rl_vcn_to_lcn(rl, vcn);
} else
lcn = (LCN)LCN_RL_NOT_MAPPED;
if (unlikely(lcn < 0)) {
* retrying.
*/
bh->b_blocknr = -1UL;
- ntfs_error(vol->sb, "ntfs_vcn_to_lcn(vcn = "
+ ntfs_error(vol->sb, "ntfs_rl_vcn_to_lcn(vcn = "
"0x%llx) failed with error "
"code 0x%llx%s.",
(unsigned long long)vcn,
#include <linux/buffer_head.h>
#include "ntfs.h"
-//#include "dir.h"
/**
* ntfs_map_runlist - map (a part of) a runlist of an ntfs inode
down_write(&ni->runlist.lock);
/* Make sure someone else didn't do the work while we were sleeping. */
- if (likely(ntfs_vcn_to_lcn(ni->runlist.rl, vcn) <= LCN_RL_NOT_MAPPED)) {
+ if (likely(ntfs_rl_vcn_to_lcn(ni->runlist.rl, vcn) <=
+ LCN_RL_NOT_MAPPED)) {
runlist_element *rl;
- rl = decompress_mapping_pairs(ni->vol, ctx->attr,
+ rl = ntfs_mapping_pairs_decompress(ni->vol, ctx->attr,
ni->runlist.rl);
if (IS_ERR(rl))
err = PTR_ERR(rl);
rl = runlist->rl;
/* Read all clusters specified by the runlist one run at a time. */
while (rl->length) {
- lcn = ntfs_vcn_to_lcn(rl, rl->vcn);
+ lcn = ntfs_rl_vcn_to_lcn(rl, rl->vcn);
ntfs_debug("Reading vcn = 0x%llx, lcn = 0x%llx.",
(unsigned long long)rl->vcn,
(unsigned long long)lcn);
/* The attribute list cannot be sparse. */
if (lcn < 0) {
- ntfs_error(sb, "ntfs_vcn_to_lcn() failed. Cannot read "
- "attribute list.");
+ ntfs_error(sb, "ntfs_rl_vcn_to_lcn() failed. Cannot "
+ "read attribute list.");
goto err_out;
}
block = lcn << vol->cluster_size_bits >> block_size_bits;
/* Seek to element containing target vcn. */
while (rl->length && rl[1].vcn <= vcn)
rl++;
- lcn = ntfs_vcn_to_lcn(rl, vcn);
+ lcn = ntfs_rl_vcn_to_lcn(rl, vcn);
} else
lcn = (LCN)LCN_RL_NOT_MAPPED;
ntfs_debug("Reading vcn = 0x%llx, lcn = 0x%llx.",
rl_err:
up_read(&ni->runlist.lock);
- ntfs_error(vol->sb, "ntfs_vcn_to_lcn() failed. Cannot read "
+ ntfs_error(vol->sb, "ntfs_rl_vcn_to_lcn() failed. Cannot read "
"compression block.");
goto err_out;
ni->seq_no = 0;
atomic_set(&ni->count, 1);
ni->vol = NTFS_SB(sb);
- init_runlist(&ni->runlist);
+ ntfs_init_runlist(&ni->runlist);
init_MUTEX(&ni->mrec_lock);
ni->page = NULL;
ni->page_ofs = 0;
ni->attr_list_size = 0;
ni->attr_list = NULL;
- init_runlist(&ni->attr_list_rl);
+ ntfs_init_runlist(&ni->attr_list_rl);
ni->itype.index.bmp_ino = NULL;
ni->itype.index.block_size = 0;
ni->itype.index.vcn_size = 0;
* Setup the runlist. No need for locking as we have
* exclusive access to the inode at this time.
*/
- ni->attr_list_rl.rl = decompress_mapping_pairs(vol,
+ ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol,
ctx->attr, NULL);
if (IS_ERR(ni->attr_list_rl.rl)) {
err = PTR_ERR(ni->attr_list_rl.rl);
*
* We solve these problems by starting with the $DATA attribute before anything
* else and iterating using ntfs_attr_lookup($DATA) over all extents. As each
- * extent is found, we decompress_mapping_pairs() including the implied
+ * extent is found, we ntfs_mapping_pairs_decompress() including the implied
* ntfs_merge_runlists(). Each step of the iteration necessarily provides
* sufficient information for the next step to complete.
*
goto put_err_out;
}
/* Setup the runlist. */
- ni->attr_list_rl.rl = decompress_mapping_pairs(vol,
+ ni->attr_list_rl.rl = ntfs_mapping_pairs_decompress(vol,
ctx->attr, NULL);
if (IS_ERR(ni->attr_list_rl.rl)) {
err = PTR_ERR(ni->attr_list_rl.rl);
* as we have exclusive access to the inode at this time and we
* are a mount in progress task, too.
*/
- nrl = decompress_mapping_pairs(vol, attr, ni->runlist.rl);
+ nrl = ntfs_mapping_pairs_decompress(vol, attr, ni->runlist.rl);
if (IS_ERR(nrl)) {
- ntfs_error(sb, "decompress_mapping_pairs() failed with "
- "error code %ld. $MFT is corrupt.",
- PTR_ERR(nrl));
+ ntfs_error(sb, "ntfs_mapping_pairs_decompress() "
+ "failed with error code %ld. $MFT is "
+ "corrupt.", PTR_ERR(nrl));
goto put_err_out;
}
ni->runlist.rl = nrl;
}
/**
- * decompress_mapping_pairs - convert mapping pairs array to runlist
+ * ntfs_mapping_pairs_decompress - convert mapping pairs array to runlist
* @vol: ntfs volume on which the attribute resides
* @attr: attribute record whose mapping pairs array to decompress
* @old_rl: optional runlist in which to insert @attr's runlist
* two into one, if that is possible (we check for overlap and discard the new
* runlist if overlap present before returning ERR_PTR(-ERANGE)).
*/
-runlist_element *decompress_mapping_pairs(const ntfs_volume *vol,
+runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
const ATTR_RECORD *attr, runlist_element *old_rl)
{
VCN vcn; /* Current vcn. */
}
/**
- * ntfs_vcn_to_lcn - convert a vcn into a lcn given a runlist
+ * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist
* @rl: runlist to use for conversion
* @vcn: vcn to convert
*
* Locking: - The caller must have locked the runlist (for reading or writing).
* - This function does not touch the lock.
*/
-LCN ntfs_vcn_to_lcn(const runlist_element *rl, const VCN vcn)
+LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn)
{
int i;
#include "layout.h"
#include "volume.h"
-static inline void init_runlist(runlist *rl)
+static inline void ntfs_init_runlist(runlist *rl)
{
rl->rl = NULL;
init_rwsem(&rl->lock);
LCN_ENOENT = -3,
} LCN_SPECIAL_VALUES;
-extern runlist_element *decompress_mapping_pairs(const ntfs_volume *vol,
+extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
const ATTR_RECORD *attr, runlist_element *old_rl);
-extern LCN ntfs_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
+extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
#endif /* _LINUX_NTFS_RUNLIST_H */