Commit ddd2ef70 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: 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.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent b217296f
......@@ -27,6 +27,9 @@ ToDo/Notes:
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.
......
......@@ -232,7 +232,7 @@ static int ntfs_read_block(struct page *page)
/* 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. */
......@@ -266,7 +266,7 @@ static int ntfs_read_block(struct page *page)
}
/* 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,
......@@ -274,9 +274,9 @@ static int ntfs_read_block(struct page *page)
// 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;
......@@ -637,7 +637,7 @@ static int ntfs_write_block(struct writeback_control *wbc, struct page *page)
/* 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. */
......@@ -673,7 +673,7 @@ static int ntfs_write_block(struct writeback_control *wbc, struct page *page)
}
/* 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,
......@@ -1402,7 +1402,7 @@ static int ntfs_prepare_nonresident_write(struct page *page,
/* 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)) {
......@@ -1451,7 +1451,7 @@ static int ntfs_prepare_nonresident_write(struct page *page,
* 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,
......
......@@ -22,7 +22,6 @@
#include <linux/buffer_head.h>
#include "ntfs.h"
//#include "dir.h"
/**
* ntfs_map_runlist - map (a part of) a runlist of an ntfs inode
......@@ -66,10 +65,11 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
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);
......@@ -398,14 +398,14 @@ int load_attribute_list(ntfs_volume *vol, runlist *runlist, u8 *al_start,
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;
......
......@@ -600,7 +600,7 @@ int ntfs_read_compressed_block(struct page *page)
/* 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.",
......@@ -926,7 +926,7 @@ int ntfs_read_compressed_block(struct page *page)
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;
......
......@@ -376,13 +376,13 @@ static void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni)
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;
......@@ -701,7 +701,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
* 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);
......@@ -1672,7 +1672,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
*
* 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.
*
......@@ -1810,7 +1810,7 @@ int ntfs_read_inode_mount(struct inode *vi)
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);
......@@ -1942,11 +1942,11 @@ int ntfs_read_inode_mount(struct inode *vi)
* 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;
......
......@@ -685,7 +685,7 @@ runlist_element *ntfs_merge_runlists(runlist_element *drl,
}
/**
* 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
......@@ -712,7 +712,7 @@ runlist_element *ntfs_merge_runlists(runlist_element *drl,
* 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. */
......@@ -929,7 +929,7 @@ runlist_element *decompress_mapping_pairs(const ntfs_volume *vol,
}
/**
* 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
*
......@@ -951,7 +951,7 @@ runlist_element *decompress_mapping_pairs(const ntfs_volume *vol,
* 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;
......
......@@ -28,7 +28,7 @@
#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);
......@@ -40,9 +40,9 @@ typedef enum {
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 */
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