Unverified Commit 63544672 authored by Konstantin Komarov's avatar Konstantin Komarov
Browse files

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: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 56eaeb10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,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) {
+3 −3
Original line number Diff line number Diff line
@@ -333,7 +333,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;
@@ -420,7 +420,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;
@@ -442,7 +442,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;

+1 −1
Original line number Diff line number Diff line
@@ -3208,7 +3208,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;
		}
+4 −4
Original line number Diff line number Diff line
@@ -2215,7 +2215,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;
@@ -3706,7 +3706,7 @@ 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;
	}
@@ -5148,10 +5148,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)
+4 −4
Original line number Diff line number Diff line
@@ -1077,7 +1077,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;
@@ -1097,7 +1097,7 @@ int ntfs_sb_write_run(struct ntfs_sb_info *sbi, const struct runs_tree *run,

	for (;;) {
		u32 op = min_t(u64, 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;
@@ -2172,7 +2172,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;
@@ -2190,7 +2190,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;

Loading