From 966d0176f656e1175841901bb7d8428279d9a7bc Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 16 Mar 2018 10:56:25 -0700 Subject: [PATCH] scoutfs: remove seg kvec_from_pages Item values have been limited to a single value vector entry for a while. They can't span 4K blocks in the segment format so they can't cross kernel pages which are never smaller than 4K. We don't need a helper to build a vector of their contents across disjoint pages. This removes the last user of multi-element kvecs. Signed-off-by: Zach Brown --- kmod/src/seg.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/kmod/src/seg.c b/kmod/src/seg.c index cdb79b2b..645a3134 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -410,20 +410,6 @@ out: return ret; } -static void kvec_from_pages(struct scoutfs_segment *seg, - struct kvec *kvec, u32 off, u16 len) -{ - u32 first; - - first = min_t(int, len, PAGE_SIZE - (off & ~PAGE_MASK)); - - if (first == len) - scoutfs_kvec_init(kvec, off_ptr(seg, off), len); - else - scoutfs_kvec_init(kvec, off_ptr(seg, off), first, - off_ptr(seg, off + first), len - first); -} - static u32 item_bytes(u8 nr_links, u16 key_len, u16 val_len) { return offsetof(struct scoutfs_segment_item, skip_links[nr_links]) + @@ -440,9 +426,9 @@ static inline void *item_key_ptr(struct scoutfs_segment_item *item) return (void *)item + item_bytes(item->nr_links, 0, 0); } -static inline int item_val_off(struct scoutfs_segment_item *item, int item_off) +static inline void *item_val_ptr(struct scoutfs_segment_item *item) { - return item_key_off(item, item_off) + le16_to_cpu(item->key_len); + return item_key_ptr(item) + le16_to_cpu(item->key_len); } static void item_ptrs(struct scoutfs_segment *seg, int off, @@ -454,7 +440,7 @@ static void item_ptrs(struct scoutfs_segment *seg, int off, scoutfs_key_init(key, item_key_ptr(item), le16_to_cpu(item->key_len)); if (val) - kvec_from_pages(seg, val, item_val_off(item, off), + scoutfs_kvec_init(val, item_val_ptr(item), le16_to_cpu(item->val_len)); }