]> asedeno.scripts.mit.edu Git - linux.git/commit
iversion: make inode_cmp_iversion{+raw} return bool instead of s64
authorJeff Layton <jlayton@redhat.com>
Tue, 30 Jan 2018 20:32:21 +0000 (15:32 -0500)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Jan 2018 16:43:35 +0000 (08:43 -0800)
commitc0cef30e4ff0dc025f4a1660b8f0ba43ed58426e
tree8be4d90a4eb4f64bf0569e7b9e9bf88112722776
parent3da90b159b146672f830bcd2489dd3a1f4e9e089
iversion: make inode_cmp_iversion{+raw} return bool instead of s64

As Linus points out:

    The inode_cmp_iversion{+raw}() functions are pure and utter crap.

    Why?

    You say that they return 0/negative/positive, but they do so in a
    completely broken manner. They return that ternary value as the
    sequence number difference in a 's64', which means that if you
    actually care about that ternary value, and do the *sane* thing that
    the kernel-doc of the function implies is the right thing, you would
    do

        int cmp = inode_cmp_iversion(inode, old);
        if (cmp < 0 ...

    and as a result you get code that looks sane, but that doesn't
    actually *WORK* right.

Since none of the callers actually care about the ternary value here,
convert the inode_cmp_iversion{+raw} functions to just return a boolean
value (false for matching, true for non-matching).

This matches the existing use of these functions just fine, and makes it
simple to convert them to return a ternary value in the future if we
grow callers that need it.

With this change we can also reimplement inode_cmp_iversion in a simpler
way using inode_peek_iversion.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/iversion.h