Commit ffaa196f authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: fix confusing variable names in xfs_rmap_item.c

Variable names in this code module are inconsistent and confusing.
xfs_map_extent describe file mappings, so rename them "map".
xfs_rmap_intents describe block mapping intents, so rename them "ri".
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 1534328b
......@@ -244,40 +244,40 @@ xfs_trans_get_rud(
/* Set the map extent flags for this reverse mapping. */
static void
xfs_trans_set_rmap_flags(
struct xfs_map_extent *rmap,
struct xfs_map_extent *map,
enum xfs_rmap_intent_type type,
int whichfork,
xfs_exntst_t state)
{
rmap->me_flags = 0;
map->me_flags = 0;
if (state == XFS_EXT_UNWRITTEN)
rmap->me_flags |= XFS_RMAP_EXTENT_UNWRITTEN;
map->me_flags |= XFS_RMAP_EXTENT_UNWRITTEN;
if (whichfork == XFS_ATTR_FORK)
rmap->me_flags |= XFS_RMAP_EXTENT_ATTR_FORK;
map->me_flags |= XFS_RMAP_EXTENT_ATTR_FORK;
switch (type) {
case XFS_RMAP_MAP:
rmap->me_flags |= XFS_RMAP_EXTENT_MAP;
map->me_flags |= XFS_RMAP_EXTENT_MAP;
break;
case XFS_RMAP_MAP_SHARED:
rmap->me_flags |= XFS_RMAP_EXTENT_MAP_SHARED;
map->me_flags |= XFS_RMAP_EXTENT_MAP_SHARED;
break;
case XFS_RMAP_UNMAP:
rmap->me_flags |= XFS_RMAP_EXTENT_UNMAP;
map->me_flags |= XFS_RMAP_EXTENT_UNMAP;
break;
case XFS_RMAP_UNMAP_SHARED:
rmap->me_flags |= XFS_RMAP_EXTENT_UNMAP_SHARED;
map->me_flags |= XFS_RMAP_EXTENT_UNMAP_SHARED;
break;
case XFS_RMAP_CONVERT:
rmap->me_flags |= XFS_RMAP_EXTENT_CONVERT;
map->me_flags |= XFS_RMAP_EXTENT_CONVERT;
break;
case XFS_RMAP_CONVERT_SHARED:
rmap->me_flags |= XFS_RMAP_EXTENT_CONVERT_SHARED;
map->me_flags |= XFS_RMAP_EXTENT_CONVERT_SHARED;
break;
case XFS_RMAP_ALLOC:
rmap->me_flags |= XFS_RMAP_EXTENT_ALLOC;
map->me_flags |= XFS_RMAP_EXTENT_ALLOC;
break;
case XFS_RMAP_FREE:
rmap->me_flags |= XFS_RMAP_EXTENT_FREE;
map->me_flags |= XFS_RMAP_EXTENT_FREE;
break;
default:
ASSERT(0);
......@@ -335,7 +335,7 @@ STATIC void
xfs_rmap_update_log_item(
struct xfs_trans *tp,
struct xfs_rui_log_item *ruip,
struct xfs_rmap_intent *rmap)
struct xfs_rmap_intent *ri)
{
uint next_extent;
struct xfs_map_extent *map;
......@@ -351,12 +351,12 @@ xfs_rmap_update_log_item(
next_extent = atomic_inc_return(&ruip->rui_next_extent) - 1;
ASSERT(next_extent < ruip->rui_format.rui_nextents);
map = &ruip->rui_format.rui_extents[next_extent];
map->me_owner = rmap->ri_owner;
map->me_startblock = rmap->ri_bmap.br_startblock;
map->me_startoff = rmap->ri_bmap.br_startoff;
map->me_len = rmap->ri_bmap.br_blockcount;
xfs_trans_set_rmap_flags(map, rmap->ri_type, rmap->ri_whichfork,
rmap->ri_bmap.br_state);
map->me_owner = ri->ri_owner;
map->me_startblock = ri->ri_bmap.br_startblock;
map->me_startoff = ri->ri_bmap.br_startoff;
map->me_len = ri->ri_bmap.br_blockcount;
xfs_trans_set_rmap_flags(map, ri->ri_type, ri->ri_whichfork,
ri->ri_bmap.br_state);
}
static struct xfs_log_item *
......@@ -368,15 +368,15 @@ xfs_rmap_update_create_intent(
{
struct xfs_mount *mp = tp->t_mountp;
struct xfs_rui_log_item *ruip = xfs_rui_init(mp, count);
struct xfs_rmap_intent *rmap;
struct xfs_rmap_intent *ri;
ASSERT(count > 0);
xfs_trans_add_item(tp, &ruip->rui_item);
if (sort)
list_sort(mp, items, xfs_rmap_update_diff_items);
list_for_each_entry(rmap, items, ri_list)
xfs_rmap_update_log_item(tp, ruip, rmap);
list_for_each_entry(ri, items, ri_list)
xfs_rmap_update_log_item(tp, ruip, ri);
return &ruip->rui_item;
}
......@@ -398,13 +398,14 @@ xfs_rmap_update_finish_item(
struct list_head *item,
struct xfs_btree_cur **state)
{
struct xfs_rmap_intent *rmap;
struct xfs_rmap_intent *ri;
int error;
rmap = container_of(item, struct xfs_rmap_intent, ri_list);
error = xfs_trans_log_finish_rmap_update(tp, RUD_ITEM(done), rmap,
ri = container_of(item, struct xfs_rmap_intent, ri_list);
error = xfs_trans_log_finish_rmap_update(tp, RUD_ITEM(done), ri,
state);
kmem_cache_free(xfs_rmap_intent_cache, rmap);
kmem_cache_free(xfs_rmap_intent_cache, ri);
return error;
}
......@@ -421,10 +422,10 @@ STATIC void
xfs_rmap_update_cancel_item(
struct list_head *item)
{
struct xfs_rmap_intent *rmap;
struct xfs_rmap_intent *ri;
rmap = container_of(item, struct xfs_rmap_intent, ri_list);
kmem_cache_free(xfs_rmap_intent_cache, rmap);
ri = container_of(item, struct xfs_rmap_intent, ri_list);
kmem_cache_free(xfs_rmap_intent_cache, ri);
}
const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
......@@ -441,15 +442,15 @@ const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
static inline bool
xfs_rui_validate_map(
struct xfs_mount *mp,
struct xfs_map_extent *rmap)
struct xfs_map_extent *map)
{
if (!xfs_has_rmapbt(mp))
return false;
if (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS)
if (map->me_flags & ~XFS_RMAP_EXTENT_FLAGS)
return false;
switch (rmap->me_flags & XFS_RMAP_EXTENT_TYPE_MASK) {
switch (map->me_flags & XFS_RMAP_EXTENT_TYPE_MASK) {
case XFS_RMAP_EXTENT_MAP:
case XFS_RMAP_EXTENT_MAP_SHARED:
case XFS_RMAP_EXTENT_UNMAP:
......@@ -463,14 +464,14 @@ xfs_rui_validate_map(
return false;
}
if (!XFS_RMAP_NON_INODE_OWNER(rmap->me_owner) &&
!xfs_verify_ino(mp, rmap->me_owner))
if (!XFS_RMAP_NON_INODE_OWNER(map->me_owner) &&
!xfs_verify_ino(mp, map->me_owner))
return false;
if (!xfs_verify_fileext(mp, rmap->me_startoff, rmap->me_len))
if (!xfs_verify_fileext(mp, map->me_startoff, map->me_len))
return false;
return xfs_verify_fsbext(mp, rmap->me_startblock, rmap->me_len);
return xfs_verify_fsbext(mp, map->me_startblock, map->me_len);
}
/*
......@@ -593,18 +594,18 @@ xfs_rui_item_relog(
{
struct xfs_rud_log_item *rudp;
struct xfs_rui_log_item *ruip;
struct xfs_map_extent *extp;
struct xfs_map_extent *map;
unsigned int count;
count = RUI_ITEM(intent)->rui_format.rui_nextents;
extp = RUI_ITEM(intent)->rui_format.rui_extents;
map = RUI_ITEM(intent)->rui_format.rui_extents;
tp->t_flags |= XFS_TRANS_DIRTY;
rudp = xfs_trans_get_rud(tp, RUI_ITEM(intent));
set_bit(XFS_LI_DIRTY, &rudp->rud_item.li_flags);
ruip = xfs_rui_init(tp->t_mountp, count);
memcpy(ruip->rui_format.rui_extents, extp, count * sizeof(*extp));
memcpy(ruip->rui_format.rui_extents, map, count * sizeof(*map));
atomic_set(&ruip->rui_next_extent, count);
xfs_trans_add_item(tp, &ruip->rui_item);
set_bit(XFS_LI_DIRTY, &ruip->rui_item.li_flags);
......
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