* [PATCH 1/2] f2fs: clean up the do_submit_bio flow
@ 2013-11-18 9:12 Jaegeuk Kim
2013-11-18 9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2013-11-18 9:12 UTC (permalink / raw)
Cc: Jaegeuk Kim, linux-fsdevel, linux-kernel, linux-f2fs-devel
This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with it.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/segment.c | 39 +++++++++++++++++++++------------------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index fe5c2fc..1c783fd 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -351,6 +351,7 @@ enum count_type {
* with waiting the bio's completion
* ... Only can be used with META.
*/
+#define PAGE_TYPE_OF_BIO(type) (type) > META ? META : (type)
enum page_type {
DATA,
NODE,
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 1f83999..dad5f1a 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -837,32 +837,35 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
enum page_type type, bool sync)
{
int rw = sync ? WRITE_SYNC : WRITE;
- enum page_type btype = type > META ? META : type;
+ enum page_type btype = PAGE_TYPE_OF_BIO(type);
+ struct bio *bio = sbi->bio[btype];
+ struct bio_private *p;
+
+ if (!bio)
+ return;
+
+ sbi->bio[btype] = NULL;
if (type >= META_FLUSH)
rw = WRITE_FLUSH_FUA;
-
if (btype == META)
rw |= REQ_META;
- if (sbi->bio[btype]) {
- struct bio_private *p = sbi->bio[btype]->bi_private;
- p->sbi = sbi;
- sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
+ p = bio->bi_private;
+ p->sbi = sbi;
+ bio->bi_end_io = f2fs_end_io_write;
- trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
+ trace_f2fs_do_submit_bio(sbi->sb, btype, sync, bio);
- if (type == META_FLUSH) {
- DECLARE_COMPLETION_ONSTACK(wait);
- p->is_sync = true;
- p->wait = &wait;
- submit_bio(rw, sbi->bio[btype]);
- wait_for_completion(&wait);
- } else {
- p->is_sync = false;
- submit_bio(rw, sbi->bio[btype]);
- }
- sbi->bio[btype] = NULL;
+ if (type == META_FLUSH) {
+ DECLARE_COMPLETION_ONSTACK(wait);
+ p->is_sync = true;
+ p->wait = &wait;
+ submit_bio(rw, bio);
+ wait_for_completion(&wait);
+ } else {
+ p->is_sync = false;
+ submit_bio(rw, bio);
}
}
--
1.8.4.474.g128a96c
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios
2013-11-18 9:12 [PATCH 1/2] f2fs: clean up the do_submit_bio flow Jaegeuk Kim
@ 2013-11-18 9:12 ` Jaegeuk Kim
2013-11-18 9:21 ` Gu Zheng
2013-11-19 0:39 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow Chao Yu
2013-11-19 5:25 ` Chao Yu
2 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2013-11-18 9:12 UTC (permalink / raw)
Cc: Jaegeuk Kim, linux-fsdevel, linux-kernel, linux-f2fs-devel
This patch removes an unnecessary semaphore (i.e., sbi->bio_sem).
There is no reason to use the semaphore when f2fs submits read and write IOs.
Instead, let's use a write mutex and cover the sbi->bio[] by the lock.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
---
fs/f2fs/data.c | 4 ----
fs/f2fs/f2fs.h | 2 +-
fs/f2fs/segment.c | 13 +++++++++----
fs/f2fs/super.c | 2 +-
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 84867dc..7550026 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -390,8 +390,6 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
trace_f2fs_readpage(page, blk_addr, type);
- down_read(&sbi->bio_sem);
-
/* Allocate a new bio */
bio = f2fs_bio_alloc(bdev, 1);
@@ -401,13 +399,11 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
bio_put(bio);
- up_read(&sbi->bio_sem);
f2fs_put_page(page, 1);
return -EFAULT;
}
submit_bio(type, bio);
- up_read(&sbi->bio_sem);
return 0;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 1c783fd..76f5586 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -375,7 +375,7 @@ struct f2fs_sb_info {
struct f2fs_sm_info *sm_info; /* segment manager */
struct bio *bio[NR_PAGE_TYPE]; /* bios to merge */
sector_t last_block_in_bio[NR_PAGE_TYPE]; /* last block number */
- struct rw_semaphore bio_sem; /* IO semaphore */
+ struct mutex write_mutex; /* mutex for writing IOs */
/* for checkpoint */
struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index dad5f1a..893d489 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -871,9 +871,14 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
void f2fs_submit_bio(struct f2fs_sb_info *sbi, enum page_type type, bool sync)
{
- down_write(&sbi->bio_sem);
+ enum page_type btype = PAGE_TYPE_OF_BIO(type);
+
+ if (!sbi->bio[btype])
+ return;
+
+ mutex_lock(&sbi->write_mutex);
do_submit_bio(sbi, type, sync);
- up_write(&sbi->bio_sem);
+ mutex_unlock(&sbi->write_mutex);
}
static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
@@ -884,7 +889,7 @@ static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
verify_block_addr(sbi, blk_addr);
- down_write(&sbi->bio_sem);
+ mutex_lock(&sbi->write_mutex);
inc_page_count(sbi, F2FS_WRITEBACK);
@@ -919,7 +924,7 @@ retry:
sbi->last_block_in_bio[type] = blk_addr;
- up_write(&sbi->bio_sem);
+ mutex_unlock(&sbi->write_mutex);
trace_f2fs_submit_write_page(page, blk_addr, type);
}
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 2c52527..c7b6300 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -882,7 +882,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
mutex_init(&sbi->node_write);
sbi->por_doing = false;
spin_lock_init(&sbi->stat_lock);
- init_rwsem(&sbi->bio_sem);
+ mutex_init(&sbi->write_mutex);
init_rwsem(&sbi->cp_rwsem);
init_waitqueue_head(&sbi->cp_wait);
init_sb_info(sbi);
--
1.8.4.474.g128a96c
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios
2013-11-18 9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
@ 2013-11-18 9:21 ` Gu Zheng
2013-11-18 9:30 ` Jaegeuk Kim
0 siblings, 1 reply; 7+ messages in thread
From: Gu Zheng @ 2013-11-18 9:21 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
Hi Kim,
On 11/18/2013 05:12 PM, Jaegeuk Kim wrote:
> This patch removes an unnecessary semaphore (i.e., sbi->bio_sem).
> There is no reason to use the semaphore when f2fs submits read and write IOs.
> Instead, let's use a write mutex and cover the sbi->bio[] by the lock.
My god, I just sent out an almost the same patch, do we have a telepathy?:)
Regard,
Gu
>
> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> ---
> fs/f2fs/data.c | 4 ----
> fs/f2fs/f2fs.h | 2 +-
> fs/f2fs/segment.c | 13 +++++++++----
> fs/f2fs/super.c | 2 +-
> 4 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 84867dc..7550026 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -390,8 +390,6 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
>
> trace_f2fs_readpage(page, blk_addr, type);
>
> - down_read(&sbi->bio_sem);
> -
> /* Allocate a new bio */
> bio = f2fs_bio_alloc(bdev, 1);
>
> @@ -401,13 +399,11 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
>
> if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
> bio_put(bio);
> - up_read(&sbi->bio_sem);
> f2fs_put_page(page, 1);
> return -EFAULT;
> }
>
> submit_bio(type, bio);
> - up_read(&sbi->bio_sem);
> return 0;
> }
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 1c783fd..76f5586 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -375,7 +375,7 @@ struct f2fs_sb_info {
> struct f2fs_sm_info *sm_info; /* segment manager */
> struct bio *bio[NR_PAGE_TYPE]; /* bios to merge */
> sector_t last_block_in_bio[NR_PAGE_TYPE]; /* last block number */
> - struct rw_semaphore bio_sem; /* IO semaphore */
> + struct mutex write_mutex; /* mutex for writing IOs */
>
> /* for checkpoint */
> struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index dad5f1a..893d489 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -871,9 +871,14 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
>
> void f2fs_submit_bio(struct f2fs_sb_info *sbi, enum page_type type, bool sync)
> {
> - down_write(&sbi->bio_sem);
> + enum page_type btype = PAGE_TYPE_OF_BIO(type);
> +
> + if (!sbi->bio[btype])
> + return;
> +
> + mutex_lock(&sbi->write_mutex);
> do_submit_bio(sbi, type, sync);
> - up_write(&sbi->bio_sem);
> + mutex_unlock(&sbi->write_mutex);
> }
>
> static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
> @@ -884,7 +889,7 @@ static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
>
> verify_block_addr(sbi, blk_addr);
>
> - down_write(&sbi->bio_sem);
> + mutex_lock(&sbi->write_mutex);
>
> inc_page_count(sbi, F2FS_WRITEBACK);
>
> @@ -919,7 +924,7 @@ retry:
>
> sbi->last_block_in_bio[type] = blk_addr;
>
> - up_write(&sbi->bio_sem);
> + mutex_unlock(&sbi->write_mutex);
> trace_f2fs_submit_write_page(page, blk_addr, type);
> }
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 2c52527..c7b6300 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -882,7 +882,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> mutex_init(&sbi->node_write);
> sbi->por_doing = false;
> spin_lock_init(&sbi->stat_lock);
> - init_rwsem(&sbi->bio_sem);
> + mutex_init(&sbi->write_mutex);
> init_rwsem(&sbi->cp_rwsem);
> init_waitqueue_head(&sbi->cp_wait);
> init_sb_info(sbi);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios
2013-11-18 9:21 ` Gu Zheng
@ 2013-11-18 9:30 ` Jaegeuk Kim
0 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2013-11-18 9:30 UTC (permalink / raw)
To: Gu Zheng; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
Hi Gu,
2013-11-18 (월), 17:21 +0800, Gu Zheng:
> Hi Kim,
> On 11/18/2013 05:12 PM, Jaegeuk Kim wrote:
>
> > This patch removes an unnecessary semaphore (i.e., sbi->bio_sem).
> > There is no reason to use the semaphore when f2fs submits read and write IOs.
> > Instead, let's use a write mutex and cover the sbi->bio[] by the lock.
>
> My god, I just sent out an almost the same patch, do we have a telepathy?:)
Wow, it seems so. :)
--
Jaegeuk Kim
Samsung
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
2013-11-18 9:12 [PATCH 1/2] f2fs: clean up the do_submit_bio flow Jaegeuk Kim
2013-11-18 9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
@ 2013-11-19 0:39 ` Chao Yu
2013-11-19 5:25 ` Chao Yu
2 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2013-11-19 0:39 UTC (permalink / raw)
To: 'Jaegeuk Kim'; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
Hi
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> Sent: Monday, November 18, 2013 5:12 PM
> Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
>
> This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with
it.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> ---
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/segment.c | 39 +++++++++++++++++++++------------------
> 2 files changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index fe5c2fc..1c783fd 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -351,6 +351,7 @@ enum count_type {
> * with waiting the bio's completion
> * ... Only can be used with META.
> */
> +#define PAGE_TYPE_OF_BIO(type) (type) > META ? META : (type)
We'd better to add parentheses for macro to avoid style problem.:)
#define PAGE_TYPE_OF_BIO(type) ((type) > META ? META : (type))
> enum page_type {
> DATA,
> NODE,
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 1f83999..dad5f1a 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -837,32 +837,35 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
> enum page_type type, bool sync)
> {
> int rw = sync ? WRITE_SYNC : WRITE;
> - enum page_type btype = type > META ? META : type;
> + enum page_type btype = PAGE_TYPE_OF_BIO(type);
> + struct bio *bio = sbi->bio[btype];
> + struct bio_private *p;
> +
> + if (!bio)
> + return;
> +
> + sbi->bio[btype] = NULL;
>
> if (type >= META_FLUSH)
> rw = WRITE_FLUSH_FUA;
> -
> if (btype == META)
> rw |= REQ_META;
>
> - if (sbi->bio[btype]) {
> - struct bio_private *p = sbi->bio[btype]->bi_private;
> - p->sbi = sbi;
> - sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
> + p = bio->bi_private;
> + p->sbi = sbi;
> + bio->bi_end_io = f2fs_end_io_write;
>
> - trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
> + trace_f2fs_do_submit_bio(sbi->sb, btype, sync, bio);
>
> - if (type == META_FLUSH) {
> - DECLARE_COMPLETION_ONSTACK(wait);
> - p->is_sync = true;
> - p->wait = &wait;
> - submit_bio(rw, sbi->bio[btype]);
> - wait_for_completion(&wait);
> - } else {
> - p->is_sync = false;
> - submit_bio(rw, sbi->bio[btype]);
> - }
> - sbi->bio[btype] = NULL;
> + if (type == META_FLUSH) {
> + DECLARE_COMPLETION_ONSTACK(wait);
> + p->is_sync = true;
> + p->wait = &wait;
> + submit_bio(rw, bio);
> + wait_for_completion(&wait);
> + } else {
> + p->is_sync = false;
> + submit_bio(rw, bio);
> }
> }
>
> --
> 1.8.4.474.g128a96c
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
2013-11-18 9:12 [PATCH 1/2] f2fs: clean up the do_submit_bio flow Jaegeuk Kim
2013-11-18 9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
2013-11-19 0:39 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow Chao Yu
@ 2013-11-19 5:25 ` Chao Yu
2013-11-19 6:33 ` Jaegeuk Kim
2 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2013-11-19 5:25 UTC (permalink / raw)
To: 'Jaegeuk Kim'; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
Hi
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> Sent: Monday, November 18, 2013 5:12 PM
> Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
>
> This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with it.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> ---
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/segment.c | 39 +++++++++++++++++++++------------------
> 2 files changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index fe5c2fc..1c783fd 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -351,6 +351,7 @@ enum count_type {
> * with waiting the bio's completion
> * ... Only can be used with META.
> */
> +#define PAGE_TYPE_OF_BIO(type) (type) > META ? META : (type)
> enum page_type {
> DATA,
> NODE,
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 1f83999..dad5f1a 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -837,32 +837,35 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
> enum page_type type, bool sync)
> {
> int rw = sync ? WRITE_SYNC : WRITE;
> - enum page_type btype = type > META ? META : type;
> + enum page_type btype = PAGE_TYPE_OF_BIO(type);
->f2fs_submit_bio()
: enum page_type btype = PAGE_TYPE_OF_BIO(type);
->do_submit_bio()
: enum page_type btype = PAGE_TYPE_OF_BIO(type);
Could we remove PAGE_TYPE_OF_BIO or use f2fs_bug_on to instead
in do_submit_bio()? because it looks redundant , and also
submit_write_page() will not pass the type which is larger than META.
> + struct bio *bio = sbi->bio[btype];
> + struct bio_private *p;
> +
> + if (!bio)
> + return;
> +
> + sbi->bio[btype] = NULL;
>
> if (type >= META_FLUSH)
> rw = WRITE_FLUSH_FUA;
> -
> if (btype == META)
> rw |= REQ_META;
>
> - if (sbi->bio[btype]) {
> - struct bio_private *p = sbi->bio[btype]->bi_private;
> - p->sbi = sbi;
> - sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
> + p = bio->bi_private;
> + p->sbi = sbi;
> + bio->bi_end_io = f2fs_end_io_write;
>
> - trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
> + trace_f2fs_do_submit_bio(sbi->sb, btype, sync, bio);
>
> - if (type == META_FLUSH) {
> - DECLARE_COMPLETION_ONSTACK(wait);
> - p->is_sync = true;
> - p->wait = &wait;
> - submit_bio(rw, sbi->bio[btype]);
> - wait_for_completion(&wait);
> - } else {
> - p->is_sync = false;
> - submit_bio(rw, sbi->bio[btype]);
> - }
> - sbi->bio[btype] = NULL;
> + if (type == META_FLUSH) {
> + DECLARE_COMPLETION_ONSTACK(wait);
> + p->is_sync = true;
> + p->wait = &wait;
> + submit_bio(rw, bio);
> + wait_for_completion(&wait);
> + } else {
> + p->is_sync = false;
> + submit_bio(rw, bio);
> }
> }
>
> --
> 1.8.4.474.g128a96c
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
2013-11-19 5:25 ` Chao Yu
@ 2013-11-19 6:33 ` Jaegeuk Kim
0 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2013-11-19 6:33 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
Hi,
2013-11-19 (화), 13:25 +0800, Chao Yu:
> Hi
>
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> > Sent: Monday, November 18, 2013 5:12 PM
> > Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> > Subject: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
> >
> > This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with it.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> > ---
> > fs/f2fs/f2fs.h | 1 +
> > fs/f2fs/segment.c | 39 +++++++++++++++++++++------------------
> > 2 files changed, 22 insertions(+), 18 deletions(-)
> >
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index fe5c2fc..1c783fd 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -351,6 +351,7 @@ enum count_type {
> > * with waiting the bio's completion
> > * ... Only can be used with META.
> > */
> > +#define PAGE_TYPE_OF_BIO(type) (type) > META ? META : (type)
I'll add parenthesis as you suggested. Thanks.
> > enum page_type {
> > DATA,
> > NODE,
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index 1f83999..dad5f1a 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -837,32 +837,35 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
> > enum page_type type, bool sync)
> > {
> > int rw = sync ? WRITE_SYNC : WRITE;
> > - enum page_type btype = type > META ? META : type;
> > + enum page_type btype = PAGE_TYPE_OF_BIO(type);
>
> ->f2fs_submit_bio()
> : enum page_type btype = PAGE_TYPE_OF_BIO(type);
> ->do_submit_bio()
> : enum page_type btype = PAGE_TYPE_OF_BIO(type);
>
> Could we remove PAGE_TYPE_OF_BIO or use f2fs_bug_on to instead
> in do_submit_bio()? because it looks redundant , and also
> submit_write_page() will not pass the type which is larger than META.
The f2fs_submit_bio(type) calls do_submit_bio(type) in which the type is
able to be META_FLUSH from sync_meta_pages().
So, we need to do this. :)
--
Jaegeuk Kim
Samsung
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-19 6:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-18 9:12 [PATCH 1/2] f2fs: clean up the do_submit_bio flow Jaegeuk Kim
2013-11-18 9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
2013-11-18 9:21 ` Gu Zheng
2013-11-18 9:30 ` Jaegeuk Kim
2013-11-19 0:39 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow Chao Yu
2013-11-19 5:25 ` Chao Yu
2013-11-19 6:33 ` Jaegeuk Kim
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).