Skip to contentSkip to conversation

Synchronizing Bit operations V2

DISCUSSION [email protected] 2 participants 2 messages Mar 31, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines

The following patchset implements the ability to specify a synchronization mode for bit operations.

I.e. instead of set_bit(x,y) we can do set_bit(x,y, mode).

The following modes are supported:

Yuck.

The only conceivable reason for passing the mode as a separate parameter is
- To change the mode dynamically at run time.
- To share common code when the sequence is long and mostly shared between the various modes (as in open(2) or ll_rw_block()).

I sincerely hope neither of those apply in this case.

On the downside, it's more typing and uglier than a series of

frob_bit_nonatomic()
(probably temporarily or permanently aliased to frob_bit())
frob_bit_atomic()
frob_bit_acquire()
frob_bit_release()
frob_bit_barrier()

functions, and those also prevent you from doing something silly like frob_bit(x, y, O_DIRECT). Also, the MODE_ prefix might be wanted by something else.

#1 lore raw
Quoted 4 lines · On Thu, 30 Mar 2006, [email protected] wrote:

The only conceivable reason for passing the mode as a separate parameter is
- To change the mode dynamically at run time.
- To share common code when the sequence is long and mostly shared between the various modes (as in open(2) or ll_rw_block()).

There is usually quite complex code involved although the code generated is minimal.

Quoted 9 lines

On the downside, it's more typing and uglier than a series of

frob_bit_nonatomic()
(probably temporarily or permanently aliased to frob_bit())
frob_bit_atomic()
frob_bit_acquire()
frob_bit_release()
frob_bit_barrier()

Quoted 3 lines

functions, and those also prevent you from doing something silly like frob_bit(x, y, O_DIRECT). Also, the MODE_ prefix might be wanted by something else.

Ok. We could change the MODE_ prefix but the problem with not passing this as a parameter that there are numerous functions derived from bit ops that are then also needed in lots of different flavors. Passing a parameter cuts down the number of variations dramatically.