[stgt] [PATCH 14/15] tgt: os.h: semtimedop for BSD

Boaz Harrosh bharrosh at panasas.com
Mon Mar 2 16:21:59 CET 2009


FUJITA Tomonori wrote:
> On Mon, 02 Mar 2009 16:48:03 +0200
> Boaz Harrosh <bharrosh at panasas.com> wrote:
> 
>> FUJITA Tomonori wrote:
>>> BSDes don't have semtimedop? We can't sleep so we use semtimedop. This
>>> emulation is broken, but it's fine by me for now.
>>>
>> This is all actually dead code, for me. I'm not using logger, I'm
>> using redirect IO of stderr/stdout. Both on BSD and on Linux.
>>
>> Can I put an __CONFIG_IF_USE_LOGGER or something in log.c that will
>> not include all this logger code, And set this in Makefile to default
>> on but user can change if he wants to?
> 
> Adding ifdef is acceptable to me only if you have a very good
> reason. "I don't use this" is not a good reason for me.
> 

You misunderstand what I asked. I agree with you that we don't need
#ifdef in os.h for that. I just want to not include this patch at all
since I want to be able to not use this code.

I would like to have __CONFIG_IF_USE_LOGGER also on Linux, so programmer
can decide if he wants it or not, regardless of OS.

> And why we want to disable logging feature for all the bsd users?
> 

Because as you said yourself we cannot sleep here, so for BSD we need
a design adjustment to make this work. But this is very stupid since
I'm the only current user of BSD, and I want a way to not use it at all.
Now keeping the patch like that will broom the problem under the rug,
and will cause problems down the road for BSD users that will use logger
and will not notice that they actually have a problem. I rather declare
logger unsupported in BSD. If someone else will want to fix that in the future
he can send a proper patch.

Note that logger is perfectly usable on BSD by doing:

tgtd 2>&1 | logger -t `basename $1` &

which will give you the same effect, without the hidden bug above.

> 
>> This will also make it easier for the patches I have out-of-tree
>> in the osd branch.
>>
>>> But I don't like ifdef. Why not be consistent with other portability
>>> code, just creating do_semtimedop or something.
>> I think that #ifdef are OK in an os.h header. It is the only place they
>> are acceptable. I agree with Or, that for performance cases we can leave
>> with #ifdefs at the os.h level. Though there is no such use case currently
>> and everything is in the slow path and are in the .c file.
>>
>> If you OK my problem with the use of logger I can get rid of that
>> completely.
> 
> This is a slow path. I can't find any good reason to use ifdef here.

Again the #ifdef I want is not for os.h. It is for OSD use and also for Linux

Thanks
Boaz
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list