Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300399

Re: [RFC] ->get_link(), ->put_link() and cookies

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [RFC] ->get_link(), ->put_link() and cookies
Date 2016-01-03 22:50 +0100
Message-ID <qMYHh-2vF-13@gated-at.bofh.it> (permalink)
References <qM1xv-6DT-1@gated-at.bofh.it> <qMWYP-1kX-27@gated-at.bofh.it> <qMXrQ-1KX-7@gated-at.bofh.it> <qMXLc-1Rv-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Jan 03, 2016 at 12:41:47PM -0800, Linus Torvalds wrote:

> I like how it removes "put_link()" as a callback, but at the same time
> I think it's even more abstract than the cookie was.
> 
> The main worry I have is that the naming is generic, but there's only
> a single very specialized use for it. Do we expect other uses?

Quite possibly - I don't have anything specific planned right now, but
I would be surprised if there hadn't been open-coded equivalents
of that thing in many places, and not only "too many instances to touch"
kind of holy cows, at that (timers are obviously very similar, but these
_do_ have way too many instances to even think of converting them).

> Because if not, I think it would be clearer if it was named to be more
> concretely about putlink, and avoid the fact that it feels very
> abstract.
> 
> Don't get me wrong - abstract generalized helper functions are cool.
> But people aren't very abstract, and it tends to make for confusing
> code when you aren't intimately familiar with the rules.

The rules are pretty simple - there are 4 primitives total.
1) DEFINE_DELAYED_CALL(name) - usual DEFINE_MUTEX, etc. style initialized
declaration.
2) set_delayed_call(delayed_call, function, argument) - function is
void(void *), argument is void *.  A-la setup_timer().
3) clear_delayed_call(delayed_call) - resets.
4) do_delayed_call(delayed_call) - evaluates.

That's it.  If you have better suggestions re names, I'd be glad to take
them, but the set of primitives and the rules to go with those are as
simple as it gets.

Sure, we can give it a less generic name for now and just do what we'd done
for another generic thing (rcu_head, aka callback_head) when unrelated
uses show up, but I don't see much point going that way, TBH...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC] ->get_link(), ->put_link() and cookies Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 02/13] logfs: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 11/13] teach nfs_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 03/13] udf: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
    Re: [PATCH 03/13] udf: don't duplicate page_symlink_inode_operations Jan Kara <jack@suse.cz> - 2016-01-05 17:30 +0100
  [PATCH 01/13] switch befs long symlinks to page_symlink_operations Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 09/13] teach shmem_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 06/13] don't put symlink bodies in pagecache into highmem Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:40 +0100
  [PATCH 12/13] kill free_page_put_link() Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:50 +0100
  [PATCH 05/13] namei: page_getlink() and page_follow_link_light() are the same thing Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:50 +0100
  [PATCH 10/13] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:50 +0100
  [PATCH 08/13] teach page_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:50 +0100
  [PATCH 04/13] ufs: get rid of ->setattr() for symlinks Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-01 07:50 +0100
  Re: [RFC] ->get_link(), ->put_link() and cookies Linus Torvalds <torvalds@linux-foundation.org> - 2016-01-03 21:00 +0100
    Re: [RFC] ->get_link(), ->put_link() and cookies Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-03 21:30 +0100
      Re: [RFC] ->get_link(), ->put_link() and cookies Linus Torvalds <torvalds@linux-foundation.org> - 2016-01-03 21:50 +0100
        Re: [RFC] ->get_link(), ->put_link() and cookies Al Viro <viro@ZenIV.linux.org.uk> - 2016-01-03 22:50 +0100

csiph-web