Message ID | 20190809213726.32336-13-allison.henderson@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Delayed Attributes | expand |
On Fri, Aug 09, 2019 at 02:37:20PM -0700, Allison Collins wrote: > Because new delayed attribute routines cannot roll > transactions, we carve off the parts of > xfs_attr_rmtval_remove that we can use. This will help to > reduce repetitive code later when we introduce delayed > attributes. > > Signed-off-by: Allison Collins <allison.henderson@oracle.com> > --- > fs/xfs/libxfs/xfs_attr_remote.c | 25 +++++++++++++++++++------ > fs/xfs/libxfs/xfs_attr_remote.h | 1 + > 2 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c > index c421412..f030365 100644 > --- a/fs/xfs/libxfs/xfs_attr_remote.c > +++ b/fs/xfs/libxfs/xfs_attr_remote.c > @@ -586,19 +586,14 @@ xfs_attr_rmtval_set_value( > return 0; > } > > -/* > - * Remove the value associated with an attribute by deleting the > - * out-of-line buffer that it is stored on. > - */ > int > -xfs_attr_rmtval_remove( > +xfs_attr_rmtval_remove_value( This function invalidates the incore buffers, right? Since _remove below still does the actual bunmapi work to unmap blocks from the attr fork? Would this be better named xfs_attr_rmtval_invalidate()? > struct xfs_da_args *args) > { > struct xfs_mount *mp = args->dp->i_mount; > xfs_dablk_t lblkno; > int blkcnt; > int error; > - int done; > > trace_xfs_attr_rmtval_remove(args); Leave this in xfs_attr_rmtval_remove. --D > > @@ -642,7 +637,25 @@ xfs_attr_rmtval_remove( > lblkno += map.br_blockcount; > blkcnt -= map.br_blockcount; > } > + return 0; > +} > > +/* > + * Remove the value associated with an attribute by deleting the > + * out-of-line buffer that it is stored on. > + */ > +int > +xfs_attr_rmtval_remove( > + struct xfs_da_args *args) > +{ > + xfs_dablk_t lblkno; > + int blkcnt; > + int error = 0; > + int done = 0; > + > + error = xfs_attr_rmtval_remove_value(args); > + if (error) > + return error; > /* > * Keep de-allocating extents until the remote-value region is gone. > */ > diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h > index 2a73cd9..9a58a23 100644 > --- a/fs/xfs/libxfs/xfs_attr_remote.h > +++ b/fs/xfs/libxfs/xfs_attr_remote.h > @@ -11,6 +11,7 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen); > int xfs_attr_rmtval_get(struct xfs_da_args *args); > int xfs_attr_rmtval_set(struct xfs_da_args *args); > int xfs_attr_rmtval_remove(struct xfs_da_args *args); > +int xfs_attr_rmtval_remove_value(struct xfs_da_args *args); > int xfs_attr_rmtval_set_value(struct xfs_da_args *args); > int xfs_attr_rmt_find_hole(struct xfs_da_args *args, int *blkcnt, > xfs_fileoff_t *lfileoff); > -- > 2.7.4 >
On 8/12/19 9:27 AM, Darrick J. Wong wrote: > On Fri, Aug 09, 2019 at 02:37:20PM -0700, Allison Collins wrote: >> Because new delayed attribute routines cannot roll >> transactions, we carve off the parts of >> xfs_attr_rmtval_remove that we can use. This will help to >> reduce repetitive code later when we introduce delayed >> attributes. >> >> Signed-off-by: Allison Collins <allison.henderson@oracle.com> >> --- >> fs/xfs/libxfs/xfs_attr_remote.c | 25 +++++++++++++++++++------ >> fs/xfs/libxfs/xfs_attr_remote.h | 1 + >> 2 files changed, 20 insertions(+), 6 deletions(-) >> >> diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c >> index c421412..f030365 100644 >> --- a/fs/xfs/libxfs/xfs_attr_remote.c >> +++ b/fs/xfs/libxfs/xfs_attr_remote.c >> @@ -586,19 +586,14 @@ xfs_attr_rmtval_set_value( >> return 0; >> } >> >> -/* >> - * Remove the value associated with an attribute by deleting the >> - * out-of-line buffer that it is stored on. >> - */ >> int >> -xfs_attr_rmtval_remove( >> +xfs_attr_rmtval_remove_value( > > This function invalidates the incore buffers, right? Since _remove > below still does the actual bunmapi work to unmap blocks from the attr > fork? Would this be better named xfs_attr_rmtval_invalidate()? Yeah, I struggled with what to call some of these other than "yet one more helper function" that doesn't roll or commit something. xfs_attr_rmtval_invalidate sounds good, I will add that into v3. > >> struct xfs_da_args *args) >> { >> struct xfs_mount *mp = args->dp->i_mount; >> xfs_dablk_t lblkno; >> int blkcnt; >> int error; >> - int done; >> >> trace_xfs_attr_rmtval_remove(args); > > Leave this in xfs_attr_rmtval_remove. > Ok, will move. Thanks! Allison > --D > >> >> @@ -642,7 +637,25 @@ xfs_attr_rmtval_remove( >> lblkno += map.br_blockcount; >> blkcnt -= map.br_blockcount; >> } >> + return 0; >> +} >> >> +/* >> + * Remove the value associated with an attribute by deleting the >> + * out-of-line buffer that it is stored on. >> + */ >> +int >> +xfs_attr_rmtval_remove( >> + struct xfs_da_args *args) >> +{ >> + xfs_dablk_t lblkno; >> + int blkcnt; >> + int error = 0; >> + int done = 0; >> + >> + error = xfs_attr_rmtval_remove_value(args); >> + if (error) >> + return error; >> /* >> * Keep de-allocating extents until the remote-value region is gone. >> */ >> diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h >> index 2a73cd9..9a58a23 100644 >> --- a/fs/xfs/libxfs/xfs_attr_remote.h >> +++ b/fs/xfs/libxfs/xfs_attr_remote.h >> @@ -11,6 +11,7 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen); >> int xfs_attr_rmtval_get(struct xfs_da_args *args); >> int xfs_attr_rmtval_set(struct xfs_da_args *args); >> int xfs_attr_rmtval_remove(struct xfs_da_args *args); >> +int xfs_attr_rmtval_remove_value(struct xfs_da_args *args); >> int xfs_attr_rmtval_set_value(struct xfs_da_args *args); >> int xfs_attr_rmt_find_hole(struct xfs_da_args *args, int *blkcnt, >> xfs_fileoff_t *lfileoff); >> -- >> 2.7.4 >>
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index c421412..f030365 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -586,19 +586,14 @@ xfs_attr_rmtval_set_value( return 0; } -/* - * Remove the value associated with an attribute by deleting the - * out-of-line buffer that it is stored on. - */ int -xfs_attr_rmtval_remove( +xfs_attr_rmtval_remove_value( struct xfs_da_args *args) { struct xfs_mount *mp = args->dp->i_mount; xfs_dablk_t lblkno; int blkcnt; int error; - int done; trace_xfs_attr_rmtval_remove(args); @@ -642,7 +637,25 @@ xfs_attr_rmtval_remove( lblkno += map.br_blockcount; blkcnt -= map.br_blockcount; } + return 0; +} +/* + * Remove the value associated with an attribute by deleting the + * out-of-line buffer that it is stored on. + */ +int +xfs_attr_rmtval_remove( + struct xfs_da_args *args) +{ + xfs_dablk_t lblkno; + int blkcnt; + int error = 0; + int done = 0; + + error = xfs_attr_rmtval_remove_value(args); + if (error) + return error; /* * Keep de-allocating extents until the remote-value region is gone. */ diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 2a73cd9..9a58a23 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/libxfs/xfs_attr_remote.h @@ -11,6 +11,7 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen); int xfs_attr_rmtval_get(struct xfs_da_args *args); int xfs_attr_rmtval_set(struct xfs_da_args *args); int xfs_attr_rmtval_remove(struct xfs_da_args *args); +int xfs_attr_rmtval_remove_value(struct xfs_da_args *args); int xfs_attr_rmtval_set_value(struct xfs_da_args *args); int xfs_attr_rmt_find_hole(struct xfs_da_args *args, int *blkcnt, xfs_fileoff_t *lfileoff);
Because new delayed attribute routines cannot roll transactions, we carve off the parts of xfs_attr_rmtval_remove that we can use. This will help to reduce repetitive code later when we introduce delayed attributes. Signed-off-by: Allison Collins <allison.henderson@oracle.com> --- fs/xfs/libxfs/xfs_attr_remote.c | 25 +++++++++++++++++++------ fs/xfs/libxfs/xfs_attr_remote.h | 1 + 2 files changed, 20 insertions(+), 6 deletions(-)