* [PATCH] xfs_io: add buf_lru_ref tag to inject table @ 2017-11-30 22:12 Eric Sandeen 2017-11-30 22:23 ` Darrick J. Wong 2017-11-30 22:57 ` [PATCH V2] " Eric Sandeen 0 siblings, 2 replies; 5+ messages in thread From: Eric Sandeen @ 2017-11-30 22:12 UTC (permalink / raw) To: linux-xfs Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- it might be nice to also allow specification by number, but for now just fix this up to match the currently-defined tags. diff --git a/io/inject.c b/io/inject.c index 9d0cf62..2f15854 100644 --- a/io/inject.c +++ b/io/inject.c @@ -62,6 +62,7 @@ error_tag(char *name) { XFS_ERRTAG_DROP_WRITES, "drop_writes" }, { XFS_ERRTAG_LOG_BAD_CRC, "log_bad_crc" }, { XFS_ERRTAG_LOG_ITEM_PIN, "log_item_pin" }, + { XFS_ERRTAG_BUF_LRU_REF, "buf_lru_ref" }, { XFS_ERRTAG_MAX, NULL } }; int count; ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xfs_io: add buf_lru_ref tag to inject table 2017-11-30 22:12 [PATCH] xfs_io: add buf_lru_ref tag to inject table Eric Sandeen @ 2017-11-30 22:23 ` Darrick J. Wong 2017-11-30 22:57 ` [PATCH V2] " Eric Sandeen 1 sibling, 0 replies; 5+ messages in thread From: Darrick J. Wong @ 2017-11-30 22:23 UTC (permalink / raw) To: Eric Sandeen; +Cc: linux-xfs On Thu, Nov 30, 2017 at 04:12:32PM -0600, Eric Sandeen wrote: > Signed-off-by: Eric Sandeen <sandeen@redhat.com> /me wonders if we could make so that the compiler complains about missing table entries here, but that's orthogonal to this patch so: Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D > --- > > it might be nice to also allow specification by number, but > for now just fix this up to match the currently-defined tags. > > diff --git a/io/inject.c b/io/inject.c > index 9d0cf62..2f15854 100644 > --- a/io/inject.c > +++ b/io/inject.c > @@ -62,6 +62,7 @@ error_tag(char *name) > { XFS_ERRTAG_DROP_WRITES, "drop_writes" }, > { XFS_ERRTAG_LOG_BAD_CRC, "log_bad_crc" }, > { XFS_ERRTAG_LOG_ITEM_PIN, "log_item_pin" }, > + { XFS_ERRTAG_BUF_LRU_REF, "buf_lru_ref" }, > { XFS_ERRTAG_MAX, NULL } > }; > int count; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2] xfs_io: add buf_lru_ref tag to inject table 2017-11-30 22:12 [PATCH] xfs_io: add buf_lru_ref tag to inject table Eric Sandeen 2017-11-30 22:23 ` Darrick J. Wong @ 2017-11-30 22:57 ` Eric Sandeen 2017-11-30 23:04 ` [PATCH V3] " Eric Sandeen 1 sibling, 1 reply; 5+ messages in thread From: Eric Sandeen @ 2017-11-30 22:57 UTC (permalink / raw) To: Eric Sandeen, linux-xfs And catch it at build time if we get out of sync again. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- diff --git a/include/xfs.h b/include/xfs.h index 9f0f11b..a40ca0c 100644 --- a/include/xfs.h +++ b/include/xfs.h @@ -64,6 +64,10 @@ extern int xfs_assert_largefile[sizeof(off_t)-8]; #define __packed __attribute__((packed)) #endif +#ifndef BUILD_BUG_ON +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) +#endif + #include <xfs/xfs_types.h> #include <xfs/xfs_fs.h> diff --git a/io/inject.c b/io/inject.c index a118879..fc3cf25 100644 --- a/io/inject.c +++ b/io/inject.c @@ -62,10 +62,14 @@ error_tag(char *name) { XFS_ERRTAG_DROP_WRITES, "drop_writes" }, { XFS_ERRTAG_LOG_BAD_CRC, "log_bad_crc" }, { XFS_ERRTAG_LOG_ITEM_PIN, "log_item_pin" }, + { XFS_ERRTAG_BUF_LRU_REF, "buf_lru_ref" }, { XFS_ERRTAG_MAX, NULL } }; int count; + /* If this fails, make sure every tag is defined in the array above */ + BUILD_BUG_ON(sizeof(eflags) != (XFS_ERRTAG_MAX + 1) * sizeof(*e)); + /* Search for a name */ if (name) { for (e = eflags; e->name; e++) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V3] xfs_io: add buf_lru_ref tag to inject table 2017-11-30 22:57 ` [PATCH V2] " Eric Sandeen @ 2017-11-30 23:04 ` Eric Sandeen 2017-11-30 23:13 ` Darrick J. Wong 0 siblings, 1 reply; 5+ messages in thread From: Eric Sandeen @ 2017-11-30 23:04 UTC (permalink / raw) To: Eric Sandeen, linux-xfs And catch it at build time if we get out of sync again. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- V2: add BUILD_BUG_ON V3: dynamically size the array (I tested w/ dynamically sized but lost it in the V2 patch) diff --git a/include/xfs.h b/include/xfs.h index 9f0f11b..a40ca0c 100644 --- a/include/xfs.h +++ b/include/xfs.h @@ -64,6 +64,10 @@ extern int xfs_assert_largefile[sizeof(off_t)-8]; #define __packed __attribute__((packed)) #endif +#ifndef BUILD_BUG_ON +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) +#endif + #include <xfs/xfs_types.h> #include <xfs/xfs_fs.h> diff --git a/io/inject.c b/io/inject.c index 9d0cf62..fc3cf25 100644 --- a/io/inject.c +++ b/io/inject.c @@ -30,7 +30,7 @@ error_tag(char *name) static struct { int tag; char *name; - } *e, eflags[XFS_ERRTAG_MAX + 1] = { + } *e, eflags[] = { { XFS_ERRTAG_NOERROR, "noerror" }, { XFS_ERRTAG_IFLUSH_1, "iflush1" }, { XFS_ERRTAG_IFLUSH_2, "iflush2" }, @@ -62,10 +62,14 @@ error_tag(char *name) { XFS_ERRTAG_DROP_WRITES, "drop_writes" }, { XFS_ERRTAG_LOG_BAD_CRC, "log_bad_crc" }, { XFS_ERRTAG_LOG_ITEM_PIN, "log_item_pin" }, + { XFS_ERRTAG_BUF_LRU_REF, "buf_lru_ref" }, { XFS_ERRTAG_MAX, NULL } }; int count; + /* If this fails make sure every tag is defined in the array above */ + BUILD_BUG_ON(sizeof(eflags) != (XFS_ERRTAG_MAX + 1) * sizeof(*e)); + /* Search for a name */ if (name) { for (e = eflags; e->name; e++) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V3] xfs_io: add buf_lru_ref tag to inject table 2017-11-30 23:04 ` [PATCH V3] " Eric Sandeen @ 2017-11-30 23:13 ` Darrick J. Wong 0 siblings, 0 replies; 5+ messages in thread From: Darrick J. Wong @ 2017-11-30 23:13 UTC (permalink / raw) To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs On Thu, Nov 30, 2017 at 05:04:36PM -0600, Eric Sandeen wrote: > And catch it at build time if we get out of sync again. > > Signed-off-by: Eric Sandeen <sandeen@redhat.com> Looks ok, Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> /me wondered if we should just turn it into this, given that the error tags are sequentially increasing: static char *eflags[] = { [XFS_ERRTAG_NOERROR] = "noerror", [XFS_ERRTAG_IFLUSH_1] = "iflush1", }; BUILD_BUG_ON(sizeof(eflags) == sizeof(char *) * XFS_ERRTAG_MAX); and so on, but that can be another patch. --D > --- > > V2: add BUILD_BUG_ON > V3: dynamically size the array > > (I tested w/ dynamically sized but lost it in the V2 patch) > > diff --git a/include/xfs.h b/include/xfs.h > index 9f0f11b..a40ca0c 100644 > --- a/include/xfs.h > +++ b/include/xfs.h > @@ -64,6 +64,10 @@ extern int xfs_assert_largefile[sizeof(off_t)-8]; > #define __packed __attribute__((packed)) > #endif > > +#ifndef BUILD_BUG_ON > +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) > +#endif > + > #include <xfs/xfs_types.h> > #include <xfs/xfs_fs.h> > > diff --git a/io/inject.c b/io/inject.c > index 9d0cf62..fc3cf25 100644 > --- a/io/inject.c > +++ b/io/inject.c > @@ -30,7 +30,7 @@ error_tag(char *name) > static struct { > int tag; > char *name; > - } *e, eflags[XFS_ERRTAG_MAX + 1] = { > + } *e, eflags[] = { > { XFS_ERRTAG_NOERROR, "noerror" }, > { XFS_ERRTAG_IFLUSH_1, "iflush1" }, > { XFS_ERRTAG_IFLUSH_2, "iflush2" }, > @@ -62,10 +62,14 @@ error_tag(char *name) > { XFS_ERRTAG_DROP_WRITES, "drop_writes" }, > { XFS_ERRTAG_LOG_BAD_CRC, "log_bad_crc" }, > { XFS_ERRTAG_LOG_ITEM_PIN, "log_item_pin" }, > + { XFS_ERRTAG_BUF_LRU_REF, "buf_lru_ref" }, > { XFS_ERRTAG_MAX, NULL } > }; > int count; > > + /* If this fails make sure every tag is defined in the array above */ > + BUILD_BUG_ON(sizeof(eflags) != (XFS_ERRTAG_MAX + 1) * sizeof(*e)); > + > /* Search for a name */ > if (name) { > for (e = eflags; e->name; e++) > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-30 23:13 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-30 22:12 [PATCH] xfs_io: add buf_lru_ref tag to inject table Eric Sandeen 2017-11-30 22:23 ` Darrick J. Wong 2017-11-30 22:57 ` [PATCH V2] " Eric Sandeen 2017-11-30 23:04 ` [PATCH V3] " Eric Sandeen 2017-11-30 23:13 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).