~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/keylist.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/bcachefs/keylist.c (Architecture m68k) and /fs/bcachefs/keylist.c (Architecture sparc)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 #include "bcachefs.h"                               3 #include "bcachefs.h"
  4 #include "bkey.h"                                   4 #include "bkey.h"
  5 #include "keylist.h"                                5 #include "keylist.h"
  6                                                     6 
  7 int bch2_keylist_realloc(struct keylist *l, u6      7 int bch2_keylist_realloc(struct keylist *l, u64 *inline_u64s,
  8                         size_t nr_inline_u64s,      8                         size_t nr_inline_u64s, size_t new_u64s)
  9 {                                                   9 {
 10         size_t oldsize = bch2_keylist_u64s(l);     10         size_t oldsize = bch2_keylist_u64s(l);
 11         size_t newsize = oldsize + new_u64s;       11         size_t newsize = oldsize + new_u64s;
 12         u64 *old_buf = l->keys_p == inline_u64     12         u64 *old_buf = l->keys_p == inline_u64s ? NULL : l->keys_p;
 13         u64 *new_keys;                             13         u64 *new_keys;
 14                                                    14 
 15         newsize = roundup_pow_of_two(newsize);     15         newsize = roundup_pow_of_two(newsize);
 16                                                    16 
 17         if (newsize <= nr_inline_u64s ||           17         if (newsize <= nr_inline_u64s ||
 18             (old_buf && roundup_pow_of_two(old     18             (old_buf && roundup_pow_of_two(oldsize) == newsize))
 19                 return 0;                          19                 return 0;
 20                                                    20 
 21         new_keys = krealloc(old_buf, sizeof(u6     21         new_keys = krealloc(old_buf, sizeof(u64) * newsize, GFP_NOFS);
 22         if (!new_keys)                             22         if (!new_keys)
 23                 return -ENOMEM;                    23                 return -ENOMEM;
 24                                                    24 
 25         if (!old_buf)                              25         if (!old_buf)
 26                 memcpy_u64s(new_keys, inline_u     26                 memcpy_u64s(new_keys, inline_u64s, oldsize);
 27                                                    27 
 28         l->keys_p = new_keys;                      28         l->keys_p = new_keys;
 29         l->top_p = new_keys + oldsize;             29         l->top_p = new_keys + oldsize;
 30                                                    30 
 31         return 0;                                  31         return 0;
 32 }                                                  32 }
 33                                                    33 
 34 void bch2_keylist_pop_front(struct keylist *l)     34 void bch2_keylist_pop_front(struct keylist *l)
 35 {                                                  35 {
 36         l->top_p -= bch2_keylist_front(l)->k.u     36         l->top_p -= bch2_keylist_front(l)->k.u64s;
 37                                                    37 
 38         memmove_u64s_down(l->keys,                 38         memmove_u64s_down(l->keys,
 39                           bkey_next(l->keys),      39                           bkey_next(l->keys),
 40                           bch2_keylist_u64s(l)     40                           bch2_keylist_u64s(l));
 41 }                                                  41 }
 42                                                    42 
 43 #ifdef CONFIG_BCACHEFS_DEBUG                       43 #ifdef CONFIG_BCACHEFS_DEBUG
 44 void bch2_verify_keylist_sorted(struct keylist     44 void bch2_verify_keylist_sorted(struct keylist *l)
 45 {                                                  45 {
 46         for_each_keylist_key(l, k)                 46         for_each_keylist_key(l, k)
 47                 BUG_ON(bkey_next(k) != l->top      47                 BUG_ON(bkey_next(k) != l->top &&
 48                        bpos_ge(k->k.p, bkey_ne     48                        bpos_ge(k->k.p, bkey_next(k)->k.p));
 49 }                                                  49 }
 50 #endif                                             50 #endif
 51                                                    51 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php