summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-24 12:50:52 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-06-27 19:38:18 -0400
commitcfa816bf3f823a3bedfedd8e214ea929c5c755fe (patch)
tree561ac156481ffbd82cb9698b6994f6d028fc0b9a /include/linux
parent84cb7bffe5e80ef9036213bbfbaf358d478536be (diff)
Update bcachefs sources to 84f132d569 bcachefs: fsck: Break walk_inode() up into multiple functions
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h35
-rw-r--r--include/linux/bvec.h52
-rw-r--r--include/linux/posix_acl_xattr.h4
-rw-r--r--include/linux/uuid.h25
4 files changed, 23 insertions, 93 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 206e5baa..0ad5a87d 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -113,40 +113,17 @@ static inline void *bio_data(struct bio *bio)
#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
-static inline struct bio_vec bio_iter_all_peek(const struct bio *bio,
+static inline struct bio_vec *bio_next_segment(const struct bio *bio,
struct bvec_iter_all *iter)
{
- if (WARN_ON(iter->idx >= bio->bi_vcnt))
- return (struct bio_vec) { NULL };
+ if (iter->idx >= bio->bi_vcnt)
+ return NULL;
- return bvec_iter_all_peek(bio->bi_io_vec, iter);
+ return &bio->bi_io_vec[iter->idx];
}
-static inline void bio_iter_all_advance(const struct bio *bio,
- struct bvec_iter_all *iter,
- unsigned bytes)
-{
- bvec_iter_all_advance(bio->bi_io_vec, iter, bytes);
-
- WARN_ON(iter->idx > bio->bi_vcnt ||
- (iter->idx == bio->bi_vcnt && iter->done));
-}
-
-#define bio_for_each_segment_all_continue(bvl, bio, iter) \
- for (; \
- iter.idx < bio->bi_vcnt && \
- ((bvl = bio_iter_all_peek(bio, &iter)), true); \
- bio_iter_all_advance((bio), &iter, bvl.bv_len))
-
-/*
- * drivers should _never_ use the all version - the bio may have been split
- * before it got to the driver and the driver won't own all of it
- */
-#define bio_for_each_segment_all(bvl, bio, iter) \
- for (bvec_iter_all_init(&iter); \
- iter.idx < (bio)->bi_vcnt && \
- ((bvl = bio_iter_all_peek((bio), &iter)), true); \
- bio_iter_all_advance((bio), &iter, bvl.bv_len))
+#define bio_for_each_segment_all(bvl, bio, iter) \
+ for ((iter).idx = 0; (bvl = bio_next_segment((bio), &(iter))); (iter).idx++)
static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
unsigned bytes)
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index a11373db..5bc68b42 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -43,6 +43,10 @@ struct bvec_iter {
current bvec */
};
+struct bvec_iter_all {
+ int idx;
+};
+
/*
* various member access, note that bio_data should of course not be used
* on highmem page vectors
@@ -94,52 +98,4 @@ static inline void bvec_iter_advance(const struct bio_vec *bv,
((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len))
-/*
- * bvec_iter_all: for advancing over individual pages in a bio, as it was when
- * it was first created:
- */
-struct bvec_iter_all {
- int idx;
- unsigned done;
-};
-
-static inline void bvec_iter_all_init(struct bvec_iter_all *iter_all)
-{
- iter_all->done = 0;
- iter_all->idx = 0;
-}
-
-static inline struct bio_vec __bvec_iter_all_peek(const struct bio_vec *bvec,
- const struct bvec_iter_all *iter)
-{
- struct bio_vec bv = bvec[iter->idx];
-
- BUG_ON(iter->done >= bv.bv_len);
-
- bv.bv_offset += iter->done;
- bv.bv_len -= iter->done;
- return bv;
-}
-
-static inline struct bio_vec bvec_iter_all_peek(const struct bio_vec *bvec,
- const struct bvec_iter_all *iter)
-{
- struct bio_vec bv = __bvec_iter_all_peek(bvec, iter);
-
- bv.bv_len = min_t(unsigned, PAGE_SIZE - bv.bv_offset, bv.bv_len);
- return bv;
-}
-
-static inline void bvec_iter_all_advance(const struct bio_vec *bvec,
- struct bvec_iter_all *iter,
- unsigned bytes)
-{
- iter->done += bytes;
-
- while (iter->done && iter->done >= bvec[iter->idx].bv_len) {
- iter->done -= bvec[iter->idx].bv_len;
- iter->idx++;
- }
-}
-
#endif /* __LINUX_BVEC_ITER_H */
diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h
index 65beeb14..a8dad160 100644
--- a/include/linux/posix_acl_xattr.h
+++ b/include/linux/posix_acl_xattr.h
@@ -28,7 +28,7 @@ typedef struct {
posix_acl_xattr_entry a_entries[0];
} posix_acl_xattr_header;
-extern const struct xattr_handler posix_acl_access_xattr_handler;
-extern const struct xattr_handler posix_acl_default_xattr_handler;
+extern const struct xattr_handler nop_posix_acl_access;
+extern const struct xattr_handler nop_posix_acl_default;
#endif /* _POSIX_ACL_XATTR_H */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 4674746f..a9990902 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,27 +18,24 @@
#include <string.h>
#include <asm/types.h>
+#include <stdbool.h>
-typedef struct {
- __u8 b[16];
-} uuid_le;
+#define UUID_SIZE 16
typedef struct {
- __u8 b[16];
-} uuid_be;
-
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-((uuid_le) \
-{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
- (b) & 0xff, ((b) >> 8) & 0xff, \
- (c) & 0xff, ((c) >> 8) & 0xff, \
- (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+ __u8 b[UUID_SIZE];
+} __uuid_t;
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-((uuid_be) \
+#define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+((__uuid_t) \
{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
((b) >> 8) & 0xff, (b) & 0xff, \
((c) >> 8) & 0xff, (c) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+static inline bool uuid_equal(const __uuid_t *u1, const __uuid_t *u2)
+{
+ return memcmp(u1, u2, sizeof(__uuid_t)) == 0;
+}
+
#endif