Re: [f2fs-dev] [PATCH] f2fs: fix the fault of calculating blkstart twice

2017-03-08 Thread Chao Yu
On 2017/3/8 9:53, Kinglong Mee wrote: > On 3/8/2017 09:11, Jaegeuk Kim wrote: >> Hi, >> >> On 03/04, Kinglong Mee wrote: >>> When the zone type is BLK_ZONE_TYPE_CONVENTIONAL, the blkstart is >>> calculated twice. >>> >>> Signed-off-by: Kinglong Mee >>> --- >>> fs/f2fs/segment.c | 22 +---

Re: [f2fs-dev] [PATCH 2/2] f2fs: check range before defragment

2017-03-08 Thread Chao Yu
On 2017/3/8 10:47, Sheng Yong wrote: > This patch checks the parameter range passed by ioctl to void that range > exceeds the max_file_blocks limit. > > Signed-off-by: Sheng Yong Reviewed-by: Chao Yu -- Announcing the

Re: [f2fs-dev] [PATCH 1/2] f2fs: use parameter max_items instead of PIDVEC_SIZE

2017-03-08 Thread Chao Yu
On 2017/3/8 10:47, Sheng Yong wrote: > Signed-off-by: Sheng Yong Reviewed-by: Chao Yu -- Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Si

Re: [f2fs-dev] [PATCH] f2fs: allocate a bio for discarding when actually issuing it

2017-03-08 Thread Chao Yu
Hi Jaegeuk, On 2017/3/8 10:33, Jaegeuk Kim wrote: > Let's allocate a bio when issuing discard commands later. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/f2fs.h| 4 +- > fs/f2fs/segment.c | 113 > -- > 2 files changed, 62 insertions(

Re: [f2fs-dev] [PATCH] f2fs: adjust the way of calculating nat block

2017-03-08 Thread Fan Li
> -Original Message- > From: Jaegeuk Kim [mailto:jaeg...@kernel.org] > Sent: Thursday, March 09, 2017 5:56 AM > To: Fan Li > Cc: linux-f2fs-devel@lists.sourceforge.net > Subject: Re: [f2fs-dev] [PATCH] f2fs: adjust the way of calculating nat block > > On 03/08, Fan Li wrote: > > use a sl

Re: [f2fs-dev] [PATCH] f2fs: don't allow rename unencrypted file to encrypted directory

2017-03-08 Thread Chao Yu
On 2017/3/8 21:35, Kinglong Mee wrote: > On 3/8/2017 20:08, Chao Yu wrote: >> In commit d9cdc9033181 ("ext4 crypto: enforce context consistency") we >> declared that: >> >> 2) All files or directories in a directory must be protected using the >> same key as their containing directory. >> >> Bu

Re: [f2fs-dev] [PATCH v2] f2fs: sync the enc name flags with disk level filename

2017-03-08 Thread Chao Yu
On 2017/3/8 21:16, Kinglong Mee wrote: > On 3/8/2017 20:14, Chao Yu wrote: >> On 2017/3/6 16:11, Kinglong Mee wrote: >>> A cross rename between two encrypted files, the disk level filenames >>> aren't updated for the file_enc_name(to) checking. >>> >>> Also, cross rename between encrypted file and

Re: [f2fs-dev] [PATCH] f2fs: adjust the way of calculating nat block

2017-03-08 Thread Jaegeuk Kim
On 03/08, Fan Li wrote: > use a slightly simpler expression to calculate nat block with nid. > > Signed-off-by: Fan Li > --- > fs/f2fs/node.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h > index 2f9603f..f9fb5b8 100644 > --- a/fs/f2

Re: [f2fs-dev] f2fs_bug_on in init_dirty_segmap

2017-03-08 Thread Jaegeuk Kim
Hi, On 03/08, Philippe De Muyter wrote: > Hi f2fs developpers, > > Please excuse my maybe dumb question. > > I recently encountered a kernel panic at root mount time (thus making my > system unusable, as my root partition is formatted as f2fs) due to the > following segment in fs/f2fs/segment.c:

Re: [f2fs-dev] [PATCH] f2fs: allocate a bio for discarding when actually issuing it

2017-03-08 Thread Jaegeuk Kim
On 03/08, Christoph Hellwig wrote: > On Tue, Mar 07, 2017 at 06:33:33PM -0800, Jaegeuk Kim wrote: > > Let's allocate a bio when issuing discard commands later. > > Does this solve the issue with your queue stalls? No, the patch just changes bio_alloc timings, but the stall happens when doing subm

Re: [f2fs-dev] [PATCH 2/2] f2fs: don't overwrite node block by SSR

2017-03-08 Thread Jaegeuk Kim
On 03/08, Chao Yu wrote: > On 2017/3/7 5:51, Jaegeuk Kim wrote: > > This patch fixes that SSR can overwrite previous warm node block consisting > > of > > a node chain since the last checkpoint. > > Good catch! > > Need to consider the impact to other accesser, e.g. is_checkpointed_data, > add_d

Re: [f2fs-dev] [PATCH 1/2] f2fs: don't need to invalidate wrong node page

2017-03-08 Thread Jaegeuk Kim
On 03/08, Chao Yu wrote: > On 2017/3/7 5:51, Jaegeuk Kim wrote: > > If f2fs_new_inode() is failed, the bad inode will invalidate 0'th node page > > during f2fs_evict_inode(), which doesn't need to do. > > Hmm...should not allow other using of inode->i_ino in following codes of > f2fs_evict_inode,

Re: [f2fs-dev] [PATCH v2] f2fs: add a punch discard command function

2017-03-08 Thread Jaegeuk Kim
On 03/08, heyunlei wrote: > Hi Jaegeuk, > > On 2017/3/8 10:49, Jaegeuk Kim wrote: > > On 03/07, Jaegeuk Kim wrote: > > > Hi Yunlei, > > > > > > On 03/02, Yunlei He wrote: > > > > This patch add a function to punch discard command if one segment > > > > reuse before discard. Split this segment fro

Re: [f2fs-dev] [PATCH] f2fs: allocate a bio for discarding when actually issuing it

2017-03-08 Thread Christoph Hellwig
On Tue, Mar 07, 2017 at 06:33:33PM -0800, Jaegeuk Kim wrote: > Let's allocate a bio when issuing discard commands later. Does this solve the issue with your queue stalls? > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/f2fs.h| 4 +- > fs/f2fs/segment.c | 113 > +++

[f2fs-dev] f2fs_bug_on in init_dirty_segmap

2017-03-08 Thread Philippe De Muyter
Hi f2fs developpers, Please excuse my maybe dumb question. I recently encountered a kernel panic at root mount time (thus making my system unusable, as my root partition is formatted as f2fs) due to the following segment in fs/f2fs/segment.c:init_dirty_segmap if (valid_blocks > s

[f2fs-dev] 答复: [PATCH] f2fs: remove the redundant cur_victim_sec / sec_usage_check()

2017-03-08 Thread gaoxiang (P)
Hi chao, ok...got it. I'm reading f2fs_GC flow now and have a little confusion with the purpose of some variables. Sorry, Thanks... -邮件原件- 发件人: Yuchao (T) 发送时间: 2017年3月8日 20:37 收件人: gaoxiang (P); jaeg...@kernel.org 抄送: linux-f2fs-devel@lists.sourceforge.net; Duwei (Device OS); Zhouxiyu

Re: [f2fs-dev] [PATCH] f2fs: don't allow rename unencrypted file to encrypted directory

2017-03-08 Thread Kinglong Mee
On 3/8/2017 20:08, Chao Yu wrote: > In commit d9cdc9033181 ("ext4 crypto: enforce context consistency") we > declared that: > > 2) All files or directories in a directory must be protected using the > same key as their containing directory. > > But in f2fs_cross_rename there is a vulnerabilit

Re: [f2fs-dev] [PATCH v2] f2fs: sync the enc name flags with disk level filename

2017-03-08 Thread Kinglong Mee
On 3/8/2017 20:14, Chao Yu wrote: > On 2017/3/6 16:11, Kinglong Mee wrote: >> A cross rename between two encrypted files, the disk level filenames >> aren't updated for the file_enc_name(to) checking. >> >> Also, cross rename between encrypted file and non-encrypted file under >> a non-encrypted fi

Re: [f2fs-dev] [PATCH] f2fs: remove the redundant cur_victim_sec / sec_usage_check()

2017-03-08 Thread Chao Yu
On 2017/3/7 19:06, gaoxiang (P) wrote: > It seems that cur_victim_sec is useless and hard for us to understand its > meaning now. > This patch removes cur_victim_sec variable / sec_usage_check() and > renames confusing victim_secmap to bg_victim_secmap. IIRC, cur_victim_sec is used for avoiding t

Re: [f2fs-dev] [PATCH 2/2] f2fs: don't overwrite node block by SSR

2017-03-08 Thread Chao Yu
On 2017/3/7 5:51, Jaegeuk Kim wrote: > This patch fixes that SSR can overwrite previous warm node block consisting of > a node chain since the last checkpoint. Good catch! Need to consider the impact to other accesser, e.g. is_checkpointed_data, add_discard_addrs? Thanks, > > Fixes: 5b6c6be2d8

Re: [f2fs-dev] [PATCH 1/2] f2fs: don't need to invalidate wrong node page

2017-03-08 Thread Chao Yu
On 2017/3/7 5:51, Jaegeuk Kim wrote: > If f2fs_new_inode() is failed, the bad inode will invalidate 0'th node page > during f2fs_evict_inode(), which doesn't need to do. Hmm...should not allow other using of inode->i_ino in following codes of f2fs_evict_inode, right? Thanks, > > Signed-off-by:

[f2fs-dev] [PATCH] resize.f2fs: fix a resize fail for sector size mismatch

2017-03-08 Thread Yunlei He
This patch fix a resize faill for sector size mismatch. The initial fs comes from an image file, with sector size 512KB, and the block device sector size is equal to block size. Signed-off-by: Yunlei He --- fsck/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fsck

Re: [f2fs-dev] [PATCH v2] f2fs: sync the enc name flags with disk level filename

2017-03-08 Thread Chao Yu
On 2017/3/6 16:11, Kinglong Mee wrote: > A cross rename between two encrypted files, the disk level filenames > aren't updated for the file_enc_name(to) checking. > > Also, cross rename between encrypted file and non-encrypted file under > a non-encrypted file, the enc name flags should update at

[f2fs-dev] [PATCH] f2fs: don't allow rename unencrypted file to encrypted directory

2017-03-08 Thread Chao Yu
In commit d9cdc9033181 ("ext4 crypto: enforce context consistency") we declared that: 2) All files or directories in a directory must be protected using the same key as their containing directory. But in f2fs_cross_rename there is a vulnerability that allow to cross rename unencrypted file in

[f2fs-dev] [PATCH v3] f2fs: combine nat_bits and free_nid_bitmap cache

2017-03-08 Thread Chao Yu
Both nat_bits cache and free_nid_bitmap cache provide same functionality as a intermediate cache between free nid cache and disk, but with different granularity of indicating free nid range, and different persistence policy. nat_bits cache provides better persistence ability, and free_nid_bitmap pr

Re: [f2fs-dev] [PATCH v2] f2fs: combine nat_bits and free_nid_bitmap cache

2017-03-08 Thread Chao Yu
Hi Jaegeuk, On 2017/3/8 6:27, Jaegeuk Kim wrote: > Hi Chao, > > There were two reasons for slow down; one is set_bit_le and the other was > spin_lock calls. > > I think it would'b good to merge this patch in yours as well. > Let me know. I'm ready to integrate together and test them. The chang

Re: [f2fs-dev] [PATCH v2] f2fs: sync the enc name flags with disk level filename

2017-03-08 Thread Kinglong Mee
On 3/8/2017 03:30, Jaegeuk Kim wrote: > Hi Kinglong, > > Can we make a testcase in xfstests to check this clearly? > 1. creat A under encrypted dir > 2. rename A to B > 3. fsync B > 4. power-cut > > Is this your concern? Yes, it is. If B isn't exist, rename A to B means create a new A (unlink th