fs/ntfs3: Add sync flag to ntfs_sb_write_run and al_update
Subsystems (2)
Konstantin Komarov
maintainerPATCH 3/3 fs/ntfs3: Add sync flag to ntfs_sb_write_run and al_update
This allows to wait only when it's requested.
It speeds up creation of hardlinks.
Signed-off-by Konstantin Komarov <[email protected]>
--- fs/ntfs3/attrib.c | 2 +- fs/ntfs3/attrlist.c | 6 +++--- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fslog.c | 9 +++++---- fs/ntfs3/fsntfs.c | 8 ++++---- fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs_fs.h | 4 ++-- fs/ntfs3/xattr.c | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-)
fs/ntfs3/attrib.c +1 -1
@@ -291,7 +291,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,if (!rsize) {/* Empty resident -> Non empty nonresident. */ }else if (!is_data) { - err =ntfs_sb_write_run (sbi, run,0 , data, rsize); + err =ntfs_sb_write_run (sbi, run,0 , data, rsize,0 );if (err) goto out2; }else if (!page) {
fs/ntfs3/attrlist.c +3 -3
@@ -336,7 +336,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name,if (attr && attr->non_res) { err =ntfs_sb_write_run (ni->mi.sbi, &al->run,0 , al->le, - al->size); + al->size,0 );if (err)return err; al->dirty = false;
@@ -423,7 +423,7 @@ bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST vcn,return true; } -int al_update (struct ntfs_inode *ni) +int al_update (struct ntfs_inode *ni,int sync) {int err;struct ATTRIB *attr;
@@ -445,7 +445,7 @@ int al_update(struct ntfs_inode *ni)memcpy (resident_data (attr), al->le, al->size); }else { err =ntfs_sb_write_run (ni->mi.sbi, &al->run,0 , al->le, - al->size); + al->size, sync);if (err) goto out;
fs/ntfs3/frecord.c +1 -1
@@ -3209,7 +3209,7 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint) goto out; } - err =al_update (ni); + err =al_update (ni, sync);if (err) goto out; }
fs/ntfs3/fslog.c +5 -4
@@ -2219,7 +2219,7 @@ static int last_log_lsn(struct ntfs_log *log) err =ntfs_sb_write_run (log->ni->mi.sbi, &log->ni->file.run, off, page, - log->page_size); + log->page_size,0 );if (err) goto out;
@@ -3710,7 +3710,8 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,if (a_dirty) { attr = oa->attr; - err =ntfs_sb_write_run (sbi, oa->run1, vbo, buffer_le, bytes); + err =ntfs_sb_write_run (sbi, oa->run1, vbo, buffer_le, bytes, +0 );if (err) goto out; }
@@ -5152,10 +5153,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)ntfs_fix_pre_write (&rh->rhdr, log->page_size); - err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rh, log->page_size); + err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rh, log->page_size,0 );if (!err) err =ntfs_sb_write_run (sbi, &log->ni->file.run, log->page_size, - rh, log->page_size); + rh, log->page_size,0 );kfree (rh);if (err)
fs/ntfs3/fsntfs.c +4 -4
@@ -1080,7 +1080,7 @@ int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes, }int ntfs_sb_write_run (struct ntfs_sb_info *sbi,const struct runs_tree *run, -u64 vbo,const void *buf,size_t bytes) +u64 vbo,const void *buf,size_t bytes,int sync) {struct super_block *sb = sbi->sb;u8 cluster_bits = sbi->cluster_bits;
@@ -1100,7 +1100,7 @@ int ntfs_sb_write_run(struct ntfs_sb_info *sbi, const struct runs_tree *run,for (;;) {u32 op = len < bytes ? len : bytes; -int err =ntfs_sb_write (sb, lbo, op, buf,0 ); +int err =ntfs_sb_write (sb, lbo, op, buf, sync);if (err)return err;
@@ -2175,7 +2175,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,/* Write main SDS bucket. */ err =ntfs_sb_write_run (sbi, &ni->file.run, sbi->security.next_off, - d_security, aligned_sec_size); + d_security, aligned_sec_size,0 );if (err) goto out;
@@ -2193,7 +2193,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,/* Write copy SDS bucket. */ err =ntfs_sb_write_run (sbi, &ni->file.run, mirr_off, d_security, - aligned_sec_size); + aligned_sec_size,0 );if (err) goto out;
fs/ntfs3/inode.c +1 -1
@@ -1593,7 +1593,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,/* Write non resident data. */ if (nsize) { - err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rp, nsize); + err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rp, nsize,0 );if (err) goto out7; }
fs/ntfs3/ntfs_fs.h +2 -2
@@ -436,7 +436,7 @@ bool al_remove_le(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le);bool al_delete_le (struct ntfs_inode *ni,enum ATTR_TYPE type,CLST vcn,const __le16 *name,size_t name_len,const struct MFT_REF *ref); -int al_update (struct ntfs_inode *ni); +int al_update (struct ntfs_inode *ni,int sync);static inline size_t al_aligned (size_t size) {return (size +1023 ) & ~(size_t )1023 ;
@@ -577,7 +577,7 @@ int ntfs_sb_read(struct super_block *sb, u64 lbo, size_t bytes, void *buffer);int ntfs_sb_write (struct super_block *sb,u64 lbo,size_t bytes,const void *buffer,int wait);int ntfs_sb_write_run (struct ntfs_sb_info *sbi,const struct runs_tree *run, -u64 vbo,const void *buf,size_t bytes); +u64 vbo,const void *buf,size_t bytes,int sync);struct buffer_head *ntfs_bread_run (struct ntfs_sb_info *sbi,const struct runs_tree *run,u64 vbo); int ntfs_read_run_nb(struct ntfs_sb_info *sbi, const struct runs_tree *run,
fs/ntfs3/xattr.c +1 -1
@@ -444,7 +444,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,/* Delete xattr, ATTR_EA */ ni_remove_attr_le (ni, attr, mi, le); }else if (attr->non_res) { - err =ntfs_sb_write_run (sbi, &ea_run,0 , ea_all, size); + err =ntfs_sb_write_run (sbi, &ea_run,0 , ea_all, size,0 );if (err) goto out; }else {
Signature · 1 line
2.28.0
Quoted 86 lines · Konstantin Komarov
This allows to wait only when it's requested.
It speeds up creation of hardlinks.Signed-off-by Konstantin Komarov <[email protected]>--- fs/ntfs3/attrib.c | 2 +- fs/ntfs3/attrlist.c | 6 +++--- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fslog.c | 9 +++++---- fs/ntfs3/fsntfs.c | 8 ++++---- fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs_fs.h | 4 ++-- fs/ntfs3/xattr.c | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-)fs/ntfs3/attrib.c +1
-1@@ -291,7 +291,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,if (!rsize) {/* Empty resident -> Non empty nonresident. */ }else if (!is_data) { - err =ntfs_sb_write_run (sbi, run,0 , data, rsize); + err =ntfs_sb_write_run (sbi, run,0 , data, rsize,0 );if (err) goto out2; }else if (!page) {fs/ntfs3/attrlist.c +3
-3@@ -336,7 +336,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name,if (attr && attr->non_res) { err =ntfs_sb_write_run (ni->mi.sbi, &al->run,0 , al->le, - al->size); + al->size,0 );if (err)return err; al->dirty = false;@@ -423,7 +423,7 @@ bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST vcn,return true; } -int al_update (struct ntfs_inode *ni) +int al_update (struct ntfs_inode *ni,int sync) {int err;struct ATTRIB *attr;@@ -445,7 +445,7 @@ int al_update(struct ntfs_inode *ni)memcpy (resident_data (attr), al->le, al->size); }else { err =ntfs_sb_write_run (ni->mi.sbi, &al->run,0 , al->le, - al->size); + al->size, sync);if (err) goto out;fs/ntfs3/frecord.c +1
-1@@ -3209,7 +3209,7 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint) goto out; } - err =al_update (ni); + err =al_update (ni, sync);if (err) goto out; }fs/ntfs3/fslog.c +1
-1@@ -2219,7 +2219,7 @@ static int last_log_lsn(struct ntfs_log *log) err =ntfs_sb_write_run (log->ni->mi.sbi, &log->ni->file.run, off, page, - log->page_size); + log->page_size,0 );if (err) goto out;
fs/ntfs3/fslog.c static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe, · line 3714
Quoted 6 lines
fs/ntfs3/fslog.c +2
-1@@ -3710,7 +3710,8 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,if (a_dirty) { attr = oa->attr; - err =ntfs_sb_write_run (sbi, oa->run1, vbo, buffer_le, bytes); + err =ntfs_sb_write_run (sbi, oa->run1, vbo, buffer_le, bytes, +0 );
If you don't mind that this is oneline I won't mind. 80 is limit, but case like this imo checkpatch limit was raised to 100. So vote for this becoming oneliner.
Quoted 106 lines
fs/ntfs3/fslog.c +2
-2if (err) goto out; }@@ -5152,10 +5153,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)ntfs_fix_pre_write (&rh->rhdr, log->page_size); - err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rh, log->page_size); + err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rh, log->page_size,0 );if (!err) err =ntfs_sb_write_run (sbi, &log->ni->file.run, log->page_size, - rh, log->page_size); + rh, log->page_size,0 );kfree (rh);if (err)fs/ntfs3/fsntfs.c +4
-4@@ -1080,7 +1080,7 @@ int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes, }int ntfs_sb_write_run (struct ntfs_sb_info *sbi,const struct runs_tree *run, -u64 vbo,const void *buf,size_t bytes) +u64 vbo,const void *buf,size_t bytes,int sync) {struct super_block *sb = sbi->sb;u8 cluster_bits = sbi->cluster_bits;@@ -1100,7 +1100,7 @@ int ntfs_sb_write_run(struct ntfs_sb_info *sbi, const struct runs_tree *run,for (;;) {u32 op = len < bytes ? len : bytes; -int err =ntfs_sb_write (sb, lbo, op, buf,0 ); +int err =ntfs_sb_write (sb, lbo, op, buf, sync);if (err)return err;@@ -2175,7 +2175,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,/* Write main SDS bucket. */ err =ntfs_sb_write_run (sbi, &ni->file.run, sbi->security.next_off, - d_security, aligned_sec_size); + d_security, aligned_sec_size,0 );if (err) goto out;@@ -2193,7 +2193,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,/* Write copy SDS bucket. */ err =ntfs_sb_write_run (sbi, &ni->file.run, mirr_off, d_security, - aligned_sec_size); + aligned_sec_size,0 );if (err) goto out;fs/ntfs3/inode.c +1
-1@@ -1593,7 +1593,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,/* Write non resident data. */ if (nsize) { - err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rp, nsize); + err =ntfs_sb_write_run (sbi, &ni->file.run,0 , rp, nsize,0 );if (err) goto out7; }fs/ntfs3/ntfs_fs.h +2
-2@@ -436,7 +436,7 @@ bool al_remove_le(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le);bool al_delete_le (struct ntfs_inode *ni,enum ATTR_TYPE type,CLST vcn,const __le16 *name,size_t name_len,const struct MFT_REF *ref); -int al_update (struct ntfs_inode *ni); +int al_update (struct ntfs_inode *ni,int sync);static inline size_t al_aligned (size_t size) {return (size +1023 ) & ~(size_t )1023 ;@@ -577,7 +577,7 @@ int ntfs_sb_read(struct super_block *sb, u64 lbo, size_t bytes, void *buffer);int ntfs_sb_write (struct super_block *sb,u64 lbo,size_t bytes,const void *buffer,int wait);int ntfs_sb_write_run (struct ntfs_sb_info *sbi,const struct runs_tree *run, -u64 vbo,const void *buf,size_t bytes); +u64 vbo,const void *buf,size_t bytes,int sync);struct buffer_head *ntfs_bread_run (struct ntfs_sb_info *sbi,const struct runs_tree *run,u64 vbo); int ntfs_read_run_nb(struct ntfs_sb_info *sbi, const struct runs_tree *run,fs/ntfs3/xattr.c +1
-1@@ -444,7 +444,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,/* Delete xattr, ATTR_EA */ ni_remove_attr_le (ni, attr, mi, le); }else if (attr->non_res) { - err =ntfs_sb_write_run (sbi, &ea_run,0 , ea_all, size); + err =ntfs_sb_write_run (sbi, &ea_run,0 , ea_all, size,0 );if (err) goto out; }else {Signature · 1 line
2.28.0