Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iov_iter: remove iov_iter_is_aligned

No more callers.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Keith Busch and committed by
Jens Axboe
b475272f 69d7ed5b

-97
-2
include/linux/uio.h
··· 286 286 #endif 287 287 288 288 size_t iov_iter_zero(size_t bytes, struct iov_iter *); 289 - bool iov_iter_is_aligned(const struct iov_iter *i, unsigned addr_mask, 290 - unsigned len_mask); 291 289 unsigned long iov_iter_alignment(const struct iov_iter *i); 292 290 unsigned long iov_iter_gap_alignment(const struct iov_iter *i); 293 291 void iov_iter_init(struct iov_iter *i, unsigned int direction, const struct iovec *iov,
-95
lib/iov_iter.c
··· 784 784 } 785 785 EXPORT_SYMBOL(iov_iter_discard); 786 786 787 - static bool iov_iter_aligned_iovec(const struct iov_iter *i, unsigned addr_mask, 788 - unsigned len_mask) 789 - { 790 - const struct iovec *iov = iter_iov(i); 791 - size_t size = i->count; 792 - size_t skip = i->iov_offset; 793 - 794 - do { 795 - size_t len = iov->iov_len - skip; 796 - 797 - if (len > size) 798 - len = size; 799 - if (len & len_mask) 800 - return false; 801 - if ((unsigned long)(iov->iov_base + skip) & addr_mask) 802 - return false; 803 - 804 - iov++; 805 - size -= len; 806 - skip = 0; 807 - } while (size); 808 - 809 - return true; 810 - } 811 - 812 - static bool iov_iter_aligned_bvec(const struct iov_iter *i, unsigned addr_mask, 813 - unsigned len_mask) 814 - { 815 - const struct bio_vec *bvec = i->bvec; 816 - unsigned skip = i->iov_offset; 817 - size_t size = i->count; 818 - 819 - do { 820 - size_t len = bvec->bv_len - skip; 821 - 822 - if (len > size) 823 - len = size; 824 - if (len & len_mask) 825 - return false; 826 - if ((unsigned long)(bvec->bv_offset + skip) & addr_mask) 827 - return false; 828 - 829 - bvec++; 830 - size -= len; 831 - skip = 0; 832 - } while (size); 833 - 834 - return true; 835 - } 836 - 837 - /** 838 - * iov_iter_is_aligned() - Check if the addresses and lengths of each segments 839 - * are aligned to the parameters. 840 - * 841 - * @i: &struct iov_iter to restore 842 - * @addr_mask: bit mask to check against the iov element's addresses 843 - * @len_mask: bit mask to check against the iov element's lengths 844 - * 845 - * Return: false if any addresses or lengths intersect with the provided masks 846 - */ 847 - bool iov_iter_is_aligned(const struct iov_iter *i, unsigned addr_mask, 848 - unsigned len_mask) 849 - { 850 - if (likely(iter_is_ubuf(i))) { 851 - if (i->count & len_mask) 852 - return false; 853 - if ((unsigned long)(i->ubuf + i->iov_offset) & addr_mask) 854 - return false; 855 - return true; 856 - } 857 - 858 - if (likely(iter_is_iovec(i) || iov_iter_is_kvec(i))) 859 - return iov_iter_aligned_iovec(i, addr_mask, len_mask); 860 - 861 - if (iov_iter_is_bvec(i)) 862 - return iov_iter_aligned_bvec(i, addr_mask, len_mask); 863 - 864 - /* With both xarray and folioq types, we're dealing with whole folios. */ 865 - if (iov_iter_is_xarray(i)) { 866 - if (i->count & len_mask) 867 - return false; 868 - if ((i->xarray_start + i->iov_offset) & addr_mask) 869 - return false; 870 - } 871 - if (iov_iter_is_folioq(i)) { 872 - if (i->count & len_mask) 873 - return false; 874 - if (i->iov_offset & addr_mask) 875 - return false; 876 - } 877 - 878 - return true; 879 - } 880 - EXPORT_SYMBOL_GPL(iov_iter_is_aligned); 881 - 882 787 static unsigned long iov_iter_alignment_iovec(const struct iov_iter *i) 883 788 { 884 789 const struct iovec *iov = iter_iov(i);