1
0
Fork 0

staging/lustre/lu: shrink lu_object by 8 bytes on x86_64

Remove the lo_depth member from struct lu_object.  This field is never
set and only read in lu_object_print().  Remove the lo_flags member.
This field was only used in lu_object_alloc() and can be replaced with
an on-stack mask to keep trace of which layers have been allocated.

Lustre-change: http://review.whamcloud.com/5890
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3059
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
John L. Hammond 2013-11-26 10:05:00 +08:00 committed by Greg Kroah-Hartman
parent a0b58afa7d
commit 7cd875d2b7
2 changed files with 16 additions and 27 deletions

View File

@ -397,17 +397,6 @@ static inline int lu_device_is_md(const struct lu_device *d)
return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_MD);
}
/**
* Flags for the object layers.
*/
enum lu_object_flags {
/**
* this flags is set if lu_object_operations::loo_object_init() has
* been called for this layer. Used by lu_object_alloc().
*/
LU_OBJECT_ALLOCATED = (1 << 0)
};
/**
* Common object attributes.
*/
@ -485,14 +474,6 @@ struct lu_object {
* Linkage into list of all layers.
*/
struct list_head lo_linkage;
/**
* Depth. Top level layer depth is 0.
*/
int lo_depth;
/**
* Flags from enum lu_object_flags.
*/
__u32 lo_flags;
/**
* Link to the device, for debugging.
*/

View File

@ -200,6 +200,8 @@ static struct lu_object *lu_object_alloc(const struct lu_env *env,
struct lu_object *scan;
struct lu_object *top;
struct list_head *layers;
unsigned int init_mask = 0;
unsigned int init_flag;
int clean;
int result;
@ -218,15 +220,17 @@ static struct lu_object *lu_object_alloc(const struct lu_env *env,
*/
top->lo_header->loh_fid = *f;
layers = &top->lo_header->loh_layers;
do {
/*
* Call ->loo_object_init() repeatedly, until no more new
* object slices are created.
*/
clean = 1;
init_flag = 1;
list_for_each_entry(scan, layers, lo_linkage) {
if (scan->lo_flags & LU_OBJECT_ALLOCATED)
continue;
if (init_mask & init_flag)
goto next;
clean = 0;
scan->lo_header = top->lo_header;
result = scan->lo_ops->loo_object_init(env, scan, conf);
@ -234,7 +238,9 @@ static struct lu_object *lu_object_alloc(const struct lu_env *env,
lu_object_free(env, top);
return ERR_PTR(result);
}
scan->lo_flags |= LU_OBJECT_ALLOCATED;
init_mask |= init_flag;
next:
init_flag <<= 1;
}
} while (!clean);
@ -487,23 +493,25 @@ void lu_object_print(const struct lu_env *env, void *cookie,
{
static const char ruler[] = "........................................";
struct lu_object_header *top;
int depth;
int depth = 4;
top = o->lo_header;
lu_object_header_print(env, cookie, printer, top);
(*printer)(env, cookie, "{ \n");
list_for_each_entry(o, &top->loh_layers, lo_linkage) {
depth = o->lo_depth + 4;
(*printer)(env, cookie, "{\n");
list_for_each_entry(o, &top->loh_layers, lo_linkage) {
/*
* print `.' \a depth times followed by type name and address
*/
(*printer)(env, cookie, "%*.*s%s@%p", depth, depth, ruler,
o->lo_dev->ld_type->ldt_name, o);
if (o->lo_ops->loo_object_print != NULL)
o->lo_ops->loo_object_print(env, cookie, printer, o);
(*o->lo_ops->loo_object_print)(env, cookie, printer, o);
(*printer)(env, cookie, "\n");
}
(*printer)(env, cookie, "} header@%p\n", top);
}
EXPORT_SYMBOL(lu_object_print);