glock_compare(9)
π glock_compare β the Kernel API Manual, section 9, bestie π
okay so picture this: you're deep in ./fs/gfs2/glock.c and somebody needs to sort a whole pile of glocks. That's literally it. That's the whole job of glock_compare β it compares two struct gfs2_glock structures so they can be sorted. No cap, that's the entire assignment and she ate. β¨
β¨ NAME β¨
glock_compare β compare two struct gfs2_glock structures for sorting π¦
Lowkey the most self-explanatory name in the whole kernel and honestly? We love that for her.
πΈ SYNOPSIS πΈ
int glock_compare (const void *arg_a , const void *arg_b );
Look at that signature. const void * twice, because she's flexible like that β she'll take any two pointers and do her little comparison thing. Periodt. π
π«Ά ARGUMENTS π«Ά
arg_aβ the first structure πarg_bβ the second structure β
That's it. Two structures. She's not asking for much, she just wants both of them and then she's gonna tell you how they sort. Iconic behavior honestly.
π SEE ALSO π
okay so this is the part where I gotta name-drop the entire friend group, because glock_compare does NOT roll alone. Every single one of these lives in the kernel file ./fs/gfs2/glock.c and you should absolutely go say hi to all forty of them:
wake_up_glock(9)gfs2_glock_hold(9)gfs2_glock_put(9)may_grant(9)do_error(9)find_first_holder(9)do_promote(9)find_first_waiter(9)find_last_waiter(9)state_change(9)finish_xmote(9)do_xmote(9)run_queue(9)glock_set_object(9)glock_clear_object(9)gfs2_glock_get(9)__gfs2_holder_init(9)gfs2_holder_reinit(9)gfs2_holder_uninit(9)gfs2_glock_holder_ready(9)gfs2_glock_wait(9)gfs2_glock_async_wait(9)request_demote(9)add_to_queue(9)gfs2_glock_nq(9)gfs2_glock_poll(9)gfs2_glock_dq(9)gfs2_glock_dq_uninit(9)gfs2_glock_nq_num(9)nq_m_sync(9)gfs2_glock_nq_m(9)gfs2_glock_dq_m(9)gfs2_should_freeze(9)gfs2_glock_complete(9)glock_hash_walk(9)thaw_glock(9)gfs2_glock_thaw(9)gfs2_wait_glocks(9)dump_holder(9)gfs2_dump_glock(9)
Forty entries. Forty!! The way this function has more mutuals than I do π but fr fr, that whole roster is the glock squad and they're all in ./fs/gfs2/glock.c together, living their best lives.
ngl if you're hunting for a function that actually does the sorting instead of just comparing, this page isn't gonna hand it to you β but the list above is genuinely where you start looking. No invented tips here, just the actual references, iykyk. π
π§ sign-off π§
this page came straight out of ./fs/gfs2, dated October 2026 β so yes, bestie, she's serving future-core and she knows it. stay glocked and loaded πππ₯
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms