Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fe370af authored by Mark Fasheh's avatar Mark Fasheh Committed by Joel Becker
Browse files

ocfs2: use allocation reservations during file write



Add a per-inode reservations structure and pass it through to the
reservations code.

Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent d02f00cc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7211,6 +7211,8 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
			goto out_commit;
		did_quota = 1;

		data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;

		ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off,
					   &num);
		if (ret) {
+3 −0
Original line number Diff line number Diff line
@@ -1735,6 +1735,9 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
			goto out;
		}

		if (data_ac)
			data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;

		credits = ocfs2_calc_extend_credits(inode->i_sb,
						    &di->id2.i_list,
						    clusters_to_alloc);
+3 −0
Original line number Diff line number Diff line
@@ -483,6 +483,9 @@ static int ocfs2_truncate_file(struct inode *inode,

	down_write(&OCFS2_I(inode)->ip_alloc_sem);

	ocfs2_resv_discard(&osb->osb_la_resmap,
			   &OCFS2_I(inode)->ip_la_data_resv);

	/*
	 * The inode lock forced other nodes to sync and drop their
	 * pages, which (correctly) happens even if we have a truncate
+4 −0
Original line number Diff line number Diff line
@@ -1096,6 +1096,10 @@ void ocfs2_clear_inode(struct inode *inode)
	ocfs2_mark_lockres_freeing(&oi->ip_inode_lockres);
	ocfs2_mark_lockres_freeing(&oi->ip_open_lockres);

	ocfs2_resv_discard(&OCFS2_SB(inode->i_sb)->osb_la_resmap,
			   &oi->ip_la_data_resv);
	ocfs2_resv_init_once(&oi->ip_la_data_resv);

	/* We very well may get a clear_inode before all an inodes
	 * metadata has hit disk. Of course, we can't drop any cluster
	 * locks until the journal has finished with it. The only
+2 −0
Original line number Diff line number Diff line
@@ -70,6 +70,8 @@ struct ocfs2_inode_info
	/* Only valid if the inode is the dir. */
	u32				ip_last_used_slot;
	u64				ip_last_used_group;

	struct ocfs2_alloc_reservation	ip_la_data_resv;
};

/*
Loading