Skip to content

xfsprogs: libxfs sync v6.17

Andrey Albershteyn linux-xfs 1 version In review

Get series with b4
b4 am cover.1759941416.patch-series@thinky

Versions newest first

  1. v1 Latest0 of 12 patches 1 replyIn review

Patches in v1 No applies recorded yet

None of the 12 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchDarrick J. WongCarlos Maiolino
SeriesR-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/12] xfsprogs: libxfs sync v6.17

Hey all,

This is libxfs sync with v6.17.

Manual modifications diff in attachment.

Signature · 1 line
- Andrey
db/attrset.c +1 -5
index e3ffb75aa4..273c202956 100644
@@ -823,11 +823,7 @@
 		return 0;
 	}
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error) {
-		dbprintf(_("failed to allocate empty transaction\n"));
-		return 0;
-	}
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip);
 	if (error) {
db/dquot.c +1 -3
index d2c76fd70b..c028d50e4c 100644
@@ -92,9 +92,7 @@
 	xfs_ino_t		ret = NULLFSINO;
 	int			error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		return NULLFSINO;
+	tp = libxfs_trans_alloc_empty(mp);
 
 	if (xfs_has_metadir(mp)) {
 		error = -libxfs_dqinode_load_parent(tp, &dp);
db/fsmap.c +1 -7
index ddbe4e6a3d..a59a4d1230 100644
@@ -133,13 +133,7 @@
 	struct xfs_btree_cur	*bt_cur;
 	int			error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error) {
-		dbprintf(
- _("Cannot alloc transaction to look up rtgroup %u rmap inode\n"),
-				rtg_rgno(rtg));
-		return error;
-	}
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_rtginode_load_parent(tp);
 	if (error) {
db/info.c +1 -7
index 6ad3e23832..9c233c9c0e 100644
@@ -174,13 +174,7 @@
 	xfs_filblks_t		used = 0;
 	int			error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error) {
-		dbprintf(
- _("Cannot alloc transaction to look up rtgroup %u rmap inode\n"),
-				rtg_rgno(rtg));
-		return;
-	}
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_rtginode_load_parent(tp);
 	if (error) {
db/metadump.c +1 -1
index 34f2d61700..24eb99da17 100644
@@ -2989,7 +2989,7 @@
 		if (metadump.obfuscate) {
 			struct xfs_sb *sb = iocur_top->data;
 			memset(sb->sb_fname, 'L',
-			       min(strlen(sb->sb_fname), sizeof(sb->sb_fname)));
+			       strnlen(sb->sb_fname, sizeof(sb->sb_fname)));
 			iocur_top->need_crc = 1;
 		}
 		if (write_buf(iocur_top))
db/namei.c +1 -3
index 1d9581c323..0a50ec87df 100644
@@ -94,9 +94,7 @@
 	unsigned int		i;
 	int			error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		return error;
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_iget(mp, tp, ino, 0, &dp);
 	if (error)
db/rdump.c +1 -6
index a50df4b8c7..599d0727e7 100644
@@ -926,15 +926,10 @@
 		set_cur_inode(mp->m_sb.sb_rootino);
 	}
 
-	ret = -libxfs_trans_alloc_empty(mp, &tp);
-	if (ret) {
-		dbprintf(_("allocating state: %s\n"), strerror(ret));
-		goto out_pbuf;
-	}
+	tp = libxfs_trans_alloc_empty(mp);
 
 	ret = rdump_file(tp, iocur_top->ino, destdir, pbuf);
 	libxfs_trans_cancel(tp);
-out_pbuf:
 	free(pbuf);
 	return ret;
 }
include/platform_defs.h +13 -0
index 74a00583eb..da966490b0 100644
@@ -294,4 +294,17 @@
 	__a > __b ? (__a - __b) : (__b - __a);	\
 })
 
+#define cmp_int(l, r)		((l > r) - (l < r))
+
+#if __has_attribute(__nonstring__)
+# define __nonstring                    __attribute__((__nonstring__))
+#else
+# define __nonstring
+#endif
+
+struct kvec {
+	void *iov_base;
+	size_t iov_len;
+};
+
 #endif	/* __XFS_PLATFORM_DEFS_H__ */
include/xfs_trans.h +1 -1
index 248064019a..4f4bfff350 100644
@@ -98,7 +98,7 @@
 			struct xfs_trans **tpp, int *nospace_error);
 int	libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks,
 				    struct xfs_trans **tpp);
-int	libxfs_trans_alloc_empty(struct xfs_mount *mp, struct xfs_trans **tpp);
+struct xfs_trans *libxfs_trans_alloc_empty(struct xfs_mount *mp);
 int	libxfs_trans_commit(struct xfs_trans *);
 void	libxfs_trans_cancel(struct xfs_trans *);
 int	libxfs_trans_reserve_more(struct xfs_trans *tp, uint blocks,
libxfs/inode.c +1 -3
index 0598a70ff5..1ce159fcc9 100644
@@ -258,9 +258,7 @@
 	struct xfs_trans	*tp;
 	int			error;
 
-	error = libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		return error;
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = libxfs_trans_metafile_iget(tp, ino, metafile_type, ipp);
 	libxfs_trans_cancel(tp);
libxfs/trans.c +22 -15
index 5c896ba166..64457d1710 100644
@@ -247,18 +247,12 @@
 	return error;
 }
 
-int
-libxfs_trans_alloc(
+static inline struct xfs_trans *
+__libxfs_trans_alloc(
 	struct xfs_mount	*mp,
-	struct xfs_trans_res	*resp,
-	unsigned int		blocks,
-	unsigned int		rtextents,
-	unsigned int		flags,
-	struct xfs_trans	**tpp)
-
+	uint			flags)
 {
 	struct xfs_trans	*tp;
-	int			error;
 
 	tp = kmem_cache_zalloc(xfs_trans_cache, 0);
 	tp->t_mountp = mp;
@@ -266,6 +260,22 @@
 	INIT_LIST_HEAD(&tp->t_dfops);
 	tp->t_highest_agno = NULLAGNUMBER;
 
+	return tp;
+}
+
+int
+libxfs_trans_alloc(
+	struct xfs_mount	*mp,
+	struct xfs_trans_res	*resp,
+	unsigned int		blocks,
+	unsigned int		rtextents,
+	unsigned int		flags,
+	struct xfs_trans	**tpp)
+
+{
+	struct xfs_trans	*tp = __libxfs_trans_alloc(mp, flags);
+	int			error;
+
 	error = xfs_trans_reserve(tp, resp, blocks, rtextents);
 	if (error) {
 		xfs_trans_cancel(tp);
@@ -290,14 +300,11 @@
  * Note the zero-length reservation; this transaction MUST be cancelled
  * without any dirty data.
  */
-int
+struct xfs_trans *
 libxfs_trans_alloc_empty(
-	struct xfs_mount		*mp,
-	struct xfs_trans		**tpp)
+	struct xfs_mount		*mp)
 {
-	struct xfs_trans_res		resv = {0};
-
-	return xfs_trans_alloc(mp, &resv, 0, 0, XFS_TRANS_NO_WRITECOUNT, tpp);
+	return __libxfs_trans_alloc(mp, XFS_TRANS_NO_WRITECOUNT);
 }
 
 /*
libxlog/xfs_log_recover.c +7 -7
index 275593a3ac..7ef43956e9 100644
@@ -1034,13 +1034,13 @@
 	item = list_entry(trans->r_itemq.prev, struct xlog_recover_item,
 			  ri_list);
 
-	old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
-	old_len = item->ri_buf[item->ri_cnt-1].i_len;
+	old_ptr = item->ri_buf[item->ri_cnt-1].iov_base;
+	old_len = item->ri_buf[item->ri_cnt-1].iov_len;
 
 	ptr = krealloc(old_ptr, len+old_len, 0);
 	memcpy(&ptr[old_len], dp, len); /* d, s, l */
-	item->ri_buf[item->ri_cnt-1].i_len += len;
-	item->ri_buf[item->ri_cnt-1].i_addr = ptr;
+	item->ri_buf[item->ri_cnt-1].iov_len += len;
+	item->ri_buf[item->ri_cnt-1].iov_base = ptr;
 	trace_xfs_log_recover_item_add_cont(log, trans, item, 0);
 	return 0;
 }
@@ -1117,8 +1117,8 @@
 	}
 	ASSERT(item->ri_total > item->ri_cnt);
 	/* Description region is ri_buf[0] */
-	item->ri_buf[item->ri_cnt].i_addr = ptr;
-	item->ri_buf[item->ri_cnt].i_len  = len;
+	item->ri_buf[item->ri_cnt].iov_base = ptr;
+	item->ri_buf[item->ri_cnt].iov_len  = len;
 	item->ri_cnt++;
 	trace_xfs_log_recover_item_add(log, trans, item, 0);
 	return 0;
@@ -1140,7 +1140,7 @@
 		/* Free the regions in the item. */
 		list_del(&item->ri_list);
 		for (i = 0; i < item->ri_cnt; i++)
-			kfree(item->ri_buf[i].i_addr);
+			kfree(item->ri_buf[i].iov_base);
 		/* Free the item itself */
 		kfree(item->ri_buf);
 		kfree(item);
logprint/log_print_all.c +30 -29

144 lines not on this page · raw message

logprint/log_redo.c +26 -26

148 lines not on this page · raw message

repair/phase2.c +1 -5
index e249980527..fc96f9c422 100644
@@ -296,11 +296,7 @@
 		 * there while we try to make a per-AG reservation with the new
 		 * geometry.
 		 */
-		error = -libxfs_trans_alloc_empty(mp, &tp);
-		if (error)
-			do_error(
-	_("Cannot reserve resources for upgrade check, err=%d.\n"),
-					error);
+		tp = libxfs_trans_alloc_empty(mp);
 
 		error = -libxfs_ialloc_read_agi(pag, tp, 0, &agi_bp);
 		if (error)
repair/pptr.c +2 -2
index ac0a9c618b..6a9e072b36 100644
@@ -1217,7 +1217,7 @@
 	fscan->have_garbage = false;
 	fscan->nr_file_pptrs = 0;
 
-	libxfs_trans_alloc_empty(ip->i_mount, &tp);
+	tp = libxfs_trans_alloc_empty(ip->i_mount);
 	error = xattr_walk(tp, ip, examine_xattr, fscan);
 	if (tp)
 		libxfs_trans_cancel(tp);
@@ -1417,7 +1417,7 @@
 		do_error("init garbage pptr names failed: %s\n",
 				strerror(error));
 
-	libxfs_trans_alloc_empty(ip->i_mount, &tp);
+	tp = libxfs_trans_alloc_empty(ip->i_mount);
 	error = xattr_walk(tp, ip, erase_pptrs, &fscan);
 	if (tp)
 		libxfs_trans_cancel(tp);
repair/quotacheck.c +2 -7
index df6cde2d58..f4c0314177 100644
@@ -437,9 +437,7 @@
 	if (!dquots || !chkd_flags)
 		return;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		do_error(_("could not alloc transaction to open quota file\n"));
+	tp = libxfs_trans_alloc_empty(mp);
 
 	ino = get_quota_inode(type);
 	error = -libxfs_trans_metafile_iget(tp, ino, metafile_type, &ip);
@@ -679,9 +677,7 @@
 	struct xfs_inode	*dp = NULL;
 	int			error, err2;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		goto out;
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_dqinode_load_parent(tp, &dp);
 	if (error)
@@ -698,7 +694,6 @@
 	libxfs_irele(dp);
 out_cancel:
 	libxfs_trans_cancel(tp);
-out:
 	if (error) {
 		switch (error) {
 		case EFSCORRUPTED:
repair/rcbag.c +2 -6
index 21732b65c6..d7addbf58e 100644
@@ -95,9 +95,7 @@
 	int				has;
 	int				error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		do_error(_("allocating tx for refcount bag update\n"));
+	tp = libxfs_trans_alloc_empty(mp);
 
 	cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
 	error = rcbagbt_lookup_eq(cur, rmap, &has);
@@ -217,9 +215,7 @@
 	int			has;
 	int			error;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		do_error(_("allocating tx for refcount bag update\n"));
+	tp = libxfs_trans_alloc_empty(mp);
 
 	/* go to the right edge of the tree */
 	cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
repair/rcbag_btree.c +6 -6
index bed7c7a8f6..fc5f69c4d2 100644
@@ -46,8 +46,8 @@
 	bag_rec->rbg_refcount = bag_irec->rbg_refcount;
 }
 
-STATIC int64_t
-rcbagbt_key_diff(
+STATIC int
+rcbagbt_cmp_key_with_cur(
 	struct xfs_btree_cur		*cur,
 	const union xfs_btree_key	*key)
 {
@@ -72,8 +72,8 @@
 	return 0;
 }
 
-STATIC int64_t
-rcbagbt_diff_two_keys(
+STATIC int
+rcbagbt_cmp_two_keys(
 	struct xfs_btree_cur		*cur,
 	const union xfs_btree_key	*k1,
 	const union xfs_btree_key	*k2,
@@ -220,9 +220,9 @@
 	.init_key_from_rec	= rcbagbt_init_key_from_rec,
 	.init_rec_from_cur	= rcbagbt_init_rec_from_cur,
 	.init_ptr_from_cur	= xfbtree_init_ptr_from_cur,
-	.key_diff		= rcbagbt_key_diff,
+	.cmp_key_with_cur	= rcbagbt_cmp_key_with_cur,
 	.buf_ops		= &rcbagbt_mem_buf_ops,
-	.diff_two_keys		= rcbagbt_diff_two_keys,
+	.cmp_two_keys		= rcbagbt_cmp_two_keys,
 	.keys_inorder		= rcbagbt_keys_inorder,
 	.recs_inorder		= rcbagbt_recs_inorder,
 };
repair/rmap.c +1 -3
index 97510dd875..e89bd32d63 100644
@@ -323,9 +323,7 @@
 	int			error;
 
 	xfbt = &rmaps_for_group(isrt, agno)->ar_xfbtree;
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		do_error(_("allocating tx for in-memory rmap update\n"));
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = rmap_init_mem_cursor(mp, tp, isrt, agno, &rmcur);
 	if (error)
repair/rt.c +2 -8
index 1ac2bf6fc4..781d896844 100644
@@ -301,10 +301,7 @@
 	if (rtg->rtg_inodes[type])
 		goto out_rtg;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		goto out_rtg;
-
+	tp = libxfs_trans_alloc_empty(mp);
 
 	error = -libxfs_rtginode_load(rtg, type, tp);
 	if (error)
@@ -497,9 +494,7 @@
 	int			error, err2;
 	int			i;
 
-	error = -libxfs_trans_alloc_empty(mp, &tp);
-	if (error)
-		goto out;
+	tp = libxfs_trans_alloc_empty(mp);
 	if (xfs_has_rtgroups(mp) && mp->m_sb.sb_rgcount > 0) {
 		error = -libxfs_rtginode_load_parent(tp);
 		if (error)
@@ -516,7 +511,6 @@
 
 out_cancel:
 	libxfs_trans_cancel(tp);
-out:
 	if (xfs_has_rtgroups(mp) && error) {
 		/*
 		 * Old xfs_repair didn't complain if rtbitmaps didn't load
scrub/inodes.c +0 -2
index 2f3c87be79..4ed7cd9963 100644
@@ -197,8 +197,6 @@
 	return seen_mask;
 }
 
-#define cmp_int(l, r)		((l > r) - (l < r))
-
 /* Compare two bulkstat records by inumber. */
 static int
 compare_bstat(