metapath.c (c34e9ab9a612ee8b18273398ef75c207b01f516d) | metapath.c (9b7280010366dbe32791acd498a37dc522f568db) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2023-2024 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <djwong@kernel.org> 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 182 unchanged lines hidden (view full) --- 191} 192 193/* Scan a quota inode under the /quota directory. */ 194static int 195xchk_setup_metapath_dqinode( 196 struct xfs_scrub *sc, 197 xfs_dqtype_t type) 198{ | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2023-2024 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <djwong@kernel.org> 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 182 unchanged lines hidden (view full) --- 191} 192 193/* Scan a quota inode under the /quota directory. */ 194static int 195xchk_setup_metapath_dqinode( 196 struct xfs_scrub *sc, 197 xfs_dqtype_t type) 198{ |
199 struct xfs_quotainfo *qi = sc->mp->m_quotainfo; |
|
199 struct xfs_trans *tp = NULL; 200 struct xfs_inode *dp = NULL; 201 struct xfs_inode *ip = NULL; | 200 struct xfs_trans *tp = NULL; 201 struct xfs_inode *dp = NULL; 202 struct xfs_inode *ip = NULL; |
202 const char *path; | |
203 int error; 204 | 203 int error; 204 |
205 if (!qi) 206 return -ENOENT; 207 208 switch (type) { 209 case XFS_DQTYPE_USER: 210 ip = qi->qi_uquotaip; 211 break; 212 case XFS_DQTYPE_GROUP: 213 ip = qi->qi_gquotaip; 214 break; 215 case XFS_DQTYPE_PROJ: 216 ip = qi->qi_pquotaip; 217 break; 218 default: 219 ASSERT(0); 220 return -EINVAL; 221 } 222 if (!ip) 223 return -ENOENT; 224 |
|
205 error = xfs_trans_alloc_empty(sc->mp, &tp); 206 if (error) 207 return error; 208 209 error = xfs_dqinode_load_parent(tp, &dp); | 225 error = xfs_trans_alloc_empty(sc->mp, &tp); 226 if (error) 227 return error; 228 229 error = xfs_dqinode_load_parent(tp, &dp); |
230 xfs_trans_cancel(tp); |
|
210 if (error) | 231 if (error) |
211 goto out_cancel; | 232 return error; |
212 | 233 |
213 error = xfs_dqinode_load(tp, dp, type, &ip); 214 if (error) 215 goto out_dp; | 234 error = xchk_setup_metapath_scan(sc, dp, 235 kstrdup(xfs_dqinode_path(type), GFP_KERNEL), ip); |
216 | 236 |
217 xfs_trans_cancel(tp); 218 tp = NULL; 219 220 path = kasprintf(GFP_KERNEL, "%s", xfs_dqinode_path(type)); 221 error = xchk_setup_metapath_scan(sc, dp, path, ip); 222 223 xfs_irele(ip); 224out_dp: | |
225 xfs_irele(dp); | 237 xfs_irele(dp); |
226out_cancel: 227 if (tp) 228 xfs_trans_cancel(tp); | |
229 return error; 230} 231#else 232# define xchk_setup_metapath_quotadir(...) (-ENOENT) 233# define xchk_setup_metapath_dqinode(...) (-ENOENT) 234#endif /* CONFIG_XFS_QUOTA */ 235 236int --- 453 unchanged lines hidden --- | 238 return error; 239} 240#else 241# define xchk_setup_metapath_quotadir(...) (-ENOENT) 242# define xchk_setup_metapath_dqinode(...) (-ENOENT) 243#endif /* CONFIG_XFS_QUOTA */ 244 245int --- 453 unchanged lines hidden --- |