From: Kent Overstreet <kmo@daterainc.com>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Cc: hch@infradead.org, clm@fb.com, viro@zeniv.linux.org.uk,
zab@redhat.com, shaggy@kernel.org,
Kent Overstreet <kmo@daterainc.com>
Subject: [PATCH 06/11] iov_iter: Kill iov_iter_single_seg_count()
Date: Tue, 3 Dec 2013 14:00:12 -0800 [thread overview]
Message-ID: <1386108017-27964-7-git-send-email-kmo@daterainc.com> (raw)
In-Reply-To: <1386108017-27964-1-git-send-email-kmo@daterainc.com>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
---
fs/fuse/file.c | 6 +++---
include/linux/uio.h | 1 -
mm/filemap.c | 15 +--------------
3 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 7e70506..69175a1 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -996,7 +996,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
if (!tmp) {
unlock_page(page);
page_cache_release(page);
- bytes = min(bytes, iov_iter_single_seg_count(ii));
+ bytes = min(bytes, iov_iter_iovec(ii).iov_len);
goto again;
}
@@ -1187,7 +1187,7 @@ static inline unsigned long fuse_get_user_addr(const struct iov_iter *ii)
static inline size_t fuse_get_frag_size(const struct iov_iter *ii,
size_t max_size)
{
- return min(iov_iter_single_seg_count(ii), max_size);
+ return min(iov_iter_iovec(ii).iov_len, max_size);
}
static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
@@ -1261,7 +1261,7 @@ static inline int fuse_iter_npages(const struct iov_iter *ii_p)
while (iov_iter_count(&ii) && npages < FUSE_MAX_PAGES_PER_REQ) {
unsigned long user_addr = fuse_get_user_addr(&ii);
unsigned offset = user_addr & ~PAGE_MASK;
- size_t frag_size = iov_iter_single_seg_count(&ii);
+ size_t frag_size = iov_iter_iovec(&ii).iov_len;
npages += (frag_size + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
iov_iter_advance(&ii, frag_size);
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 347d70c..2b99e0d 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -66,7 +66,6 @@ size_t iov_iter_copy_from_user(struct page *page,
struct iov_iter *i, unsigned long offset, size_t bytes);
void iov_iter_advance(struct iov_iter *i, size_t bytes);
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
-size_t iov_iter_single_seg_count(const struct iov_iter *i);
static inline void iov_iter_init(struct iov_iter *i,
const struct iovec *iov, unsigned long nr_segs,
diff --git a/mm/filemap.c b/mm/filemap.c
index b7749a9..1a40f12 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2075,19 +2075,6 @@ int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
EXPORT_SYMBOL(iov_iter_fault_in_readable);
/*
- * Return the count of just the current iov_iter segment.
- */
-size_t iov_iter_single_seg_count(const struct iov_iter *i)
-{
- const struct iovec *iov = i->iov;
- if (i->nr_segs == 1)
- return i->count;
- else
- return min(i->count, iov->iov_len - i->iov_offset);
-}
-EXPORT_SYMBOL(iov_iter_single_seg_count);
-
-/*
* Performs necessary checks before doing a write
*
* Can adjust writing position or amount of bytes to write.
@@ -2375,7 +2362,7 @@ again:
* once without a pagefault.
*/
bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
- iov_iter_single_seg_count(i));
+ iov_iter_iovec(i).iov_len);
goto again;
}
pos += copied;
--
1.8.4.4
next prev parent reply other threads:[~2013-12-03 22:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 22:00 [PATCH] DIO rewrite Kent Overstreet
2013-12-03 22:00 ` [PATCH 01/11] block: Make generic_make_request handle arbitrary sized bios Kent Overstreet
2013-12-03 22:00 ` [PATCH 02/11] block: Gut bio_add_page() Kent Overstreet
2013-12-03 22:00 ` [PATCH 03/11] btrfs: generic_make_request() handles arbitrary size bios now Kent Overstreet
2013-12-03 22:00 ` [PATCH 04/11] btrfs: convert to bio_for_each_segment() Kent Overstreet
2013-12-03 22:00 ` [PATCH 05/11] iov_iter: Move iov_iter to uio.h Kent Overstreet
2013-12-06 11:09 ` Christoph Hellwig
2013-12-03 22:00 ` Kent Overstreet [this message]
2013-12-06 11:11 ` [PATCH 06/11] iov_iter: Kill iov_iter_single_seg_count() Christoph Hellwig
2013-12-03 22:00 ` [PATCH 07/11] iov_iter: Kill written arg to iov_iter_init() Kent Overstreet
2013-12-06 11:14 ` Christoph Hellwig
2013-12-03 22:00 ` [PATCH 08/11] block: convert to iov_iter Kent Overstreet
2013-12-06 19:50 ` Christoph Hellwig
2013-12-03 22:00 ` [PATCH 09/11] block: iov_count_pages() Kent Overstreet
2013-12-06 19:53 ` Christoph Hellwig
2013-12-03 22:00 ` [PATCH 10/11] block: Add bio_get_user_pages() Kent Overstreet
2013-12-06 19:57 ` Christoph Hellwig
2013-12-03 22:00 ` [PATCH 11/11] direct-io: Rewrite based on immutable biovecs Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386108017-27964-7-git-send-email-kmo@daterainc.com \
--to=kmo@daterainc.com \
--cc=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).