Re: [lc-devel] [OLPC-devel] Announce: Compressed cache 'pre-alpha-001' release :)
Status: Beta
Brought to you by:
nitin_sf
From: Nitin G. <nit...@gm...> - 2006-07-27 19:46:19
|
Zach Brown wrote: >> I need to keep 'struct chunk' as small as possible. This 'test_bit' >> usage is >> just super blind copying of page-flags.h :) >> >> I think this should do (atomic guarantee not required): > > Oh, if you don't need atomicity why not just use a bitfield? > > unsigned short free:1, > size:15; > > or whatever. Though I think you'll find that most archs are padding it > out to be at least an int anyway to avoid unaligned accesses of > neighbouring members. Never used 'bitfield' before. I'll surely look into this. > >> I couldn't find equivalent error codes with meaning of CC_EEXPAND and >> CC_EUSED >> so defined them here. s/CC_ENOMEM/ENOMEM > > So have it return > 0 for the expand case? > I think, its better to have a consistent interface: -ve is error always, +ve, 0 is success. >> chunk_head is given to page_cache_get() before we know it's 'struct >> page' or >> 'struct chunk_head' so need to keep name and its position same as for >> struct >> page. > > Ugh, I missed that detail. That sounds very dangerous and I don't think > it will be allowed. You should find a better way. > Why do you think its 'dangerous'? In very early patches I used a 'struct page' in place of 'struct chunk_head'. This would have been 'safe' but that isn't good as sizeof(struct page) is just too big -- metadata size overhead will explode. Regards, Nitin |