linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandra Seetharaman <sekharan@us.ibm.com>
To: linux-btrfs@vger.kernel.org
Cc: Chandra Seetharaman <sekharan@us.ibm.com>
Subject: [PATCH 3/7] btrfs: subpagesize-blocksize: Handle small extent maps properly
Date: Wed, 11 Dec 2013 17:38:38 -0600	[thread overview]
Message-ID: <1386805122-23972-4-git-send-email-sekharan@us.ibm.com> (raw)
In-Reply-To: <1386805122-23972-1-git-send-email-sekharan@us.ibm.com>

This patch makes sure that the size extent maps handles are at
least PAGE_CACHE_SIZE for the subpagesize-blocksize case.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
 fs/btrfs/inode.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c79c9cd..c0c18ca 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6036,7 +6036,11 @@ next:
 	if (found_type == BTRFS_FILE_EXTENT_REG ||
 	    found_type == BTRFS_FILE_EXTENT_PREALLOC) {
 		em->start = extent_start;
-		em->len = extent_end - extent_start;
+		if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE &&
+				em->len < PAGE_CACHE_SIZE)
+			em->len = PAGE_CACHE_SIZE;
+		else
+			em->len = extent_end - extent_start;
 		em->orig_start = extent_start -
 				 btrfs_file_extent_offset(leaf, item);
 		em->orig_block_len = btrfs_file_extent_disk_num_bytes(leaf,
@@ -6077,6 +6081,8 @@ next:
 		extent_offset = page_offset(page) + pg_offset - extent_start;
 		copy_size = min_t(u64, PAGE_CACHE_SIZE - pg_offset,
 				size - extent_offset);
+		if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE)
+			copy_size = max_t(u64, copy_size, PAGE_CACHE_SIZE);
 		em->start = extent_start + extent_offset;
 		em->len = ALIGN(copy_size, btrfs_align_size(inode));
 		em->orig_block_len = em->len;
-- 
1.7.12.4


  parent reply	other threads:[~2013-12-11 23:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 23:38 [PATCH 0/7] Patches to support subpagesize blocksize Chandra Seetharaman
2013-12-11 23:38 ` [PATCH 1/7] btrfs: subpagesize-blocksize: Define extent_buffer_head Chandra Seetharaman
2013-12-16 12:32   ` saeed bishara
2013-12-16 16:17     ` Chandra Seetharaman
2013-12-17 15:35       ` David Sterba
2013-12-11 23:38 ` [PATCH 2/7] btrfs: subpagesize-blocksize: Use a global alignment for size Chandra Seetharaman
2013-12-16 12:33   ` saeed bishara
2013-12-16 14:48     ` David Sterba
2013-12-16 16:18       ` Chandra Seetharaman
2013-12-11 23:38 ` Chandra Seetharaman [this message]
2013-12-11 23:38 ` [PATCH 4/7] btrfs: subpagesize-blocksize: Handle iosize properly in submit_extent_page() Chandra Seetharaman
2013-12-11 23:38 ` [PATCH 5/7] btrfs: subpagesize-blocksize: handle checksum calculations properly Chandra Seetharaman
2013-12-11 23:38 ` [PATCH 6/7] btrfs: subpagesize-blocksize: Handle relocation clusters appropriately Chandra Seetharaman
2013-12-11 23:38 ` [PATCH 7/7] btrfs: subpagesize-blocksize: Allow mounting filesystems where sectorsize != PAGE_SIZE Chandra Seetharaman
2013-12-13  1:07   ` David Sterba
2013-12-16 12:50     ` saeed bishara
2013-12-12 20:40 ` [PATCH 0/7] Patches to support subpagesize blocksize Josef Bacik
2013-12-13  1:17 ` David Sterba
2013-12-13 15:17   ` Chandra Seetharaman
2013-12-13 15:58     ` David Sterba
2013-12-13 18:39 ` Josef Bacik
2013-12-13 22:09   ` Chandra Seetharaman
2014-01-08 20:06   ` Chandra Seetharaman

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=1386805122-23972-4-git-send-email-sekharan@us.ibm.com \
    --to=sekharan@us.ibm.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).