Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > I'd rather get rid of the accessor and access the fields directly, as > that is much easier to follow. The problem is that the type is arranged as a bunch of bits: ITER_IOVEC = 4, ITER_KVEC = 8, ITER_BVEC = 16, ITER_PIPE = 32, ITER_DISCARD = 64, and we end up doing a lot of: if (type & TYPE1) { } else if (type & TYPE2) { } else if (type & TYPE3) { } else if (type & TYPE4) { } else { /* Do ITER_IOVEC */ } constructs - which isn't necessarily the most efficient for the CPU, particularly if we get more iterator types. Note that ITER_IOVEC (which I think is the common case) is usually coming last - and the CPU has to do all the other checks first since the compiler can't know that it might be able to take a shortcut (ie. rule out all the other types in one check first). What I've been exploring is moving to: ITER_IOVEC = 0 ITER_KVEC = 1, ITER_BVEC = 2, ITER_PIPE = 3, ITER_DISCARD = 4, and using switch statements - and then leaving it to the compiler to decide how best to do things. In some ways, it might be nice to let the compiler decide what constants it might use for this so as to best optimise the use cases, but there's no way to do that at the moment. However, all the code that is doing direct accesses using '&' has to change to make that work - so I've converted it all to using accessors so that I only have to change the header file, except that the patch to do that crossed with a cifs patch that added more direct accesses, IIRC. David