[f2fs-dev] [PATCH 2/2] f2fs: clean up {in,de}create_sleep_time
Use pointer parameter @wait to pass result in {in,de}create_sleep_time for cleanup. Signed-off-by: Chao Yu chao2...@samsung.com --- fs/f2fs/gc.c | 8 fs/f2fs/gc.h | 28 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 67860b6..ba89e27 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -44,7 +44,7 @@ static int gc_thread_func(void *data) break; if (sbi-sb-s_writers.frozen = SB_FREEZE_WRITE) { - wait_ms = increase_sleep_time(gc_th, wait_ms); + increase_sleep_time(gc_th, wait_ms); continue; } @@ -65,15 +65,15 @@ static int gc_thread_func(void *data) continue; if (!is_idle(sbi)) { - wait_ms = increase_sleep_time(gc_th, wait_ms); + increase_sleep_time(gc_th, wait_ms); mutex_unlock(sbi-gc_mutex); continue; } if (has_enough_invalid_blocks(sbi)) - wait_ms = decrease_sleep_time(gc_th, wait_ms); + decrease_sleep_time(gc_th, wait_ms); else - wait_ms = increase_sleep_time(gc_th, wait_ms); + increase_sleep_time(gc_th, wait_ms); stat_inc_bggc_count(sbi); diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 524543a..d5ff97c 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -66,26 +66,26 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi) return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100; } -static inline long increase_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) +static inline void increase_sleep_time(struct f2fs_gc_kthread *gc_th, + long *wait) { - if (wait == gc_th-no_gc_sleep_time) - return wait; + if (*wait == gc_th-no_gc_sleep_time) + return; - wait += gc_th-min_sleep_time; - if (wait gc_th-max_sleep_time) - wait = gc_th-max_sleep_time; - return wait; + *wait += gc_th-min_sleep_time; + if (*wait gc_th-max_sleep_time) + *wait = gc_th-max_sleep_time; } -static inline long decrease_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) +static inline void decrease_sleep_time(struct f2fs_gc_kthread *gc_th, + long *wait) { - if (wait == gc_th-no_gc_sleep_time) - wait = gc_th-max_sleep_time; + if (*wait == gc_th-no_gc_sleep_time) + *wait = gc_th-max_sleep_time; - wait -= gc_th-min_sleep_time; - if (wait = gc_th-min_sleep_time) - wait = gc_th-min_sleep_time; - return wait; + *wait -= gc_th-min_sleep_time; + if (*wait = gc_th-min_sleep_time) + *wait = gc_th-min_sleep_time; } static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi) -- 2.2.2 -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] [PATCH 1/2] f2fs: make truncate_inline_date static
1. make truncate_inline_date static; 2. remove parameter @from of truncate_inline_date as callers only pass zero. Signed-off-by: Chao Yu chao2...@samsung.com --- fs/f2fs/f2fs.h | 1 - fs/f2fs/inline.c | 25 + 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1bd1752..5f47496 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1645,7 +1645,6 @@ int f2fs_read_inline_data(struct inode *, struct page *); int f2fs_convert_inline_page(struct dnode_of_data *, struct page *); int f2fs_convert_inline_inode(struct inode *); int f2fs_write_inline_data(struct inode *, struct page *); -void truncate_inline_data(struct page *, u64); bool recover_inline_data(struct inode *, struct page *); struct f2fs_dir_entry *find_in_inline_dir(struct inode *, struct qstr *, struct page **); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index fa2aa2f..1484c00 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -50,6 +50,12 @@ void read_inline_data(struct page *page, struct page *ipage) SetPageUptodate(page); } +static void truncate_inline_data(struct page *ipage) +{ + f2fs_wait_on_page_writeback(ipage, NODE); + memset(inline_data_addr(ipage), 0, MAX_INLINE_DATA); +} + int f2fs_read_inline_data(struct inode *inode, struct page *page) { struct page *ipage; @@ -125,7 +131,7 @@ no_update: set_inode_flag(F2FS_I(dn-inode), FI_APPEND_WRITE); /* clear inline data and flag after data writeback */ - truncate_inline_data(dn-inode_page, 0); + truncate_inline_data(dn-inode_page); clear_out: stat_dec_inline_inode(dn-inode); f2fs_clear_inline_inode(dn-inode); @@ -198,19 +204,6 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) return 0; } -void truncate_inline_data(struct page *ipage, u64 from) -{ - void *addr; - - if (from = MAX_INLINE_DATA) - return; - - f2fs_wait_on_page_writeback(ipage, NODE); - - addr = inline_data_addr(ipage); - memset(addr + from, 0, MAX_INLINE_DATA - from); -} - bool recover_inline_data(struct inode *inode, struct page *npage) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -252,7 +245,7 @@ process_inline: if (f2fs_has_inline_data(inode)) { ipage = get_node_page(sbi, inode-i_ino); f2fs_bug_on(sbi, IS_ERR(ipage)); - truncate_inline_data(ipage, 0); + truncate_inline_data(ipage); f2fs_clear_inline_inode(inode); update_inode(inode, ipage); f2fs_put_page(ipage, 1); @@ -370,7 +363,7 @@ static int f2fs_convert_inline_dir(struct inode *dir, struct page *ipage, set_page_dirty(page); /* clear inline dir and flag after data writeback */ - truncate_inline_data(ipage, 0); + truncate_inline_data(ipage); stat_dec_inline_dir(dir); clear_inode_flag(F2FS_I(dir), FI_INLINE_DENTRY); -- 2.2.2 -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] fibmap.f2fs: fix the wrong stat info
Hi Jaegeuk, -Original Message- From: Jaegeuk Kim [mailto:jaeg...@kernel.org] Sent: Saturday, January 24, 2015 5:20 AM To: Chao Yu Cc: Changman Lee; linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev][PATCH] fibmap.f2fs: fix the wrong stat info Hi Chao, On Thu, Jan 22, 2015 at 11:19:05AM +0800, Chao Yu wrote: fibmap shows ino, size, blocks with incorrectly decimal number, fix it. Before: dev [8:16] ino [0x 238ea : 0] mode [0x81a4 : 33188] nlink [0x 1 : 1] uid [0x 0 : 0] gid [0x 0 : 0] size [0x 79e00 : 0] blksize [0x1000 : 4096] blocks[0x 268 : 0] Patched: dev [8:16] ino [0x 238ea : 145642] mode [0x81a4 : 33188] nlink [0x 1 : 1] uid [0x 0 : 0] gid [0x 0 : 0] size [0x 79e00 : 499200] blksize [0x1000 : 4096] blocks[0x 268 : 616] Signed-off-by: Chao Yu chao2...@samsung.com --- tools/fibmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/fibmap.c b/tools/fibmap.c index a6a112b..2df8094 100644 --- a/tools/fibmap.c +++ b/tools/fibmap.c @@ -33,14 +33,14 @@ void print_stat(struct stat64 *st) { printf(\n); printf(dev [%d:%d]\n, major(st-st_dev), minor(st-st_dev)); - printf(ino [0x%8lx : %ld]\n, st-st_ino, st-st_ino); + printf(ino [0x%8llx : %lld]\n, st-st_ino, st-st_ino); printf(mode [0x%8x : %d]\n, st-st_mode, st-st_mode); printf(nlink [0x%8lx : %ld]\n, st-st_nlink, st-st_nlink); printf(uid [0x%8x : %d]\n, st-st_uid, st-st_uid); printf(gid [0x%8x : %d]\n, st-st_gid, st-st_gid); - printf(size [0x%8lx : %ld]\n, st-st_size, st-st_size); + printf(size [0x%8llx : %lld]\n, st-st_size, st-st_size); printf(blksize [0x%8lx : %ld]\n, st-st_blksize, st-st_blksize); - printf(blocks[0x%8lx : %ld]\n, st-st_blocks, st-st_blocks); + printf(blocks[0x%8llx : %lld]\n, st-st_blocks, st-st_blocks); printf(\n\n); } It needs to use like this. Could you check this out? Very good, this can fix the portability issue, thanks. :) Thanks, From 5a510076b737b734bdeab95dd4b597cdb681fb29 Mon Sep 17 00:00:00 2001 From: Chao Yu chao2...@samsung.com Date: Thu, 22 Jan 2015 11:19:05 +0800 Subject: [PATCH] fibmap.f2fs: fix the wrong stat info fibmap shows ino, size, blocks with incorrectly decimal number, fix it. Before: dev [8:16] ino [0x 238ea : 0] mode [0x81a4 : 33188] nlink [0x 1 : 1] uid [0x 0 : 0] gid [0x 0 : 0] size [0x 79e00 : 0] blksize [0x1000 : 4096] blocks[0x 268 : 0] Patched: dev [8:16] ino [0x 238ea : 145642] mode [0x81a4 : 33188] nlink [0x 1 : 1] uid [0x 0 : 0] gid [0x 0 : 0] size [0x 79e00 : 499200] blksize [0x1000 : 4096] blocks[0x 268 : 616] Signed-off-by: Chao Yu chao2...@samsung.com Signed-off-by: Jaegeuk Kim jaeg...@kernel.org --- tools/fibmap.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/fibmap.c b/tools/fibmap.c index a6a112b..224b233 100644 --- a/tools/fibmap.c +++ b/tools/fibmap.c @@ -12,6 +12,7 @@ #include linux/hdreg.h #include linux/types.h #include linux/fs.h +#include inttypes.h struct file_ext { __u32 f_pos; @@ -33,14 +34,17 @@ void print_stat(struct stat64 *st) { printf(\n); printf(dev [%d:%d]\n, major(st-st_dev), minor(st-st_dev)); - printf(ino [0x%8lx : %ld]\n, st-st_ino, st-st_ino); + printf(ino [0x%8PRIx64 : %PRIu64]\n, + st-st_ino, st-st_ino); printf(mode [0x%8x : %d]\n, st-st_mode, st-st_mode); printf(nlink [0x%8lx : %ld]\n, st-st_nlink, st-st_nlink); printf(uid [0x%8x : %d]\n, st-st_uid, st-st_uid); printf(gid [0x%8x : %d]\n, st-st_gid, st-st_gid); - printf(size [0x%8lx : %ld]\n, st-st_size, st-st_size); + printf(size [0x%8PRIx64 : %PRIu64]\n, + st-st_size, st-st_size); printf(blksize [0x%8lx : %ld]\n, st-st_blksize, st-st_blksize); - printf(blocks[0x%8lx : %ld]\n, st-st_blocks, st-st_blocks); + printf(blocks
Re: [f2fs-dev] [PATCH] f2fs: fix a bug of inheriting default ACL from parent
Hi Kinglong, Nice catch! -Original Message- From: Kinglong Mee [mailto:kinglong...@gmail.com] Sent: Saturday, January 24, 2015 5:06 PM To: Jaegeuk Kim Cc: linux-fsde...@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net Subject: [f2fs-dev] [PATCH] f2fs: fix a bug of inheriting default ACL from parent Introduced by a6dda0e63e97122ce9e0ba04367e37cca28315fa f2fs: use generic posix ACL infrastructure. When testing default acl, gets in recent kernel (3.19.0-rc5), # setfacl -dm g:root:rwx test/ # getfacl test/ # file: test/ # owner: root # group: root user::rwx group::r-x other::r-x default:user::rwx default:group::r-x default:group:root:rwx default:mask::rwx default:other::r-x # cd test/ # mkdir testdir ]# getfacl testdir/ # file: testdir/ # owner: root # group: root user::rwx group::rwx Should be group::r-x? // missing an acl group:root:rwx inherited from parent mask::rwx is missing too. other::r-x default:user::rwx default:group::r-x default:group:root:rwx default:mask::rwx default:other::r-x Signed-off-by: Kinglong Mee kinglong...@gmail.com Reviewed-by: Chao Yu chao2...@samsung.com --- fs/f2fs/acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 1ccb26b..b0b23578 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c @@ -396,7 +396,7 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage, posix_acl_release(default_acl); } if (acl) { - if (error) + if (!error) error = __f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl, ipage); posix_acl_release(acl); -- 2.1.0 -- New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel