提交 feb0a987 编写于 作者: D Darrick J. Wong 提交者: Zheng Zengkai

xfs: pass struct xfs_eofblocks to the inode scan callback

mainline-inclusion
from mainline-v5.13-rc4
commit 9d5ee837
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9d5ee837595134f91bb2d66f571f498c3b8ab148

-------------------------------------------------

Pass a pointer to the actual eofb structure around the inode scanner
functions instead of a void pointer, now that none of the functions is
used as a callback.
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NLihong Kou <koulihong@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a64251c3
...@@ -55,9 +55,9 @@ xfs_icwalk_tag(enum xfs_icwalk_goal goal) ...@@ -55,9 +55,9 @@ xfs_icwalk_tag(enum xfs_icwalk_goal goal)
} }
static int xfs_icwalk(struct xfs_mount *mp, static int xfs_icwalk(struct xfs_mount *mp,
enum xfs_icwalk_goal goal, void *args); enum xfs_icwalk_goal goal, struct xfs_eofblocks *eofb);
static int xfs_icwalk_ag(struct xfs_perag *pag, static int xfs_icwalk_ag(struct xfs_perag *pag,
enum xfs_icwalk_goal goal, void *args); enum xfs_icwalk_goal goal, struct xfs_eofblocks *eofb);
/* /*
* Private inode cache walk flags for struct xfs_eofblocks. Must not coincide * Private inode cache walk flags for struct xfs_eofblocks. Must not coincide
...@@ -810,10 +810,8 @@ xfs_dqrele_igrab( ...@@ -810,10 +810,8 @@ xfs_dqrele_igrab(
static void static void
xfs_dqrele_inode( xfs_dqrele_inode(
struct xfs_inode *ip, struct xfs_inode *ip,
void *priv) struct xfs_eofblocks *eofb)
{ {
struct xfs_eofblocks *eofb = priv;
if (xfs_iflags_test(ip, XFS_INEW)) if (xfs_iflags_test(ip, XFS_INEW))
xfs_inew_wait(ip); xfs_inew_wait(ip);
...@@ -1230,10 +1228,9 @@ xfs_reclaim_worker( ...@@ -1230,10 +1228,9 @@ xfs_reclaim_worker(
STATIC int STATIC int
xfs_inode_free_eofblocks( xfs_inode_free_eofblocks(
struct xfs_inode *ip, struct xfs_inode *ip,
void *args, struct xfs_eofblocks *eofb,
unsigned int *lockflags) unsigned int *lockflags)
{ {
struct xfs_eofblocks *eofb = args;
bool wait; bool wait;
wait = eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC); wait = eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC);
...@@ -1438,10 +1435,9 @@ xfs_prep_free_cowblocks( ...@@ -1438,10 +1435,9 @@ xfs_prep_free_cowblocks(
STATIC int STATIC int
xfs_inode_free_cowblocks( xfs_inode_free_cowblocks(
struct xfs_inode *ip, struct xfs_inode *ip,
void *args, struct xfs_eofblocks *eofb,
unsigned int *lockflags) unsigned int *lockflags)
{ {
struct xfs_eofblocks *eofb = args;
bool wait; bool wait;
int ret = 0; int ret = 0;
...@@ -1578,16 +1574,16 @@ xfs_blockgc_igrab( ...@@ -1578,16 +1574,16 @@ xfs_blockgc_igrab(
static int static int
xfs_blockgc_scan_inode( xfs_blockgc_scan_inode(
struct xfs_inode *ip, struct xfs_inode *ip,
void *args) struct xfs_eofblocks *eofb)
{ {
unsigned int lockflags = 0; unsigned int lockflags = 0;
int error; int error;
error = xfs_inode_free_eofblocks(ip, args, &lockflags); error = xfs_inode_free_eofblocks(ip, eofb, &lockflags);
if (error) if (error)
goto unlock; goto unlock;
error = xfs_inode_free_cowblocks(ip, args, &lockflags); error = xfs_inode_free_cowblocks(ip, eofb, &lockflags);
unlock: unlock:
if (lockflags) if (lockflags)
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
...@@ -1723,16 +1719,16 @@ static inline int ...@@ -1723,16 +1719,16 @@ static inline int
xfs_icwalk_process_inode( xfs_icwalk_process_inode(
enum xfs_icwalk_goal goal, enum xfs_icwalk_goal goal,
struct xfs_inode *ip, struct xfs_inode *ip,
void *args) struct xfs_eofblocks *eofb)
{ {
int error = 0; int error = 0;
switch (goal) { switch (goal) {
case XFS_ICWALK_DQRELE: case XFS_ICWALK_DQRELE:
xfs_dqrele_inode(ip, args); xfs_dqrele_inode(ip, eofb);
break; break;
case XFS_ICWALK_BLOCKGC: case XFS_ICWALK_BLOCKGC:
error = xfs_blockgc_scan_inode(ip, args); error = xfs_blockgc_scan_inode(ip, eofb);
break; break;
} }
return error; return error;
...@@ -1746,7 +1742,7 @@ static int ...@@ -1746,7 +1742,7 @@ static int
xfs_icwalk_ag( xfs_icwalk_ag(
struct xfs_perag *pag, struct xfs_perag *pag,
enum xfs_icwalk_goal goal, enum xfs_icwalk_goal goal,
void *args) struct xfs_eofblocks *eofb)
{ {
struct xfs_mount *mp = pag->pag_mount; struct xfs_mount *mp = pag->pag_mount;
uint32_t first_index; uint32_t first_index;
...@@ -1818,7 +1814,7 @@ xfs_icwalk_ag( ...@@ -1818,7 +1814,7 @@ xfs_icwalk_ag(
for (i = 0; i < nr_found; i++) { for (i = 0; i < nr_found; i++) {
if (!batch[i]) if (!batch[i])
continue; continue;
error = xfs_icwalk_process_inode(goal, batch[i], args); error = xfs_icwalk_process_inode(goal, batch[i], eofb);
if (error == -EAGAIN) { if (error == -EAGAIN) {
skipped++; skipped++;
continue; continue;
...@@ -1861,7 +1857,7 @@ static int ...@@ -1861,7 +1857,7 @@ static int
xfs_icwalk( xfs_icwalk(
struct xfs_mount *mp, struct xfs_mount *mp,
enum xfs_icwalk_goal goal, enum xfs_icwalk_goal goal,
void *args) struct xfs_eofblocks *eofb)
{ {
struct xfs_perag *pag; struct xfs_perag *pag;
int error = 0; int error = 0;
...@@ -1870,7 +1866,7 @@ xfs_icwalk( ...@@ -1870,7 +1866,7 @@ xfs_icwalk(
while ((pag = xfs_icwalk_get_perag(mp, agno, goal))) { while ((pag = xfs_icwalk_get_perag(mp, agno, goal))) {
agno = pag->pag_agno + 1; agno = pag->pag_agno + 1;
error = xfs_icwalk_ag(pag, goal, args); error = xfs_icwalk_ag(pag, goal, eofb);
xfs_perag_put(pag); xfs_perag_put(pag);
if (error) { if (error) {
last_error = error; last_error = error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册