[Ocfs2-devel] [PATCH] Reoganize data elements to reduce memory footprint
Joel Becker
Joel.Becker at oracle.com
Wed Jun 9 17:51:55 PDT 2010
On Wed, Jun 09, 2010 at 05:45:10PM -0700, Joel Becker wrote:
> On Wed, Jun 09, 2010 at 04:57:11PM -0500, Goldwyn Rodrigues wrote:
> > diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> > index c67003b..34b9c79 100644
> > --- a/fs/ocfs2/ocfs2.h
> > +++ b/fs/ocfs2/ocfs2.h
> > @@ -151,17 +151,16 @@ struct ocfs2_lock_res {
> > void *l_priv;
> > struct ocfs2_lock_res_ops *l_ops;
> > spinlock_t l_lock;
> > + enum ocfs2_lock_type l_type;
>
> I think you should change l_type, l_action, l_requested,
> l_blocking, and l_level to unsigned char. While the enums that set them
> should be not modified, they do not have more than 256 values. All the
> functions around them can use the enum type in their arguments. Just
> the ocfs2_lock_res itself stores them in unsigned char.
> This would potentially save us 15 bytes per ocfs2_lock_res,
> 45 per inode. More realistic is probably 12 per lock_res and 36 per
> inode, but still!
If you do this, please comment that they are set from enums but
are unsigned char to save space because the value never overflows.
Joel
--
"Conservative, n. A statesman who is enamoured of existing evils,
as distinguished from the Liberal, who wishes to replace them
with others."
- Ambrose Bierce, The Devil's Dictionary
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-devel
mailing list