All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows
@ 2015-10-14  7:26 Qu Wenruo
  2015-10-14  7:26 ` [PATCH 1/2] btrfs: Remove empty header file extent-tree.h Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2015-10-14  7:26 UTC (permalink / raw)
  To: linux-btrfs, clm

Hi Chris,

This pull is quite a small one, with 2 small and safe patches.

The first one is a fix that get missing in 4.2 merge windows.
Just remove an empty header I created in qgroup rework.

The other one is found in qgroup reserve rework, but that's also very
small and safe, with test case submitted:
https://patchwork.kernel.org/patch/7292921/

I was planning to include two qgroup rescan fix patches, but doesn't get
further comment from David, so they may be delayed to 4.4, with qgroup
reserve rework.

Thanks,
Qu

Qu Wenruo (2):
  btrfs: Remove empty header file extent-tree.h
  btrfs: Avoid truncate tailing page if fallocate range doesn't exceed
    inode size

 fs/btrfs/extent-tree.h | 0
 fs/btrfs/file.c        | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 fs/btrfs/extent-tree.h

-- 
2.6.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] btrfs: Remove empty header file extent-tree.h
  2015-10-14  7:26 [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Qu Wenruo
@ 2015-10-14  7:26 ` Qu Wenruo
  2015-10-14  7:26 ` [PATCH 2/2] btrfs: Avoid truncate tailing page if fallocate range doesn't exceed inode size Qu Wenruo
  2015-10-15  1:45 ` [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Chris Mason
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2015-10-14  7:26 UTC (permalink / raw)
  To: linux-btrfs, clm

The empty file is introduced as an careless 'git add' during the qgroup
accounting framework rework.

Just remove it.

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.h | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 fs/btrfs/extent-tree.h

diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h
deleted file mode 100644
index e69de29..0000000
-- 
2.6.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] btrfs: Avoid truncate tailing page if fallocate range doesn't exceed inode size
  2015-10-14  7:26 [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Qu Wenruo
  2015-10-14  7:26 ` [PATCH 1/2] btrfs: Remove empty header file extent-tree.h Qu Wenruo
@ 2015-10-14  7:26 ` Qu Wenruo
  2015-10-15  1:45 ` [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Chris Mason
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2015-10-14  7:26 UTC (permalink / raw)
  To: linux-btrfs, clm

Current code will always truncate tailing page if its alloc_start is
smaller than inode size.

For example, the file extent layout is like:
0	4K	8K	16K	32K
|<-----Extent A---------------->|
|<--Inode size: 18K---------->|

But if calling fallocate even for range [0,4K), it will cause btrfs to
re-truncate the range [16,32K), causing COW and a new extent.

0	4K	8K	16K	32K
|///////|	<- Fallocate call range
|<-----Extent A-------->|<--B-->|

The cause is quite easy, just a careless btrfs_truncate_inode() in a
else branch without extra judgment.
Fix it by add judgment on whether the fallocate range is beyond isize.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 fs/btrfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index b823fac..8c6f247 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2584,7 +2584,7 @@ static long btrfs_fallocate(struct file *file, int mode,
 					alloc_start);
 		if (ret)
 			goto out;
-	} else {
+	} else if (offset + len > inode->i_size) {
 		/*
 		 * If we are fallocating from the end of the file onward we
 		 * need to zero out the end of the page if i_size lands in the
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows
  2015-10-14  7:26 [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Qu Wenruo
  2015-10-14  7:26 ` [PATCH 1/2] btrfs: Remove empty header file extent-tree.h Qu Wenruo
  2015-10-14  7:26 ` [PATCH 2/2] btrfs: Avoid truncate tailing page if fallocate range doesn't exceed inode size Qu Wenruo
@ 2015-10-15  1:45 ` Chris Mason
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Mason @ 2015-10-15  1:45 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Wed, Oct 14, 2015 at 03:26:11PM +0800, Qu Wenruo wrote:
> Hi Chris,
> 
> This pull is quite a small one, with 2 small and safe patches.
> 
> The first one is a fix that get missing in 4.2 merge windows.
> Just remove an empty header I created in qgroup rework.
> 
> The other one is found in qgroup reserve rework, but that's also very
> small and safe, with test case submitted:
> https://patchwork.kernel.org/patch/7292921/

Thanks Qu, I'll get these tested.

-chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-15  1:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14  7:26 [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Qu Wenruo
2015-10-14  7:26 ` [PATCH 1/2] btrfs: Remove empty header file extent-tree.h Qu Wenruo
2015-10-14  7:26 ` [PATCH 2/2] btrfs: Avoid truncate tailing page if fallocate range doesn't exceed inode size Qu Wenruo
2015-10-15  1:45 ` [PULL REQUEST][PATCH 0/2] Small fixes for 4.3 merge windows Chris Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.