[Sheepdog] [PATCH v3 2/2] sheep: abstract out store IO interface

Liu Yuan namei.unix at gmail.com
Thu Nov 17 11:56:38 CET 2011


On 11/17/2011 06:52 PM, Liu Yuan wrote:

> On 11/17/2011 06:27 PM, MORITA Kazutaka wrote:
> 
>> I think this is still not generic...  If this is specific one to
>> simple_store, move it to simple_store.c.
>>
>>
> 
> 
> I use siocb for interface functions internal information passing *and*
> for higher level code to specify flags, length, buf, offset to store.rw
> too.
> 
> This is just a dirty hack, enabling me to make small changes to the
> previous code to work with simple store correctly.
> 
> My intention is that siocb is not specific to simple store. we need a
> channel to send information to store.open(), then it can use it
> communicate with store.read/write/close.
> 
> So I think siocb would be globally seen by higher level code.
> 
> if we don't use siocb, then what do you suggest to use for higher level
> information (for e.g, flags, length, buf, offset) to store's interfaces?
> 
> We can't simple pass a void *ptr, without knowing the internal structure
> for it.
> 
> and even if later, siocb get changed, we don't need to change current
> (oid, void *priv) interface.
> 
> This is my own thought, maybe there is better idea.
> 
> 
>> Remove the 'static' modifier in store.c if you want to use obj_path in
>> this file.
>>
> 
> 
> Umm, obj_path is not static in my repo...I guess some patch remove it
> already. I'll rebase it.
> 
> 
>>> +			ret = store_write_last_sector(oid, &fd);
>>
>> store_write_last_sector() expects struct siocb in the second argument.
>>
> 
> 
> Good catch, it is my carelessness.
> 
>>
>> I think we should define opaque as 'void *', get a store_driver
>> specific opaque in the argument of store.open(), and pass it to
>> store.read()/write()/close().  This is also what Christoph suggested.
>> Am i wrong?
>>
> 
> 
> Like above, so it is totally opaque, where can we pass flags, length,
> offset to store driver?
> 


And more, length, offset is critical for later partial data object
read/write, if we support huge data size. So we can't assume an
interface just need (key, value).

Thanks,
Yuan



More information about the sheepdog mailing list