Message ID | 15902ae1f53ef52d36fb4371fa2ec3428ca7158a.1543348078.git.dsterba@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Switch defines to enums | expand |
On Tue, Nov 27, 2018 at 08:53:57PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > ordered extent flags. Reviewed-by: Omar Sandoval <osandov@fb.com> > Signed-off-by: David Sterba <dsterba@suse.com> > --- > fs/btrfs/ordered-data.h | 45 +++++++++++++++++++++++------------------ > 1 file changed, 25 insertions(+), 20 deletions(-) > > diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h > index b10e6765d88f..fb9a161f0215 100644 > --- a/fs/btrfs/ordered-data.h > +++ b/fs/btrfs/ordered-data.h > @@ -37,26 +37,31 @@ struct btrfs_ordered_sum { > * rbtree, just before waking any waiters. It is used to indicate the > * IO is done and any metadata is inserted into the tree. > */ > -#define BTRFS_ORDERED_IO_DONE 0 /* set when all the pages are written */ > - > -#define BTRFS_ORDERED_COMPLETE 1 /* set when removed from the tree */ > - > -#define BTRFS_ORDERED_NOCOW 2 /* set when we want to write in place */ > - > -#define BTRFS_ORDERED_COMPRESSED 3 /* writing a zlib compressed extent */ > - > -#define BTRFS_ORDERED_PREALLOC 4 /* set when writing to preallocated extent */ > - > -#define BTRFS_ORDERED_DIRECT 5 /* set when we're doing DIO with this extent */ > - > -#define BTRFS_ORDERED_IOERR 6 /* We had an io error when writing this out */ > - > -#define BTRFS_ORDERED_UPDATED_ISIZE 7 /* indicates whether this ordered extent > - * has done its due diligence in updating > - * the isize. */ > -#define BTRFS_ORDERED_TRUNCATED 8 /* Set when we have to truncate an extent */ > - > -#define BTRFS_ORDERED_REGULAR 10 /* Regular IO for COW */ > +enum { > + /* set when all the pages are written */ > + BTRFS_ORDERED_IO_DONE, > + /* set when removed from the tree */ > + BTRFS_ORDERED_COMPLETE, > + /* set when we want to write in place */ > + BTRFS_ORDERED_NOCOW, > + /* writing a zlib compressed extent */ > + BTRFS_ORDERED_COMPRESSED, > + /* set when writing to preallocated extent */ > + BTRFS_ORDERED_PREALLOC, > + /* set when we're doing DIO with this extent */ > + BTRFS_ORDERED_DIRECT, > + /* We had an io error when writing this out */ > + BTRFS_ORDERED_IOERR, > + /* > + * indicates whether this ordered extent has done its due diligence in > + * updating the isize > + */ > + BTRFS_ORDERED_UPDATED_ISIZE, > + /* Set when we have to truncate an extent */ > + BTRFS_ORDERED_TRUNCATED, > + /* Regular IO for COW */ > + BTRFS_ORDERED_REGULAR, > +}; > > struct btrfs_ordered_extent { > /* logical offset in the file */ > -- > 2.19.1 >
On 2018/11/28 上午3:53, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > ordered extent flags. > > Signed-off-by: David Sterba <dsterba@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/ordered-data.h | 45 +++++++++++++++++++++++------------------ > 1 file changed, 25 insertions(+), 20 deletions(-) > > diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h > index b10e6765d88f..fb9a161f0215 100644 > --- a/fs/btrfs/ordered-data.h > +++ b/fs/btrfs/ordered-data.h > @@ -37,26 +37,31 @@ struct btrfs_ordered_sum { > * rbtree, just before waking any waiters. It is used to indicate the > * IO is done and any metadata is inserted into the tree. > */ > -#define BTRFS_ORDERED_IO_DONE 0 /* set when all the pages are written */ > - > -#define BTRFS_ORDERED_COMPLETE 1 /* set when removed from the tree */ > - > -#define BTRFS_ORDERED_NOCOW 2 /* set when we want to write in place */ > - > -#define BTRFS_ORDERED_COMPRESSED 3 /* writing a zlib compressed extent */ > - > -#define BTRFS_ORDERED_PREALLOC 4 /* set when writing to preallocated extent */ > - > -#define BTRFS_ORDERED_DIRECT 5 /* set when we're doing DIO with this extent */ > - > -#define BTRFS_ORDERED_IOERR 6 /* We had an io error when writing this out */ > - > -#define BTRFS_ORDERED_UPDATED_ISIZE 7 /* indicates whether this ordered extent > - * has done its due diligence in updating > - * the isize. */ > -#define BTRFS_ORDERED_TRUNCATED 8 /* Set when we have to truncate an extent */ > - > -#define BTRFS_ORDERED_REGULAR 10 /* Regular IO for COW */ > +enum { > + /* set when all the pages are written */ > + BTRFS_ORDERED_IO_DONE, > + /* set when removed from the tree */ > + BTRFS_ORDERED_COMPLETE, > + /* set when we want to write in place */ > + BTRFS_ORDERED_NOCOW, > + /* writing a zlib compressed extent */ > + BTRFS_ORDERED_COMPRESSED, > + /* set when writing to preallocated extent */ > + BTRFS_ORDERED_PREALLOC, > + /* set when we're doing DIO with this extent */ > + BTRFS_ORDERED_DIRECT, > + /* We had an io error when writing this out */ > + BTRFS_ORDERED_IOERR, > + /* > + * indicates whether this ordered extent has done its due diligence in > + * updating the isize > + */ > + BTRFS_ORDERED_UPDATED_ISIZE, > + /* Set when we have to truncate an extent */ > + BTRFS_ORDERED_TRUNCATED, > + /* Regular IO for COW */ > + BTRFS_ORDERED_REGULAR, > +}; > > struct btrfs_ordered_extent { > /* logical offset in the file */ >
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index b10e6765d88f..fb9a161f0215 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h @@ -37,26 +37,31 @@ struct btrfs_ordered_sum { * rbtree, just before waking any waiters. It is used to indicate the * IO is done and any metadata is inserted into the tree. */ -#define BTRFS_ORDERED_IO_DONE 0 /* set when all the pages are written */ - -#define BTRFS_ORDERED_COMPLETE 1 /* set when removed from the tree */ - -#define BTRFS_ORDERED_NOCOW 2 /* set when we want to write in place */ - -#define BTRFS_ORDERED_COMPRESSED 3 /* writing a zlib compressed extent */ - -#define BTRFS_ORDERED_PREALLOC 4 /* set when writing to preallocated extent */ - -#define BTRFS_ORDERED_DIRECT 5 /* set when we're doing DIO with this extent */ - -#define BTRFS_ORDERED_IOERR 6 /* We had an io error when writing this out */ - -#define BTRFS_ORDERED_UPDATED_ISIZE 7 /* indicates whether this ordered extent - * has done its due diligence in updating - * the isize. */ -#define BTRFS_ORDERED_TRUNCATED 8 /* Set when we have to truncate an extent */ - -#define BTRFS_ORDERED_REGULAR 10 /* Regular IO for COW */ +enum { + /* set when all the pages are written */ + BTRFS_ORDERED_IO_DONE, + /* set when removed from the tree */ + BTRFS_ORDERED_COMPLETE, + /* set when we want to write in place */ + BTRFS_ORDERED_NOCOW, + /* writing a zlib compressed extent */ + BTRFS_ORDERED_COMPRESSED, + /* set when writing to preallocated extent */ + BTRFS_ORDERED_PREALLOC, + /* set when we're doing DIO with this extent */ + BTRFS_ORDERED_DIRECT, + /* We had an io error when writing this out */ + BTRFS_ORDERED_IOERR, + /* + * indicates whether this ordered extent has done its due diligence in + * updating the isize + */ + BTRFS_ORDERED_UPDATED_ISIZE, + /* Set when we have to truncate an extent */ + BTRFS_ORDERED_TRUNCATED, + /* Regular IO for COW */ + BTRFS_ORDERED_REGULAR, +}; struct btrfs_ordered_extent { /* logical offset in the file */
We can use simple enum for values that are not part of on-disk format: ordered extent flags. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/ordered-data.h | 45 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-)