Re: [PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Jiri Kosina
On Thu, 10 Dec 2015, Jens Axboe wrote: > It's a balance, as we also should not make APIs out of everything. As I said, > purely my opinion, but I think the is_last/is_first have jumped the shark. I don't have a strong opinion either way. What I think we should do though, is to either have both

[PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Geliang Tang
We already have list_is_last(), it makes sense to also add list_is_first() for consistency. This list utility function to check for first element in a list. Signed-off-by: Geliang Tang --- include/linux/list.h | 11 +++ 1 file changed, 11 insertions(+) diff --git

Re: [PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Jens Axboe
On 12/10/2015 07:17 AM, Geliang Tang wrote: We already have list_is_last(), it makes sense to also add list_is_first() for consistency. This list utility function to check for first element in a list. Honestly, I think we already have way too many of these kind of helpers. IMHO they don't

Re: [PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Josh Poimboeuf
On Thu, Dec 10, 2015 at 08:10:34AM -0700, Jens Axboe wrote: > On 12/10/2015 07:17 AM, Geliang Tang wrote: > >We already have list_is_last(), it makes sense to also add > >list_is_first() for consistency. This list utility function > >to check for first element in a list. > > Honestly, I think we

Re: [PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Jens Axboe
On 12/10/2015 08:23 AM, Josh Poimboeuf wrote: On Thu, Dec 10, 2015 at 08:10:34AM -0700, Jens Axboe wrote: On 12/10/2015 07:17 AM, Geliang Tang wrote: We already have list_is_last(), it makes sense to also add list_is_first() for consistency. This list utility function to check for first

Re: [PATCH 1/4] list: introduce list_is_first()

2015-12-10 Thread Christoph Hellwig
On Thu, Dec 10, 2015 at 09:23:57AM -0600, Josh Poimboeuf wrote: > Personally I would disagree. Something like: > > if (list_is_first(>queuelist, >queue)) > > is much more readable to me than: > > if (rq->queuelist.prev == >queue) > > The first one takes no effort for me -- it's almost