* [PATCH v2] exfat: optimize exfat_zeroed_cluster()
@ 2020-06-24 2:30 ` Tetsuhiro Kohada
2020-07-02 12:06 ` Sungjong Seo
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuhiro Kohada @ 2020-06-24 2:30 UTC (permalink / raw)
To: kohada.t2
Cc: kohada.tetsuhiro, mori.takahiro, motai.hirotaka, Namjae Jeon,
Sungjong Seo, linux-fsdevel, linux-kernel
Replace part of exfat_zeroed_cluster() with exfat_update_bhs().
And remove exfat_sync_bhs().
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
---
Changes in v2
- Rebase to latest exfat-dev
fs/exfat/fatent.c | 53 +++++++++--------------------------------------
1 file changed, 10 insertions(+), 43 deletions(-)
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index 82ee8246c080..c3c9afee7418 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -229,21 +229,6 @@ int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
return 0;
}
-static inline int exfat_sync_bhs(struct buffer_head **bhs, int nr_bhs)
-{
- int i, err = 0;
-
- for (i = 0; i < nr_bhs; i++)
- write_dirty_buffer(bhs[i], 0);
-
- for (i = 0; i < nr_bhs; i++) {
- wait_on_buffer(bhs[i]);
- if (!err && !buffer_uptodate(bhs[i]))
- err = -EIO;
- }
- return err;
-}
-
int exfat_zeroed_cluster(struct inode *dir, unsigned int clu)
{
struct super_block *sb = dir->i_sb;
@@ -265,41 +250,23 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu)
}
/* Zeroing the unused blocks on this cluster */
- n = 0;
while (blknr < last_blknr) {
- bhs[n] = sb_getblk(sb, blknr);
- if (!bhs[n]) {
- err = -ENOMEM;
- goto release_bhs;
- }
- memset(bhs[n]->b_data, 0, sb->s_blocksize);
- exfat_update_bh(bhs[n], 0);
-
- n++;
- blknr++;
-
- if (n == nr_bhs) {
- if (IS_DIRSYNC(dir)) {
- err = exfat_sync_bhs(bhs, n);
- if (err)
- goto release_bhs;
+ for (n = 0; n < nr_bhs && blknr < last_blknr; n++, blknr++) {
+ bhs[n] = sb_getblk(sb, blknr);
+ if (!bhs[n]) {
+ err = -ENOMEM;
+ goto release_bhs;
}
-
- for (i = 0; i < n; i++)
- brelse(bhs[i]);
- n = 0;
+ memset(bhs[n]->b_data, 0, sb->s_blocksize);
}
- }
- if (IS_DIRSYNC(dir)) {
- err = exfat_sync_bhs(bhs, n);
+ err = exfat_update_bhs(bhs, n, IS_DIRSYNC(dir));
if (err)
goto release_bhs;
- }
-
- for (i = 0; i < n; i++)
- brelse(bhs[i]);
+ for (i = 0; i < n; i++)
+ brelse(bhs[i]);
+ }
return 0;
release_bhs:
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v2] exfat: optimize exfat_zeroed_cluster()
2020-06-24 2:30 ` [PATCH v2] exfat: optimize exfat_zeroed_cluster() Tetsuhiro Kohada
@ 2020-07-02 12:06 ` Sungjong Seo
2020-07-03 3:48 ` Namjae Jeon
0 siblings, 1 reply; 3+ messages in thread
From: Sungjong Seo @ 2020-07-02 12:06 UTC (permalink / raw)
To: 'Tetsuhiro Kohada'
Cc: kohada.tetsuhiro, mori.takahiro, motai.hirotaka,
'Namjae Jeon',
linux-fsdevel, linux-kernel
> Replace part of exfat_zeroed_cluster() with exfat_update_bhs().
> And remove exfat_sync_bhs().
>
> Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Looks good. Thanks.
> ---
> Changes in v2
> - Rebase to latest exfat-dev
>
> fs/exfat/fatent.c | 53 +++++++++--------------------------------------
> 1 file changed, 10 insertions(+), 43 deletions(-)
>
> diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index
> 82ee8246c080..c3c9afee7418 100644
> --- a/fs/exfat/fatent.c
> +++ b/fs/exfat/fatent.c
> @@ -229,21 +229,6 @@ int exfat_find_last_cluster(struct super_block *sb,
> struct exfat_chain *p_chain,
> return 0;
> }
>
> -static inline int exfat_sync_bhs(struct buffer_head **bhs, int nr_bhs) -{
> - int i, err = 0;
> -
> - for (i = 0; i < nr_bhs; i++)
> - write_dirty_buffer(bhs[i], 0);
> -
> - for (i = 0; i < nr_bhs; i++) {
> - wait_on_buffer(bhs[i]);
> - if (!err && !buffer_uptodate(bhs[i]))
> - err = -EIO;
> - }
> - return err;
> -}
> -
> int exfat_zeroed_cluster(struct inode *dir, unsigned int clu) {
> struct super_block *sb = dir->i_sb;
> @@ -265,41 +250,23 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned
> int clu)
> }
>
> /* Zeroing the unused blocks on this cluster */
> - n = 0;
> while (blknr < last_blknr) {
> - bhs[n] = sb_getblk(sb, blknr);
> - if (!bhs[n]) {
> - err = -ENOMEM;
> - goto release_bhs;
> - }
> - memset(bhs[n]->b_data, 0, sb->s_blocksize);
> - exfat_update_bh(bhs[n], 0);
> -
> - n++;
> - blknr++;
> -
> - if (n == nr_bhs) {
> - if (IS_DIRSYNC(dir)) {
> - err = exfat_sync_bhs(bhs, n);
> - if (err)
> - goto release_bhs;
> + for (n = 0; n < nr_bhs && blknr < last_blknr; n++, blknr++)
> {
> + bhs[n] = sb_getblk(sb, blknr);
> + if (!bhs[n]) {
> + err = -ENOMEM;
> + goto release_bhs;
> }
> -
> - for (i = 0; i < n; i++)
> - brelse(bhs[i]);
> - n = 0;
> + memset(bhs[n]->b_data, 0, sb->s_blocksize);
> }
> - }
>
> - if (IS_DIRSYNC(dir)) {
> - err = exfat_sync_bhs(bhs, n);
> + err = exfat_update_bhs(bhs, n, IS_DIRSYNC(dir));
> if (err)
> goto release_bhs;
> - }
> -
> - for (i = 0; i < n; i++)
> - brelse(bhs[i]);
>
> + for (i = 0; i < n; i++)
> + brelse(bhs[i]);
> + }
> return 0;
>
> release_bhs:
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v2] exfat: optimize exfat_zeroed_cluster()
2020-07-02 12:06 ` Sungjong Seo
@ 2020-07-03 3:48 ` Namjae Jeon
0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2020-07-03 3:48 UTC (permalink / raw)
To: 'Sungjong Seo', 'Tetsuhiro Kohada'
Cc: kohada.tetsuhiro, mori.takahiro, motai.hirotaka, linux-fsdevel,
linux-kernel
> > Replace part of exfat_zeroed_cluster() with exfat_update_bhs().
> > And remove exfat_sync_bhs().
> >
> > Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
>
> Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
>
> Looks good. Thanks.
Pushed it into exfat #dev.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-03 3:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20200624023050epcas1p1f794fee8957367322d27f828aead2ebc@epcas1p1.samsung.com>
2020-06-24 2:30 ` [PATCH v2] exfat: optimize exfat_zeroed_cluster() Tetsuhiro Kohada
2020-07-02 12:06 ` Sungjong Seo
2020-07-03 3:48 ` Namjae Jeon
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).