您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xfs_warn函数代码示例

51自学网 2021-06-03 10:20:59
  C++
这篇教程C++ xfs_warn函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xfs_warn函数的典型用法代码示例。如果您正苦于以下问题:C++ xfs_warn函数的具体用法?C++ xfs_warn怎么用?C++ xfs_warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xfs_warn函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: xfs_iget_check_free_state

/* * If we are allocating a new inode, then check what was returned is * actually a free, empty inode. If we are not allocating an inode, * then check we didn't find a free inode. * * Returns: *	0		if the inode free state matches the lookup context *	-ENOENT		if the inode is free and we are not allocating *	-EFSCORRUPTED	if there is any state mismatch at all */static intxfs_iget_check_free_state(	struct xfs_inode	*ip,	int			flags){	if (flags & XFS_IGET_CREATE) {		/* should be a free inode */		if (VFS_I(ip)->i_mode != 0) {			xfs_warn(ip->i_mount,"Corruption detected! Free inode 0x%llx not marked free! (mode 0x%x)",				ip->i_ino, VFS_I(ip)->i_mode);			return -EFSCORRUPTED;		}		if (ip->i_d.di_nblocks != 0) {			xfs_warn(ip->i_mount,"Corruption detected! Free inode 0x%llx has blocks allocated!",				ip->i_ino);			return -EFSCORRUPTED;		}		return 0;	}	/* should be an allocated inode */	if (VFS_I(ip)->i_mode == 0)		return -ENOENT;	return 0;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:39,


示例2: xfs_errortag_add

intxfs_errortag_add(int error_tag, xfs_mount_t *mp){	int i;	int len;	int64_t fsid;	memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));	for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {		if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {			xfs_warn(mp, "error tag #%d on", error_tag);			return 0;		}	}	for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {		if (xfs_etest[i] == 0) {			xfs_warn(mp, "Turned on XFS error tag #%d",				error_tag);			xfs_etest[i] = error_tag;			xfs_etest_fsid[i] = fsid;			len = strlen(mp->m_fsname);			xfs_etest_fsname[i] = kmem_alloc(len + 1, KM_SLEEP);			strcpy(xfs_etest_fsname[i], mp->m_fsname);			xfs_error_test_active++;			return 0;		}	}	xfs_warn(mp, "error tag overflow, too many turned on");	return 1;}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:34,


示例3: xfs_errortag_clearall

intxfs_errortag_clearall(xfs_mount_t *mp, int loud){	int64_t fsid;	int cleared = 0;	int i;	memcpy(&fsid, mp->m_fixedfsid, sizeof(xfs_fsid_t));	for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {		if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) &&		     xfs_etest[i] != 0) {			cleared = 1;			xfs_warn(mp, "Clearing XFS error tag #%d",				xfs_etest[i]);			xfs_etest[i] = 0;			xfs_etest_fsid[i] = 0LL;			kmem_free(xfs_etest_fsname[i]);			xfs_etest_fsname[i] = NULL;			xfs_error_test_active--;		}	}	if (loud || cleared)		xfs_warn(mp, "Cleared all XFS error tags for filesystem");	return 0;}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:29,


示例4: xfs_quiesce_attr

/* * Second stage of a quiesce. The data is already synced, now we have to take * care of the metadata. New transactions are already blocked, so we need to * wait for any remaining transactions to drain out before proceeding. */voidxfs_quiesce_attr(	struct xfs_mount	*mp){	int	error = 0;	/* wait for all modifications to complete */	while (atomic_read(&mp->m_active_trans) > 0)		delay(100);	/* flush inodes and push all remaining buffers out to disk */	xfs_quiesce_fs(mp);	/*	 * Just warn here till VFS can correctly support	 * read-only remount without racing.	 */	WARN_ON(atomic_read(&mp->m_active_trans) != 0);	/* Push the superblock and write an unmount record */	error = xfs_log_sbcount(mp, 1);	if (error)		xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "				"Frozen image may not be consistent.");	xfs_log_unmount_write(mp);	xfs_unmountfs_writesb(mp);}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:32,


示例5: xfs_qm_dquot_logitem_push

/* * Given the logitem, this writes the corresponding dquot entry to disk * asynchronously. This is called with the dquot entry securely locked; * we simply get xfs_qm_dqflush() to do the work, and unlock the dquot * at the end. */STATIC voidxfs_qm_dquot_logitem_push(	struct xfs_log_item	*lip){	struct xfs_dquot	*dqp = DQUOT_ITEM(lip)->qli_dquot;	int			error;	ASSERT(XFS_DQ_IS_LOCKED(dqp));	ASSERT(!completion_done(&dqp->q_flush));	/*	 * Since we were able to lock the dquot's flush lock and	 * we found it on the AIL, the dquot must be dirty.  This	 * is because the dquot is removed from the AIL while still	 * holding the flush lock in xfs_dqflush_done().  Thus, if	 * we found it in the AIL and were able to obtain the flush	 * lock without sleeping, then there must not have been	 * anyone in the process of flushing the dquot.	 */	error = xfs_qm_dqflush(dqp, 0);	if (error)		xfs_warn(dqp->q_mount, "%s: push error %d on dqp %p",			__func__, error, dqp);	xfs_dqunlock(dqp);}
开发者ID:454053205,项目名称:linux,代码行数:31,


示例6: xfs_dir_ino_validate

/* * Validate a given inode number. */intxfs_dir_ino_validate(	xfs_mount_t	*mp,	xfs_ino_t	ino){	xfs_agblock_t	agblkno;	xfs_agino_t	agino;	xfs_agnumber_t	agno;	int		ino_ok;	int		ioff;	agno = XFS_INO_TO_AGNO(mp, ino);	agblkno = XFS_INO_TO_AGBNO(mp, ino);	ioff = XFS_INO_TO_OFFSET(mp, ino);	agino = XFS_OFFBNO_TO_AGINO(mp, agblkno, ioff);	ino_ok =		agno < mp->m_sb.sb_agcount &&		agblkno < mp->m_sb.sb_agblocks &&		agblkno != 0 &&		ioff < (1 << mp->m_sb.sb_inopblog) &&		XFS_AGINO_TO_INO(mp, agno, agino) == ino;	if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,			XFS_RANDOM_DIR_INO_VALIDATE))) {		xfs_warn(mp, "Invalid inode number 0x%Lx",				(unsigned long long) ino);		XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);		return XFS_ERROR(EFSCORRUPTED);	}	return 0;}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:33,


示例7: asswarn

voidasswarn(char *expr, char *file, int line){	xfs_warn(NULL, "Assertion failed: %s, file: %s, line: %d",		expr, file, line);	WARN_ON(1);}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:7,


示例8: xfs_imap_to_bp

/* * This routine is called to map an inode to the buffer containing the on-disk * version of the inode.  It returns a pointer to the buffer containing the * on-disk inode in the bpp parameter, and in the dipp parameter it returns a * pointer to the on-disk inode within that buffer. * * If a non-zero error is returned, then the contents of bpp and dipp are * undefined. */intxfs_imap_to_bp(	struct xfs_mount	*mp,	struct xfs_trans	*tp,	struct xfs_imap		*imap,	struct xfs_dinode       **dipp,	struct xfs_buf		**bpp,	uint			buf_flags,	uint			iget_flags){	struct xfs_buf		*bp;	int			error;	buf_flags |= XBF_UNMAPPED;	error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno,				   (int)imap->im_len, buf_flags, &bp,				   &xfs_inode_buf_ops);	if (error) {		if (error == -EAGAIN) {			ASSERT(buf_flags & XBF_TRYLOCK);			return error;		}		xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.",			__func__, error);		return error;	}	*bpp = bp;	*dipp = xfs_buf_offset(bp, imap->im_boffset);	return 0;}
开发者ID:guribe94,项目名称:linux,代码行数:40,


示例9: xfs_quiesce_attr

/* * Second stage of a quiesce. The data is already synced, now we have to take * care of the metadata. New transactions are already blocked, so we need to * wait for any remaining transactions to drain out before proceeding. */voidxfs_quiesce_attr(	struct xfs_mount	*mp){	int	error = 0;	/* wait for all modifications to complete */	while (atomic_read(&mp->m_active_trans) > 0)		delay(100);	/* reclaim inodes to do any IO before the freeze completes */	xfs_reclaim_inodes(mp, 0);	xfs_reclaim_inodes(mp, SYNC_WAIT);	/* flush all pending changes from the AIL */	xfs_ail_push_all_sync(mp->m_ail);	/*	 * Just warn here till VFS can correctly support	 * read-only remount without racing.	 */	WARN_ON(atomic_read(&mp->m_active_trans) != 0);	/* Push the superblock and write an unmount record */	error = xfs_log_sbcount(mp);	if (error)		xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "				"Frozen image may not be consistent.");	xfs_log_unmount_write(mp);	/*	 * At this point we might have modified the superblock again and thus	 * added an item to the AIL, thus flush it again.	 */	xfs_ail_push_all_sync(mp->m_ail);	/*	 * The superblock buffer is uncached and xfsaild_push() will lock and	 * set the XBF_ASYNC flag on the buffer. We cannot do xfs_buf_iowait()	 * here but a lock on the superblock buffer will block until iodone()	 * has completed.	 */	xfs_buf_lock(mp->m_sb_bp);	xfs_buf_unlock(mp->m_sb_bp);}
开发者ID:AllenDou,项目名称:linux,代码行数:50,


示例10: __xfs_ag_resv_init

static int__xfs_ag_resv_init(	struct xfs_perag		*pag,	enum xfs_ag_resv_type		type,	xfs_extlen_t			ask,	xfs_extlen_t			used){	struct xfs_mount		*mp = pag->pag_mount;	struct xfs_ag_resv		*resv;	int				error;	xfs_extlen_t			reserved;	if (used > ask)		ask = used;	reserved = ask - used;	error = xfs_mod_fdblocks(mp, -(int64_t)reserved, true);	if (error) {		trace_xfs_ag_resv_init_error(pag->pag_mount, pag->pag_agno,				error, _RET_IP_);		xfs_warn(mp,"Per-AG reservation for AG %u failed.  Filesystem may run out of space.",				pag->pag_agno);		return error;	}	/*	 * Reduce the maximum per-AG allocation length by however much we're	 * trying to reserve for an AG.  Since this is a filesystem-wide	 * counter, we only make the adjustment for AG 0.  This assumes that	 * there aren't any AGs hungrier for per-AG reservation than AG 0.	 */	if (pag->pag_agno == 0)		mp->m_ag_max_usable -= ask;	resv = xfs_perag_resv(pag, type);	resv->ar_asked = ask;	resv->ar_reserved = resv->ar_orig_reserved = reserved;	trace_xfs_ag_resv_init(pag, type, ask);	return 0;}
开发者ID:the-snowwhite,项目名称:linux-socfpga,代码行数:42,


示例11: xfs_qm_shake

STATIC intxfs_qm_shake(	struct shrinker		*shrink,	struct shrink_control	*sc){	struct xfs_quotainfo	*qi =		container_of(shrink, struct xfs_quotainfo, qi_shrinker);	int			nr_to_scan = sc->nr_to_scan;	LIST_HEAD		(buffer_list);	LIST_HEAD		(dispose_list);	struct xfs_dquot	*dqp;	int			error;	if ((sc->gfp_mask & (__GFP_FS|__GFP_WAIT)) != (__GFP_FS|__GFP_WAIT))		return 0;	if (!nr_to_scan)		goto out;	mutex_lock(&qi->qi_lru_lock);	while (!list_empty(&qi->qi_lru_list)) {		if (nr_to_scan-- <= 0)			break;		dqp = list_first_entry(&qi->qi_lru_list, struct xfs_dquot,				       q_lru);		xfs_qm_dqreclaim_one(dqp, &buffer_list, &dispose_list);	}	mutex_unlock(&qi->qi_lru_lock);	error = xfs_buf_delwri_submit(&buffer_list);	if (error)		xfs_warn(NULL, "%s: dquot reclaim failed", __func__);	while (!list_empty(&dispose_list)) {		dqp = list_first_entry(&dispose_list, struct xfs_dquot, q_lru);		list_del_init(&dqp->q_lru);		xfs_qm_dqfree_one(dqp);	}out:	return (qi->qi_lru_count / 100) * sysctl_vfs_cache_pressure;}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:41,


示例12: xfs_buf_item_push

STATIC uintxfs_buf_item_push(	struct xfs_log_item	*lip,	struct list_head	*buffer_list){	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);	struct xfs_buf		*bp = bip->bli_buf;	uint			rval = XFS_ITEM_SUCCESS;	if (xfs_buf_ispinned(bp))		return XFS_ITEM_PINNED;	if (!xfs_buf_trylock(bp)) {		/*		 * If we have just raced with a buffer being pinned and it has		 * been marked stale, we could end up stalling until someone else		 * issues a log force to unpin the stale buffer. Check for the		 * race condition here so xfsaild recognizes the buffer is pinned		 * and queues a log force to move it along.		 */		if (xfs_buf_ispinned(bp))			return XFS_ITEM_PINNED;		return XFS_ITEM_LOCKED;	}	ASSERT(!(bip->bli_flags & XFS_BLI_STALE));	trace_xfs_buf_item_push(bip);	/* has a previous flush failed due to IO errors? */	if ((bp->b_flags & XBF_WRITE_FAIL) &&	    ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS:")) {		xfs_warn(bp->b_target->bt_mount,"Detected failing async write on buffer block 0x%llx. Retrying async write./n",			 (long long)bp->b_bn);	}	if (!xfs_buf_delwri_queue(bp, buffer_list))		rval = XFS_ITEM_FLUSHING;	xfs_buf_unlock(bp);	return rval;}
开发者ID:mobilehunter,项目名称:trafficsqueezer,代码行数:41,


示例13: xfs_error_test

intxfs_error_test(int error_tag, int *fsidp, char *expression,	       int line, char *file, unsigned long randfactor){	int i;	int64_t fsid;	if (prandom_u32() % randfactor)		return 0;	memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));	for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {		if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) {			xfs_warn(NULL,	"Injecting error (%s) at file %s, line %d, on filesystem /"%s/"",				expression, file, line, xfs_etest_fsname[i]);			return 1;		}	}	return 0;}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:23,


示例14: xfs_quiesce_attr

voidxfs_quiesce_attr(	struct xfs_mount	*mp){	int	error = 0;		while (atomic_read(&mp->m_active_trans) > 0)		delay(100);		xfs_quiesce_fs(mp);	WARN_ON(atomic_read(&mp->m_active_trans) != 0);		error = xfs_log_sbcount(mp);	if (error)		xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "				"Frozen image may not be consistent.");	xfs_log_unmount_write(mp);	xfs_unmountfs_writesb(mp);}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:23,


示例15: xfs_reclaim_inode

//.........这里部分代码省略.........		}		xfs_iunpin_wait(ip);	}	if (xfs_iflags_test(ip, XFS_ISTALE))		goto reclaim;	if (xfs_inode_clean(ip))		goto reclaim;	/*	 * Now we have an inode that needs flushing.	 *	 * We do a nonblocking flush here even if we are doing a SYNC_WAIT	 * reclaim as we can deadlock with inode cluster removal.	 * xfs_ifree_cluster() can lock the inode buffer before it locks the	 * ip->i_lock, and we are doing the exact opposite here. As a result,	 * doing a blocking xfs_itobp() to get the cluster buffer will result	 * in an ABBA deadlock with xfs_ifree_cluster().	 *	 * As xfs_ifree_cluser() must gather all inodes that are active in the	 * cache to mark them stale, if we hit this case we don't actually want	 * to do IO here - we want the inode marked stale so we can simply	 * reclaim it. Hence if we get an EAGAIN error on a SYNC_WAIT flush,	 * just unlock the inode, back off and try again. Hopefully the next	 * pass through will see the stale flag set on the inode.	 */	error = xfs_iflush(ip, SYNC_TRYLOCK | sync_mode);	if (sync_mode & SYNC_WAIT) {		if (error == EAGAIN) {			xfs_iunlock(ip, XFS_ILOCK_EXCL);			/* backoff longer than in xfs_ifree_cluster */			delay(2);			goto restart;		}		xfs_iflock(ip);		goto reclaim;	}	/*	 * When we have to flush an inode but don't have SYNC_WAIT set, we	 * flush the inode out using a delwri buffer and wait for the next	 * call into reclaim to find it in a clean state instead of waiting for	 * it now. We also don't return errors here - if the error is transient	 * then the next reclaim pass will flush the inode, and if the error	 * is permanent then the next sync reclaim will reclaim the inode and	 * pass on the error.	 */	if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {		xfs_warn(ip->i_mount,			"inode 0x%llx background reclaim flush failed with %d",			(long long)ip->i_ino, error);	}out:	xfs_iflags_clear(ip, XFS_IRECLAIM);	xfs_iunlock(ip, XFS_ILOCK_EXCL);	/*	 * We could return EAGAIN here to make reclaim rescan the inode tree in	 * a short while. However, this just burns CPU time scanning the tree	 * waiting for IO to complete and xfssyncd never goes back to the idle	 * state. Instead, return 0 to let the next scheduled background reclaim	 * attempt to reclaim the inode again.	 */	return 0;reclaim:	xfs_ifunlock(ip);	xfs_iunlock(ip, XFS_ILOCK_EXCL);	XFS_STATS_INC(xs_ig_reclaims);	/*	 * Remove the inode from the per-AG radix tree.	 *	 * Because radix_tree_delete won't complain even if the item was never	 * added to the tree assert that it's been there before to catch	 * problems with the inode life time early on.	 */	spin_lock(&pag->pag_ici_lock);	if (!radix_tree_delete(&pag->pag_ici_root,				XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino)))		ASSERT(0);	__xfs_inode_clear_reclaim(pag, ip);	spin_unlock(&pag->pag_ici_lock);	/*	 * Here we do an (almost) spurious inode lock in order to coordinate	 * with inode cache radix tree lookups.  This is because the lookup	 * can reference the inodes in the cache without taking references.	 *	 * We make that OK here by ensuring that we wait until the inode is	 * unlocked after the lookup before we go ahead and free it.  We get	 * both the ilock and the iolock because the code may need to drop the	 * ilock one but will still hold the iolock.	 */	xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);	xfs_qm_dqdetach(ip);	xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);	xfs_inode_free(ip);	return error;}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:101,


示例16: xfs_reclaim_inode

STATIC intxfs_reclaim_inode(	struct xfs_inode	*ip,	struct xfs_perag	*pag,	int			sync_mode){	int	error;restart:	error = 0;	xfs_ilock(ip, XFS_ILOCK_EXCL);	if (!xfs_iflock_nowait(ip)) {		if (!(sync_mode & SYNC_WAIT))			goto out;		xfs_promote_inode(ip);		xfs_iflock(ip);	}	if (is_bad_inode(VFS_I(ip)))		goto reclaim;	if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {		xfs_iunpin_wait(ip);		goto reclaim;	}	if (xfs_ipincount(ip)) {		if (!(sync_mode & SYNC_WAIT)) {			xfs_ifunlock(ip);			goto out;		}		xfs_iunpin_wait(ip);	}	if (xfs_iflags_test(ip, XFS_ISTALE))		goto reclaim;	if (xfs_inode_clean(ip))		goto reclaim;	error = xfs_iflush(ip, SYNC_TRYLOCK | sync_mode);	if (sync_mode & SYNC_WAIT) {		if (error == EAGAIN) {			xfs_iunlock(ip, XFS_ILOCK_EXCL);						delay(2);			goto restart;		}		xfs_iflock(ip);		goto reclaim;	}	if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {		xfs_warn(ip->i_mount,			"inode 0x%llx background reclaim flush failed with %d",			(long long)ip->i_ino, error);	}out:	xfs_iflags_clear(ip, XFS_IRECLAIM);	xfs_iunlock(ip, XFS_ILOCK_EXCL);	return 0;reclaim:	xfs_ifunlock(ip);	xfs_iunlock(ip, XFS_ILOCK_EXCL);	XFS_STATS_INC(xs_ig_reclaims);	spin_lock(&pag->pag_ici_lock);	if (!radix_tree_delete(&pag->pag_ici_root,				XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino)))		ASSERT(0);	__xfs_inode_clear_reclaim(pag, ip);	spin_unlock(&pag->pag_ici_lock);	xfs_ilock(ip, XFS_ILOCK_EXCL);	xfs_qm_dqdetach(ip);	xfs_iunlock(ip, XFS_ILOCK_EXCL);	xfs_inode_free(ip);	return error;}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:79,


示例17: xfs_qm_mount_quotas

/* * This is called from xfs_mountfs to start quotas and initialize all * necessary data structures like quotainfo.  This is also responsible for * running a quotacheck as necessary.  We are guaranteed that the superblock * is consistently read in at this point. * * If we fail here, the mount will continue with quota turned off. We don't * need to inidicate success or failure at all. */voidxfs_qm_mount_quotas(	xfs_mount_t	*mp){	int		error = 0;	uint		sbf;	/*	 * If quotas on realtime volumes is not supported, we disable	 * quotas immediately.	 */	if (mp->m_sb.sb_rextents) {		xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");		mp->m_qflags = 0;		goto write_changes;	}	ASSERT(XFS_IS_QUOTA_RUNNING(mp));	/*	 * Allocate the quotainfo structure inside the mount struct, and	 * create quotainode(s), and change/rev superblock if necessary.	 */	error = xfs_qm_init_quotainfo(mp);	if (error) {		/*		 * We must turn off quotas.		 */		ASSERT(mp->m_quotainfo == NULL);		mp->m_qflags = 0;		goto write_changes;	}	/*	 * If any of the quotas are not consistent, do a quotacheck.	 */	if (XFS_QM_NEED_QUOTACHECK(mp)) {		error = xfs_qm_quotacheck(mp);		if (error) {			/* Quotacheck failed and disabled quotas. */			return;		}	}	/* 	 * If one type of quotas is off, then it will lose its	 * quotachecked status, since we won't be doing accounting for	 * that type anymore.	 */	if (!XFS_IS_UQUOTA_ON(mp))		mp->m_qflags &= ~XFS_UQUOTA_CHKD;	if (!(XFS_IS_GQUOTA_ON(mp) || XFS_IS_PQUOTA_ON(mp)))		mp->m_qflags &= ~XFS_OQUOTA_CHKD; write_changes:	/*	 * We actually don't have to acquire the m_sb_lock at all.	 * This can only be called from mount, and that's single threaded. XXX	 */	spin_lock(&mp->m_sb_lock);	sbf = mp->m_sb.sb_qflags;	mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;	spin_unlock(&mp->m_sb_lock);	if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {		if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {			/*			 * We could only have been turning quotas off.			 * We aren't in very good shape actually because			 * the incore structures are convinced that quotas are			 * off, but the on disk superblock doesn't know that !			 */			ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));			xfs_alert(mp, "%s: Superblock update failed!",				__func__);		}	}	if (error) {		xfs_warn(mp, "Failed to initialize disk quotas.");		return;	}}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:90,


示例18: xfs_qm_dqreclaim_one

STATIC voidxfs_qm_dqreclaim_one(	struct xfs_dquot	*dqp,	struct list_head	*buffer_list,	struct list_head	*dispose_list){	struct xfs_mount	*mp = dqp->q_mount;	struct xfs_quotainfo	*qi = mp->m_quotainfo;	int			error;	if (!xfs_dqlock_nowait(dqp))		goto out_move_tail;	/*	 * This dquot has acquired a reference in the meantime remove it from	 * the freelist and try again.	 */	if (dqp->q_nrefs) {		xfs_dqunlock(dqp);		trace_xfs_dqreclaim_want(dqp);		XFS_STATS_INC(xs_qm_dqwants);		list_del_init(&dqp->q_lru);		qi->qi_lru_count--;		XFS_STATS_DEC(xs_qm_dquot_unused);		return;	}	/*	 * Try to grab the flush lock. If this dquot is in the process of	 * getting flushed to disk, we don't want to reclaim it.	 */	if (!xfs_dqflock_nowait(dqp))		goto out_unlock_move_tail;	if (XFS_DQ_IS_DIRTY(dqp)) {		struct xfs_buf	*bp = NULL;		trace_xfs_dqreclaim_dirty(dqp);		error = xfs_qm_dqflush(dqp, &bp);		if (error) {			xfs_warn(mp, "%s: dquot %p flush failed",				 __func__, dqp);			goto out_unlock_move_tail;		}		xfs_buf_delwri_queue(bp, buffer_list);		xfs_buf_relse(bp);		/*		 * Give the dquot another try on the freelist, as the		 * flushing will take some time.		 */		goto out_unlock_move_tail;	}	xfs_dqfunlock(dqp);	/*	 * Prevent lookups now that we are past the point of no return.	 */	dqp->dq_flags |= XFS_DQ_FREEING;	xfs_dqunlock(dqp);	ASSERT(dqp->q_nrefs == 0);	list_move_tail(&dqp->q_lru, dispose_list);	qi->qi_lru_count--;	XFS_STATS_DEC(xs_qm_dquot_unused);	trace_xfs_dqreclaim_done(dqp);	XFS_STATS_INC(xs_qm_dqreclaims);	return;	/*	 * Move the dquot to the tail of the list so that we don't spin on it.	 */out_unlock_move_tail:	xfs_dqunlock(dqp);out_move_tail:	list_move_tail(&dqp->q_lru, &qi->qi_lru_list);	trace_xfs_dqreclaim_busy(dqp);	XFS_STATS_INC(xs_qm_dqreclaim_misses);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:83,


示例19: xfs_qm_dqpurge

/* * Purge a dquot from all tracking data structures and free it. */STATIC intxfs_qm_dqpurge(	struct xfs_dquot	*dqp,	void			*data){	struct xfs_mount	*mp = dqp->q_mount;	struct xfs_quotainfo	*qi = mp->m_quotainfo;	struct xfs_dquot	*gdqp = NULL;	xfs_dqlock(dqp);	if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0) {		xfs_dqunlock(dqp);		return EAGAIN;	}	/*	 * If this quota has a group hint attached, prepare for releasing it	 * now.	 */	gdqp = dqp->q_gdquot;	if (gdqp) {		xfs_dqlock(gdqp);		dqp->q_gdquot = NULL;	}	dqp->dq_flags |= XFS_DQ_FREEING;	xfs_dqflock(dqp);	/*	 * If we are turning this type of quotas off, we don't care	 * about the dirty metadata sitting in this dquot. OTOH, if	 * we're unmounting, we do care, so we flush it and wait.	 */	if (XFS_DQ_IS_DIRTY(dqp)) {		struct xfs_buf	*bp = NULL;		int		error;		/*		 * We don't care about getting disk errors here. We need		 * to purge this dquot anyway, so we go ahead regardless.		 */		error = xfs_qm_dqflush(dqp, &bp);		if (error) {			xfs_warn(mp, "%s: dquot %p flush failed",				__func__, dqp);		} else {			error = xfs_bwrite(bp);			xfs_buf_relse(bp);		}		xfs_dqflock(dqp);	}	ASSERT(atomic_read(&dqp->q_pincount) == 0);	ASSERT(XFS_FORCED_SHUTDOWN(mp) ||	       !(dqp->q_logitem.qli_item.li_flags & XFS_LI_IN_AIL));	xfs_dqfunlock(dqp);	xfs_dqunlock(dqp);	radix_tree_delete(XFS_DQUOT_TREE(qi, dqp->q_core.d_flags),			  be32_to_cpu(dqp->q_core.d_id));	qi->qi_dquots--;	/*	 * We move dquots to the freelist as soon as their reference count	 * hits zero, so it really should be on the freelist here.	 */	mutex_lock(&qi->qi_lru_lock);	ASSERT(!list_empty(&dqp->q_lru));	list_del_init(&dqp->q_lru);	qi->qi_lru_count--;	XFS_STATS_DEC(xs_qm_dquot_unused);	mutex_unlock(&qi->qi_lru_lock);	xfs_qm_dqdestroy(dqp);	if (gdqp)		xfs_qm_dqput(gdqp);	return 0;}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:84,


示例20: xfs_qm_quotacheck

//.........这里部分代码省略.........		error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA,					 &buffer_list);		if (error)			goto error_return;		flags |= XFS_UQUOTA_CHKD;	}	gip = mp->m_quotainfo->qi_gquotaip;	if (gip) {		error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ?					 XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA,					 &buffer_list);		if (error)			goto error_return;		flags |= XFS_OQUOTA_CHKD;	}	do {		/*		 * Iterate thru all the inodes in the file system,		 * adjusting the corresponding dquot counters in core.		 */		error = xfs_bulkstat(mp, &lastino, &count,				     xfs_qm_dqusage_adjust,				     structsz, NULL, &done);		if (error)			break;	} while (!done);	/*	 * We've made all the changes that we need to make incore.  Flush them	 * down to disk buffers if everything was updated successfully.	 */	if (XFS_IS_UQUOTA_ON(mp)) {		error = xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_flush_one,					  &buffer_list);	}	if (XFS_IS_GQUOTA_ON(mp)) {		error2 = xfs_qm_dquot_walk(mp, XFS_DQ_GROUP, xfs_qm_flush_one,					   &buffer_list);		if (!error)			error = error2;	}	if (XFS_IS_PQUOTA_ON(mp)) {		error2 = xfs_qm_dquot_walk(mp, XFS_DQ_PROJ, xfs_qm_flush_one,					   &buffer_list);		if (!error)			error = error2;	}	error2 = xfs_buf_delwri_submit(&buffer_list);	if (!error)		error = error2;	/*	 * We can get this error if we couldn't do a dquot allocation inside	 * xfs_qm_dqusage_adjust (via bulkstat). We don't care about the	 * dirty dquots that might be cached, we just want to get rid of them	 * and turn quotaoff. The dquots won't be attached to any of the inodes	 * at this point (because we intentionally didn't in dqget_noattach).	 */	if (error) {		xfs_qm_dqpurge_all(mp, XFS_QMOPT_QUOTALL);		goto error_return;	}	/*	 * If one type of quotas is off, then it will lose its	 * quotachecked status, since we won't be doing accounting for	 * that type anymore.	 */	mp->m_qflags &= ~XFS_ALL_QUOTA_CHKD;	mp->m_qflags |= flags; error_return:	while (!list_empty(&buffer_list)) {		struct xfs_buf *bp =			list_first_entry(&buffer_list, struct xfs_buf, b_list);		list_del_init(&bp->b_list);		xfs_buf_relse(bp);	}	if (error) {		xfs_warn(mp,	"Quotacheck: Unsuccessful (Error %d): Disabling quotas.",			error);		/*		 * We must turn off quotas.		 */		ASSERT(mp->m_quotainfo != NULL);		xfs_qm_destroy_quotainfo(mp);		if (xfs_mount_reset_sbqflags(mp)) {			xfs_warn(mp,				"Quotacheck: Failed to reset quota flags.");		}	} else		xfs_notice(mp, "Quotacheck: Done.");	return (error);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:101,


示例21: xfs_mount_validate_sb

/* * Check the validity of the SB found. */STATIC intxfs_mount_validate_sb(	xfs_mount_t	*mp,	xfs_sb_t	*sbp,	bool		check_inprogress,	bool		check_version){	/*	 * If the log device and data device have the	 * same device number, the log is internal.	 * Consequently, the sb_logstart should be non-zero.  If	 * we have a zero sb_logstart in this case, we may be trying to mount	 * a volume filesystem in a non-volume manner.	 */	if (sbp->sb_magicnum != XFS_SB_MAGIC) {		xfs_warn(mp, "bad magic number");		return -EWRONGFS;	}	if (!xfs_sb_good_version(sbp)) {		xfs_warn(mp, "bad version");		return -EWRONGFS;	}	/*	 * Version 5 superblock feature mask validation. Reject combinations the	 * kernel cannot support up front before checking anything else. For	 * write validation, we don't need to check feature masks.	 */	if (check_version && XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) {		if (xfs_sb_has_compat_feature(sbp,					XFS_SB_FEAT_COMPAT_UNKNOWN)) {			xfs_warn(mp,"Superblock has unknown compatible features (0x%x) enabled./n""Using a more recent kernel is recommended.",				(sbp->sb_features_compat &						XFS_SB_FEAT_COMPAT_UNKNOWN));		}		if (xfs_sb_has_ro_compat_feature(sbp,					XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {			xfs_alert(mp,"Superblock has unknown read-only compatible features (0x%x) enabled.",				(sbp->sb_features_ro_compat &						XFS_SB_FEAT_RO_COMPAT_UNKNOWN));			if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {				xfs_warn(mp,"Attempted to mount read-only compatible filesystem read-write./n""Filesystem can only be safely mounted read only.");				return -EINVAL;			}		}		if (xfs_sb_has_incompat_feature(sbp,					XFS_SB_FEAT_INCOMPAT_UNKNOWN)) {			xfs_warn(mp,"Superblock has unknown incompatible features (0x%x) enabled./n""Filesystem can not be safely mounted by this kernel.",				(sbp->sb_features_incompat &						XFS_SB_FEAT_INCOMPAT_UNKNOWN));			return -EINVAL;		}	}	if (xfs_sb_version_has_pquotino(sbp)) {		if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) {			xfs_notice(mp,			   "Version 5 of Super block has XFS_OQUOTA bits.");			return -EFSCORRUPTED;		}	} else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD |				XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {			xfs_notice(mp,"Superblock earlier than Version 5 has XFS_[PQ]UOTA_{ENFD|CHKD} bits.");			return -EFSCORRUPTED;	}	if (unlikely(	    sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {		xfs_warn(mp,		"filesystem is marked as having an external log; "		"specify logdev on the mount command line.");		return -EINVAL;	}	if (unlikely(	    sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {		xfs_warn(mp,		"filesystem is marked as having an internal log; "		"do not specify logdev on the mount command line.");		return -EINVAL;	}	/*	 * More sanity checking.  Most of these were stolen directly from	 * xfs_repair.//.........这里部分代码省略.........
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:101,


示例22: xfs_qm_newmount

intxfs_qm_newmount(	xfs_mount_t	*mp,	uint		*needquotamount,	uint		*quotaflags){	uint		quotaondisk;	uint		uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0;	quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) &&				(mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT);	if (quotaondisk) {		uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT;		pquotaondisk = mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT;		gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT;	}	/*	 * If the device itself is read-only, we can't allow	 * the user to change the state of quota on the mount -	 * this would generate a transaction on the ro device,	 * which would lead to an I/O error and shutdown	 */	if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) ||	    (!uquotaondisk &&  XFS_IS_UQUOTA_ON(mp)) ||	     (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||	    (!gquotaondisk &&  XFS_IS_GQUOTA_ON(mp)) ||	     (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) ||	    (!pquotaondisk &&  XFS_IS_PQUOTA_ON(mp)))  &&	    xfs_dev_is_read_only(mp, "changing quota state")) {		xfs_warn(mp, "please mount with%s%s%s%s.",			(!quotaondisk ? "out quota" : ""),			(uquotaondisk ? " usrquota" : ""),			(gquotaondisk ? " grpquota" : ""),			(pquotaondisk ? " prjquota" : ""));		return XFS_ERROR(EPERM);	}	if (XFS_IS_QUOTA_ON(mp) || quotaondisk) {		/*		 * Call mount_quotas at this point only if we won't have to do		 * a quotacheck.		 */		if (quotaondisk && !XFS_QM_NEED_QUOTACHECK(mp)) {			/*			 * If an error occurred, qm_mount_quotas code			 * has already disabled quotas. So, just finish			 * mounting, and get on with the boring life			 * without disk quotas.			 */			xfs_qm_mount_quotas(mp);		} else {			/*			 * Clear the quota flags, but remember them. This			 * is so that the quota code doesn't get invoked			 * before we're ready. This can happen when an			 * inode goes inactive and wants to free blocks,			 * or via xfs_log_mount_finish.			 */			*needquotamount = true;			*quotaflags = mp->m_qflags;			mp->m_qflags = 0;		}	}	return 0;}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:69,


示例23: xfs_parseargs

/* * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock has _not_ yet been read in. * * Note that this function leaks the various device name allocations on * failure.  The caller takes care of them. */STATIC intxfs_parseargs(	struct xfs_mount	*mp,	char			*options){	struct super_block	*sb = mp->m_super;	char			*this_char, *value;	int			dsunit = 0;	int			dswidth = 0;	int			iosize = 0;	__uint8_t		iosizelog = 0;	/*	 * set up the mount name first so all the errors will refer to the	 * correct device.	 */	mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);	if (!mp->m_fsname)		return -ENOMEM;	mp->m_fsname_len = strlen(mp->m_fsname) + 1;	/*	 * Copy binary VFS mount flags we are interested in.	 */	if (sb->s_flags & MS_RDONLY)		mp->m_flags |= XFS_MOUNT_RDONLY;	if (sb->s_flags & MS_DIRSYNC)		mp->m_flags |= XFS_MOUNT_DIRSYNC;	if (sb->s_flags & MS_SYNCHRONOUS)		mp->m_flags |= XFS_MOUNT_WSYNC;	/*	 * Set some default flags that could be cleared by the mount option	 * parsing.	 */	mp->m_flags |= XFS_MOUNT_BARRIER;	mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;	/*	 * These can be overridden by the mount option parsing.	 */	mp->m_logbufs = -1;	mp->m_logbsize = -1;	if (!options)		goto done;	while ((this_char = strsep(&options, ",")) != NULL) {		if (!*this_char)			continue;		if ((value = strchr(this_char, '=')) != NULL)			*value++ = 0;		if (!strcmp(this_char, MNTOPT_LOGBUFS)) {			if (!value || !*value) {				xfs_warn(mp, "%s option requires an argument",					this_char);				return -EINVAL;			}			if (kstrtoint(value, 10, &mp->m_logbufs))				return -EINVAL;		} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {			if (!value || !*value) {				xfs_warn(mp, "%s option requires an argument",					this_char);				return -EINVAL;			}			if (suffix_kstrtoint(value, 10, &mp->m_logbsize))				return -EINVAL;		} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {			if (!value || !*value) {				xfs_warn(mp, "%s option requires an argument",					this_char);				return -EINVAL;			}			mp->m_logname = kstrndup(value, MAXNAMELEN, GFP_KERNEL);			if (!mp->m_logname)				return -ENOMEM;		} else if (!strcmp(this_char, MNTOPT_MTPT)) {			xfs_warn(mp, "%s option not allowed on this system",				this_char);			return -EINVAL;		} else if (!strcmp(this_char, MNTOPT_RTDEV)) {			if (!value || !*value) {				xfs_warn(mp, "%s option requires an argument",					this_char);				return -EINVAL;			}			mp->m_rtname = kstrndup(value, MAXNAMELEN, GFP_KERNEL);			if (!mp->m_rtname)				return -ENOMEM;		} else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {			if (!value || !*value) {//.........这里部分代码省略.........
开发者ID:Claude1986,项目名称:Atheros-CSI-Tool,代码行数:101,


示例24: xfs_parseargs

/* * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock has _not_ yet been read in. * * Note that this function leaks the various device name allocations on * failure.  The caller takes care of them. * * *sb is const because this is also used to test options on the remount * path, and we don't want this to have any side effects at remount time. * Today this function does not change *sb, but just to future-proof... */STATIC intxfs_parseargs(	struct xfs_mount	*mp,	char			*options){	const struct super_block *sb = mp->m_super;	char			*p;	substring_t		args[MAX_OPT_ARGS];	int			dsunit = 0;	int			dswidth = 0;	int			iosize = 0;	__uint8_t		iosizelog = 0;	/*	 * set up the mount name first so all the errors will refer to the	 * correct device.	 */	mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);	if (!mp->m_fsname)		return -ENOMEM;	mp->m_fsname_len = strlen(mp->m_fsname) + 1;	/*	 * Copy binary VFS mount flags we are interested in.	 */	if (sb->s_flags & MS_RDONLY)		mp->m_flags |= XFS_MOUNT_RDONLY;	if (sb->s_flags & MS_DIRSYNC)		mp->m_flags |= XFS_MOUNT_DIRSYNC;	if (sb->s_flags & MS_SYNCHRONOUS)		mp->m_flags |= XFS_MOUNT_WSYNC;	/*	 * Set some default flags that could be cleared by the mount option	 * parsing.	 */	mp->m_flags |= XFS_MOUNT_BARRIER;	mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;	/*	 * These can be overridden by the mount option parsing.	 */	mp->m_logbufs = -1;	mp->m_logbsize = -1;	if (!options)		goto done;	while ((p = strsep(&options, ",")) != NULL) {		int		token;		if (!*p)			continue;		token = match_token(p, tokens, args);		switch (token) {		case Opt_logbufs:			if (match_int(args, &mp->m_logbufs))				return -EINVAL;			break;		case Opt_logbsize:			if (suffix_kstrtoint(args, 10, &mp->m_logbsize))				return -EINVAL;			break;		case Opt_logdev:			mp->m_logname = match_strdup(args);			if (!mp->m_logname)				return -ENOMEM;			break;		case Opt_mtpt:			xfs_warn(mp, "%s option not allowed on this system", p);			return -EINVAL;		case Opt_rtdev:			mp->m_rtname = match_strdup(args);			if (!mp->m_rtname)				return -ENOMEM;			break;		case Opt_allocsize:		case Opt_biosize:			if (suffix_kstrtoint(args, 10, &iosize))				return -EINVAL;			iosizelog = ffs(iosize) - 1;			break;		case Opt_grpid:		case Opt_bsdgroups:			mp->m_flags |= XFS_MOUNT_GRPID;			break;		case Opt_nogrpid:		case Opt_sysvgroups://.........这里部分代码省略.........
开发者ID:sjp38,项目名称:linux.doc_trans_membarrier,代码行数:101,



注:本文中的xfs_warn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xgetcwd函数代码示例
C++ xfs_trans_reserve函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。