mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
nfs: refactor pNFS functions using clear_and_wake_up_bit
Commit8236b0ae31("bdi: wake up concurrent wb_shutdown() callers.") introduces the clear_and_wake_up_bit() helper as a wrapper for the common clear -> barrier -> wake up bitops sequence. The file pnfs.c has several helpers with identical contents. Thus they are replaced with the more recent clean_and_wake_up_bit() global helper which describes accurately its effects at the call and still specifies the cleared bit. This also homogenizes the code with other subsystems. Since the helpers are no longer used after this, they can be safely removed. Suggested-by: Agatha Isabelle Moreira <code@agatha.dev> Link: https://kernelnewbies.org/Beginner%20Cleanup%20and%20Refactor%20Tasks%20by%20Agatha%20Isabelle%20Moreira#task_007 Fixes:d67ae825a5("pnfs/flexfiles: Add the FlexFile Layout Driver") Signed-off-by: Arnaud Bonnet <abo@medichon.fr> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
61461050da
commit
187bfc974e
|
|
@ -2100,15 +2100,6 @@ static bool pnfs_is_first_layoutget(struct pnfs_layout_hdr *lo)
|
|||
return test_bit(NFS_LAYOUT_FIRST_LAYOUTGET, &lo->plh_flags);
|
||||
}
|
||||
|
||||
static void pnfs_clear_first_layoutget(struct pnfs_layout_hdr *lo)
|
||||
{
|
||||
unsigned long *bitlock = &lo->plh_flags;
|
||||
|
||||
clear_bit_unlock(NFS_LAYOUT_FIRST_LAYOUTGET, bitlock);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(bitlock, NFS_LAYOUT_FIRST_LAYOUTGET);
|
||||
}
|
||||
|
||||
static void _add_to_server_list(struct pnfs_layout_hdr *lo,
|
||||
struct nfs_server *server)
|
||||
{
|
||||
|
|
@ -2284,7 +2275,8 @@ pnfs_update_layout(struct inode *ino,
|
|||
iomode, lo, lseg,
|
||||
PNFS_UPDATE_LAYOUT_INVALID_OPEN);
|
||||
nfs4_schedule_stateid_recovery(server, ctx->state);
|
||||
pnfs_clear_first_layoutget(lo);
|
||||
clear_and_wake_up_bit(NFS_LAYOUT_FIRST_LAYOUTGET,
|
||||
&lo->plh_flags);
|
||||
pnfs_put_layout_hdr(lo);
|
||||
goto lookup_again;
|
||||
}
|
||||
|
|
@ -2353,7 +2345,8 @@ pnfs_update_layout(struct inode *ino,
|
|||
if (!exception.retry)
|
||||
goto out_put_layout_hdr;
|
||||
if (first)
|
||||
pnfs_clear_first_layoutget(lo);
|
||||
clear_and_wake_up_bit(NFS_LAYOUT_FIRST_LAYOUTGET,
|
||||
&lo->plh_flags);
|
||||
trace_pnfs_update_layout(ino, pos, count,
|
||||
iomode, lo, lseg, PNFS_UPDATE_LAYOUT_RETRY);
|
||||
pnfs_put_layout_hdr(lo);
|
||||
|
|
@ -2365,7 +2358,7 @@ pnfs_update_layout(struct inode *ino,
|
|||
|
||||
out_put_layout_hdr:
|
||||
if (first)
|
||||
pnfs_clear_first_layoutget(lo);
|
||||
clear_and_wake_up_bit(NFS_LAYOUT_FIRST_LAYOUTGET, &lo->plh_flags);
|
||||
trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
|
||||
PNFS_UPDATE_LAYOUT_EXIT);
|
||||
pnfs_put_layout_hdr(lo);
|
||||
|
|
@ -2457,7 +2450,7 @@ static void _lgopen_prepare_attached(struct nfs4_opendata *data,
|
|||
lgp = pnfs_alloc_init_layoutget_args(ino, ctx, ¤t_stateid, &rng,
|
||||
nfs_io_gfp_mask());
|
||||
if (!lgp) {
|
||||
pnfs_clear_first_layoutget(lo);
|
||||
clear_and_wake_up_bit(NFS_LAYOUT_FIRST_LAYOUTGET, &lo->plh_flags);
|
||||
nfs_layoutget_end(lo);
|
||||
pnfs_put_layout_hdr(lo);
|
||||
return;
|
||||
|
|
@ -2561,7 +2554,8 @@ void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
|
|||
{
|
||||
if (lgp != NULL) {
|
||||
if (lgp->lo) {
|
||||
pnfs_clear_first_layoutget(lgp->lo);
|
||||
clear_and_wake_up_bit(NFS_LAYOUT_FIRST_LAYOUTGET,
|
||||
&lgp->lo->plh_flags);
|
||||
nfs_layoutget_end(lgp->lo);
|
||||
}
|
||||
pnfs_layoutget_free(lgp);
|
||||
|
|
@ -3273,15 +3267,6 @@ pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_generic_pg_readpages);
|
||||
|
||||
static void pnfs_clear_layoutcommitting(struct inode *inode)
|
||||
{
|
||||
unsigned long *bitlock = &NFS_I(inode)->flags;
|
||||
|
||||
clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING);
|
||||
}
|
||||
|
||||
/*
|
||||
* There can be multiple RW segments.
|
||||
*/
|
||||
|
|
@ -3306,7 +3291,7 @@ static void pnfs_list_write_lseg_done(struct inode *inode, struct list_head *lis
|
|||
pnfs_put_lseg(lseg);
|
||||
}
|
||||
|
||||
pnfs_clear_layoutcommitting(inode);
|
||||
clear_and_wake_up_bit(NFS_INO_LAYOUTCOMMITTING, &NFS_I(inode)->flags);
|
||||
}
|
||||
|
||||
void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg)
|
||||
|
|
@ -3446,7 +3431,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
|
|||
spin_unlock(&inode->i_lock);
|
||||
kfree(data);
|
||||
clear_layoutcommitting:
|
||||
pnfs_clear_layoutcommitting(inode);
|
||||
clear_and_wake_up_bit(NFS_INO_LAYOUTCOMMITTING, &NFS_I(inode)->flags);
|
||||
goto out;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pnfs_layoutcommit_inode);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user