xfs: refactors for xfsprogs
cover xfs: refactors for xfsprogs
Hi all,
This is a short patch series of libxfs refactors mostly done for the benefit of debugging purposes and fixing things in xfsprogs:
The first patch reports transaction reservation data via tracepoints; eventually xfs_db will grow a similar command so that one can compare transaction reservations to debug "log minimum size checks fail on freshly mkfs'd fs" problems.
Patches 2 & 3 move the xfs_fsop_geometry generator function into libsxfs so that xfsprogs can have common functions to generate the geometry from a superblock and print the geometry. Eventually I'll teach xfs_db, mkfs, and xfs_spaceman to query fs geometry (either directly or via ioctl) and then pretty print the same information.
--D
PATCH 1/3 xfs: trace log reservations at mount time
From: Darrick J. Wong <[email protected]>
At each mount, emit the transaction reservation type information via tracepoints. This makes it easier to compare the log reservation info calculated by the kernel and xfsprogs so that we can more easily diagnose minimum log size failures on freshly formatted filesystems.
--- fs/xfs/libxfs/xfs_log_rlimit.c | 2 +- fs/xfs/libxfs/xfs_shared.h | 3 +++ fs/xfs/xfs_trace.h | 26 ++++++++++++++++++++++++++ fs/xfs/xfs_trans.c | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_log_rlimit.c +1 -1
@@ -55,7 +55,7 @@ xfs_log_calc_max_attrsetm_res(* the maximum one in terms of the pre-calculated values which were done * at mount time. */ -STATIC void +void xfs_log_get_max_trans_res (struct xfs_mount *mp,struct xfs_trans_res *max_resp)
fs/xfs/libxfs/xfs_shared.h +3 -0
@@ -76,6 +76,9 @@ struct xfs_log_item_desc {int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes);int xfs_log_calc_minimum_size (struct xfs_mount *); +struct xfs_trans_res ; +void xfs_log_get_max_trans_res (struct xfs_mount *mp, +struct xfs_trans_res *max_resp);/* * Values for t_flags.
fs/xfs/xfs_trace.h +26 -0
@@ -3313,6 +3313,32 @@ DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);DEFINE_GETFSMAP_EVENT (xfs_getfsmap_high_key);DEFINE_GETFSMAP_EVENT (xfs_getfsmap_mapping); +TRACE_EVENT (xfs_trans_resv_calc, + TP_PROTO(struct xfs_mount *mp, unsigned int type, + struct xfs_trans_res *res), +TP_ARGS (mp, type, res), +TP_STRUCT__entry ( + __field(dev_t, dev) + __field(int, type) + __field(uint, logres) + __field(int, logcount) +__field (int, logflags) + ), +TP_fast_assign ( + __entry->dev = mp->m_super->s_dev; + __entry->type = type; + __entry->logres = res->tr_logres; + __entry->logcount = res->tr_logcount; + __entry->logflags = res->tr_logflags; + ), +TP_printk ("dev %d:%d type %d logres %u logcount %d flags 0x%x" , +MAJOR (__entry->dev),MINOR (__entry->dev), + __entry->type, + __entry->logres, + __entry->logcount, + __entry->logflags) +); +#endif /* _TRACE_XFS_H */ #undef TRACE_INCLUDE_PATH
fs/xfs/xfs_trans.c +22 -0
@@ -35,6 +35,27 @@kmem_zone_t *xfs_trans_zone;kmem_zone_t *xfs_log_item_desc_zone; +#if defined(CONFIG_TRACEPOINTS ) +static void +xfs_trans_trace_reservations ( +struct xfs_mount *mp) +{ +struct xfs_trans_res resv; +struct xfs_trans_res *res; +struct xfs_trans_res *end_res; +int i; + + res = (struct xfs_trans_res *)M_RES (mp); + end_res = (struct xfs_trans_res *)(M_RES (mp) +1 ); +for (i =0 ; res < end_res; i++, res++) +trace_xfs_trans_resv_calc (mp, i, res); +xfs_log_get_max_trans_res (mp, &resv); +trace_xfs_trans_resv_calc (mp,-1 , &resv); +} +#else +# define xfs_trans_trace_reservations (mp) +#endif +/* * Initialize the precomputed transaction reservation values * in the mount structure.
@@ -44,6 +65,7 @@ xfs_trans_init( struct xfs_mount *mp) {xfs_trans_resv_calc (mp,M_RES (mp)); +xfs_trans_trace_reservations (mp); }/*
Re: [PATCH 1/3] xfs: trace log reservations at mount time
Quoted 9 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
At each mount, emit the transaction reservation type information via tracepoints. This makes it easier to compare the log reservation info calculated by the kernel and xfsprogs so that we can more easily diagnose minimum log size failures on freshly formatted filesystems.
Signed-off-by Darrick J. Wong <[email protected]>---
Seems fine:
Quoted 116 lines
fs/xfs/libxfs/xfs_log_rlimit.c | 2 +- fs/xfs/libxfs/xfs_shared.h | 3 +++ fs/xfs/xfs_trace.h | 26 ++++++++++++++++++++++++++ fs/xfs/xfs_trans.c | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-)fs/xfs/libxfs/xfs_log_rlimit.c +1
-1@@ -55,7 +55,7 @@ xfs_log_calc_max_attrsetm_res(* the maximum one in terms of the pre-calculated values which were done * at mount time. */ -STATIC void +void xfs_log_get_max_trans_res (struct xfs_mount *mp,struct xfs_trans_res *max_resp)fs/xfs/libxfs/xfs_shared.h +3
-0@@ -76,6 +76,9 @@ struct xfs_log_item_desc {int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes);int xfs_log_calc_minimum_size (struct xfs_mount *); +struct xfs_trans_res ; +void xfs_log_get_max_trans_res (struct xfs_mount *mp, +struct xfs_trans_res *max_resp);/* * Values for t_flags. fs/xfs/xfs_trace.h +26
-0@@ -3313,6 +3313,32 @@ DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);DEFINE_GETFSMAP_EVENT (xfs_getfsmap_high_key);DEFINE_GETFSMAP_EVENT (xfs_getfsmap_mapping); +TRACE_EVENT (xfs_trans_resv_calc, + TP_PROTO(struct xfs_mount *mp, unsigned int type, + struct xfs_trans_res *res), +TP_ARGS (mp, type, res), +TP_STRUCT__entry ( + __field(dev_t, dev) + __field(int, type) + __field(uint, logres) + __field(int, logcount) +__field (int, logflags) + ), +TP_fast_assign ( + __entry->dev = mp->m_super->s_dev; + __entry->type = type; + __entry->logres = res->tr_logres; + __entry->logcount = res->tr_logcount; + __entry->logflags = res->tr_logflags; + ), +TP_printk ("dev %d:%d type %d logres %u logcount %d flags 0x%x" , +MAJOR (__entry->dev),MINOR (__entry->dev), + __entry->type, + __entry->logres, + __entry->logcount, + __entry->logflags) +); +#endif /* _TRACE_XFS_H */ #undef TRACE_INCLUDE_PATHfs/xfs/xfs_trans.c +22
-1@@ -35,6 +35,27 @@kmem_zone_t *xfs_trans_zone;kmem_zone_t *xfs_log_item_desc_zone; +#if defined(CONFIG_TRACEPOINTS ) +static void +xfs_trans_trace_reservations ( +struct xfs_mount *mp) +{ +struct xfs_trans_res resv; +struct xfs_trans_res *res; +struct xfs_trans_res *end_res; +int i; + + res = (struct xfs_trans_res *)M_RES (mp); + end_res = (struct xfs_trans_res *)(M_RES (mp) +1 ); +for (i =0 ; res < end_res; i++, res++) +trace_xfs_trans_resv_calc (mp, i, res); +xfs_log_get_max_trans_res (mp, &resv); +trace_xfs_trans_resv_calc (mp,-1 , &resv); +} +#else +# define xfs_trans_trace_reservations (mp) +#endif +/* * Initialize the precomputed transaction reservation values * in the mount structure. @@ -44,6 +65,7 @@ xfs_trans_init( struct xfs_mount *mp) {xfs_trans_resv_calc (mp,M_RES (mp)); +xfs_trans_trace_reservations (mp); }/* -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 xfs: hoist xfs_fs_geometry to libxfs
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Move xfs_fs_geometry to libxfs so that we can clean up the fs geometry reporting in xfsprogs.
--- fs/xfs/libxfs/xfs_sb.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_sb.h | 3 ++ fs/xfs/xfs_fsops.c | 77 ----------------------------------------------- fs/xfs/xfs_fsops.h | 1 - fs/xfs/xfs_ioctl.c | 1 + fs/xfs/xfs_ioctl32.c | 1 + 6 files changed, 84 insertions(+), 78 deletions(-)
fs/xfs/libxfs/xfs_sb.c +79 -0
@@ -40,6 +40,8 @@#include "xfs_rmap_btree.h" #include "xfs_bmap.h" #include "xfs_refcount_btree.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" /* * Physical superblock buffer manipulations. Shared with libxfs in userspace.
@@ -874,3 +876,80 @@ xfs_sync_sb(xfs_trans_set_sync (tp);return xfs_trans_commit (tp); } + +int +xfs_fs_geometry ( +xfs_mount_t *mp, +xfs_fsop_geom_t *geo, +int new_version) +{ + +memset (geo,0 ,sizeof (*geo)); + + geo->blocksize = mp->m_sb.sb_blocksize; + geo->rtextsize = mp->m_sb.sb_rextsize; + geo->agblocks = mp->m_sb.sb_agblocks; + geo->agcount = mp->m_sb.sb_agcount; + geo->logblocks = mp->m_sb.sb_logblocks; + geo->sectsize = mp->m_sb.sb_sectsize; + geo->inodesize = mp->m_sb.sb_inodesize; + geo->imaxpct = mp->m_sb.sb_imax_pct; + geo->datablocks = mp->m_sb.sb_dblocks; + geo->rtblocks = mp->m_sb.sb_rblocks; + geo->rtextents = mp->m_sb.sb_rextents; + geo->logstart = mp->m_sb.sb_logstart; +ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); +memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); +if (new_version >=2 ) { + geo->sunit = mp->m_sb.sb_unit; + geo->swidth = mp->m_sb.sb_width; + } +if (new_version >=3 ) { + geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 | + (xfs_sb_version_hasattr (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | + (xfs_sb_version_hasquota (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | + (xfs_sb_version_hasalign (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | + (xfs_sb_version_hasdalign (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | + (xfs_sb_version_hasextflgbit (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | + (xfs_sb_version_hassector (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | + (xfs_sb_version_hasasciici (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | + (xfs_sb_version_haslazysbcount (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | + (xfs_sb_version_hasattr2 (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | + (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | + (xfs_sb_version_hascrc (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | + (xfs_sb_version_hasftype (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | + (xfs_sb_version_hasfinobt (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | + (xfs_sb_version_hassparseinodes (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | + (xfs_sb_version_hasrmapbt (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | + (xfs_sb_version_hasreflink (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); + geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? + mp->m_sb.sb_logsectsize :BBSIZE ; + geo->rtsectsize = mp->m_sb.sb_blocksize; + geo->dirblocksize = mp->m_dir_geo->blksize; + } +if (new_version >=4 ) { + geo->flags |= + (xfs_sb_version_haslogv2 (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); + geo->logsunit = mp->m_sb.sb_logsunit; + } +return 0 ; +}
fs/xfs/libxfs/xfs_sb.h +3 -0
@@ -34,4 +34,7 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); +extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, +int nversion); +#endif /* __XFS_SB_H__ */
fs/xfs/xfs_fsops.c +0 -77
83 lines not on this page · raw message
fs/xfs/xfs_fsops.h +0 -1
@@ -18,7 +18,6 @@#ifndef __XFS_FSOPS_H__#define __XFS_FSOPS_H__ -extern int xfs_fs_geometry (xfs_mount_t *mp,xfs_fsop_geom_t *geo,int nversion);extern int xfs_growfs_data (xfs_mount_t *mp,xfs_growfs_data_t *in);extern int xfs_growfs_log (xfs_mount_t *mp,xfs_growfs_log_t *in);extern int xfs_fs_counts (xfs_mount_t *mp,xfs_fsop_counts_t *cnt);
fs/xfs/xfs_ioctl.c +1 -0
@@ -45,6 +45,7 @@#include <linux/fsmap.h> #include "xfs_fsmap.h" #include "scrub/xfs_scrub.h" +#include "xfs_sb.h" #include <linux/capability.h> #include <linux/cred.h>
fs/xfs/xfs_ioctl32.c +1 -0
@@ -37,6 +37,7 @@#include "xfs_ioctl.h" #include "xfs_ioctl32.h" #include "xfs_trace.h" +#include "xfs_sb.h" #define _NATIVE_IOC (cmd, type) \ _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
Re: [PATCH 2/3] xfs: hoist xfs_fs_geometry to libxfs
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Move
xfs_fs_geometryto libxfs so that we can clean up the fs geometry reporting in xfsprogs.Signed-off-by Darrick J. Wong <[email protected]>---
Looks like a straightforward move:
Quoted 244 lines
fs/xfs/libxfs/xfs_sb.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_sb.h | 3 ++ fs/xfs/xfs_fsops.c | 77 ----------------------------------------------- fs/xfs/xfs_fsops.h | 1 - fs/xfs/xfs_ioctl.c | 1 + fs/xfs/xfs_ioctl32.c | 1 + 6 files changed, 84 insertions(+), 78 deletions(-)fs/xfs/libxfs/xfs_sb.c +79
-0@@ -40,6 +40,8 @@#include "xfs_rmap_btree.h" #include "xfs_bmap.h" #include "xfs_refcount_btree.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" /* * Physical superblock buffer manipulations. Shared with libxfs in userspace. @@ -874,3 +876,80 @@ xfs_sync_sb(xfs_trans_set_sync (tp);return xfs_trans_commit (tp); } + +int +xfs_fs_geometry ( +xfs_mount_t *mp, +xfs_fsop_geom_t *geo, +int new_version) +{ + +memset (geo,0 ,sizeof (*geo)); + + geo->blocksize = mp->m_sb.sb_blocksize; + geo->rtextsize = mp->m_sb.sb_rextsize; + geo->agblocks = mp->m_sb.sb_agblocks; + geo->agcount = mp->m_sb.sb_agcount; + geo->logblocks = mp->m_sb.sb_logblocks; + geo->sectsize = mp->m_sb.sb_sectsize; + geo->inodesize = mp->m_sb.sb_inodesize; + geo->imaxpct = mp->m_sb.sb_imax_pct; + geo->datablocks = mp->m_sb.sb_dblocks; + geo->rtblocks = mp->m_sb.sb_rblocks; + geo->rtextents = mp->m_sb.sb_rextents; + geo->logstart = mp->m_sb.sb_logstart; +ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); +memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); +if (new_version >=2 ) { + geo->sunit = mp->m_sb.sb_unit; + geo->swidth = mp->m_sb.sb_width; + } +if (new_version >=3 ) { + geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 | + (xfs_sb_version_hasattr (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | + (xfs_sb_version_hasquota (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | + (xfs_sb_version_hasalign (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | + (xfs_sb_version_hasdalign (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | + (xfs_sb_version_hasextflgbit (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | + (xfs_sb_version_hassector (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | + (xfs_sb_version_hasasciici (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | + (xfs_sb_version_haslazysbcount (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | + (xfs_sb_version_hasattr2 (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | + (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | + (xfs_sb_version_hascrc (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | + (xfs_sb_version_hasftype (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | + (xfs_sb_version_hasfinobt (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | + (xfs_sb_version_hassparseinodes (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | + (xfs_sb_version_hasrmapbt (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | + (xfs_sb_version_hasreflink (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); + geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? + mp->m_sb.sb_logsectsize :BBSIZE ; + geo->rtsectsize = mp->m_sb.sb_blocksize; + geo->dirblocksize = mp->m_dir_geo->blksize; + } +if (new_version >=4 ) { + geo->flags |= + (xfs_sb_version_haslogv2 (&mp->m_sb) ? +XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); + geo->logsunit = mp->m_sb.sb_logsunit; + } +return 0 ; +}fs/xfs/libxfs/xfs_sb.h +3
-0@@ -34,4 +34,7 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); +extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, +int nversion); +#endif /* __XFS_SB_H__ */ fs/xfs/xfs_fsops.c +0
-77@@ -49,83 +49,6 @@* File system operations */ -int -xfs_fs_geometry ( -xfs_mount_t *mp, -xfs_fsop_geom_t *geo, -int new_version) -{ - -memset (geo,0 ,sizeof (*geo)); - - geo->blocksize = mp->m_sb.sb_blocksize; - geo->rtextsize = mp->m_sb.sb_rextsize; - geo->agblocks = mp->m_sb.sb_agblocks; - geo->agcount = mp->m_sb.sb_agcount; - geo->logblocks = mp->m_sb.sb_logblocks; - geo->sectsize = mp->m_sb.sb_sectsize; - geo->inodesize = mp->m_sb.sb_inodesize; - geo->imaxpct = mp->m_sb.sb_imax_pct; - geo->datablocks = mp->m_sb.sb_dblocks; - geo->rtblocks = mp->m_sb.sb_rblocks; - geo->rtextents = mp->m_sb.sb_rextents; - geo->logstart = mp->m_sb.sb_logstart; -ASSERT (sizeof (geo->uuid)==sizeof (mp->m_sb.sb_uuid)); -memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); -if (new_version >=2 ) { - geo->sunit = mp->m_sb.sb_unit; - geo->swidth = mp->m_sb.sb_width; - } -if (new_version >=3 ) { - geo->version =XFS_FSOP_GEOM_VERSION ; - geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | -XFS_FSOP_GEOM_FLAGS_DIRV2 | - (xfs_sb_version_hasattr (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | - (xfs_sb_version_hasquota (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | - (xfs_sb_version_hasalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | - (xfs_sb_version_hasdalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | - (xfs_sb_version_hasextflgbit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | - (xfs_sb_version_hassector (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | - (xfs_sb_version_hasasciici (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | - (xfs_sb_version_haslazysbcount (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | - (xfs_sb_version_hasattr2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | - (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | - (xfs_sb_version_hascrc (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | - (xfs_sb_version_hasftype (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | - (xfs_sb_version_hasfinobt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | - (xfs_sb_version_hassparseinodes (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | - (xfs_sb_version_hasrmapbt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | - (xfs_sb_version_hasreflink (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); - geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? - mp->m_sb.sb_logsectsize :BBSIZE ; - geo->rtsectsize = mp->m_sb.sb_blocksize; - geo->dirblocksize = mp->m_dir_geo->blksize; - } -if (new_version >=4 ) { - geo->flags |= - (xfs_sb_version_haslogv2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); - geo->logsunit = mp->m_sb.sb_logsunit; - } -return 0 ; -} -static struct xfs_buf * xfs_growfs_get_hdr_buf( struct xfs_mount *mp,fs/xfs/xfs_fsops.h +0
-1@@ -18,7 +18,6 @@#ifndef __XFS_FSOPS_H__#define __XFS_FSOPS_H__ -extern int xfs_fs_geometry (xfs_mount_t *mp,xfs_fsop_geom_t *geo,int nversion);extern int xfs_growfs_data (xfs_mount_t *mp,xfs_growfs_data_t *in);extern int xfs_growfs_log (xfs_mount_t *mp,xfs_growfs_log_t *in);extern int xfs_fs_counts (xfs_mount_t *mp,xfs_fsop_counts_t *cnt);fs/xfs/xfs_ioctl.c +1
-0@@ -45,6 +45,7 @@#include <linux/fsmap.h> #include "xfs_fsmap.h" #include "scrub/xfs_scrub.h" +#include "xfs_sb.h" #include <linux/capability.h> #include <linux/cred.h> fs/xfs/xfs_ioctl32.c +1
-1@@ -37,6 +37,7 @@#include "xfs_ioctl.h" #include "xfs_ioctl32.h" #include "xfs_trace.h" +#include "xfs_sb.h" #define _NATIVE_IOC (cmd, type) \ _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type)) --To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 xfs: refactor the geometry structure filling function
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Refactor the geometry structure filling function to use the superblock to fill the fields. While we're at it, make the function less indenty and use some whitespace to make the function easier to read.
--- fs/xfs/libxfs/xfs_sb.c | 167 ++++++++++++++++++++++++++++-------------------- fs/xfs/libxfs/xfs_sb.h | 5 + fs/xfs/xfs_ioctl.c | 4 + fs/xfs/xfs_ioctl32.c | 2 - 4 files changed, 103 insertions(+), 75 deletions(-)
fs/xfs/libxfs/xfs_sb.c +97 -70
@@ -879,77 +879,104 @@ xfs_sync_sb(int xfs_fs_geometry ( -xfs_mount_t *mp, -xfs_fsop_geom_t *geo, -int new_version) +struct xfs_sb *sbp, +struct xfs_fsop_geom *geo, +int struct_version) { +memset (geo,0 ,sizeof (struct xfs_fsop_geom )); + + geo->blocksize = sbp->sb_blocksize; + geo->rtextsize = sbp->sb_rextsize; + geo->agblocks = sbp->sb_agblocks; + geo->agcount = sbp->sb_agcount; + geo->logblocks = sbp->sb_logblocks; + geo->sectsize = sbp->sb_sectsize; + geo->inodesize = sbp->sb_inodesize; + geo->imaxpct = sbp->sb_imax_pct; + geo->datablocks = sbp->sb_dblocks; + geo->rtblocks = sbp->sb_rblocks; + geo->rtextents = sbp->sb_rextents; + geo->logstart = sbp->sb_logstart; +BUILD_BUG_ON (sizeof (geo->uuid) !=sizeof (sbp->sb_uuid)); +memcpy (geo->uuid, &sbp->sb_uuid,sizeof (sbp->sb_uuid)); + +if (struct_version <2 ) +return 0 ; + + geo->sunit = sbp->sb_unit; + geo->swidth = sbp->sb_width; + +if (struct_version <3 ) +return 0 ; + + geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 ; + + +if (xfs_sb_version_hasattr (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR ; + +if (xfs_sb_version_hasquota (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_QUOTA ; + +if (xfs_sb_version_hasalign (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_IALIGN ; + +if (xfs_sb_version_hasdalign (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_DALIGN ; + +if (xfs_sb_version_hasextflgbit (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_EXTFLG ; + +if (xfs_sb_version_hassector (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_SECTOR ; + +if (xfs_sb_version_hasasciici (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_DIRV2CI ; + +if (xfs_sb_version_haslazysbcount (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LAZYSB ; + +if (xfs_sb_version_hasattr2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR2 ; + +if (xfs_sb_version_hasprojid32bit (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_PROJID32 ; + +if (xfs_sb_version_hascrc (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_V5SB ; + +if (xfs_sb_version_hasftype (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_FTYPE ; + +if (xfs_sb_version_hasfinobt (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_FINOBT ; + +if (xfs_sb_version_hassparseinodes (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_SPINODES ; + +if (xfs_sb_version_hasrmapbt (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_RMAPBT ; + +if (xfs_sb_version_hasreflink (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_REFLINK ; + +if (xfs_sb_version_hassector (sbp)) + geo->logsectsize = sbp->sb_logsectsize; +else + geo->logsectsize =BBSIZE ; + + geo->rtsectsize = sbp->sb_blocksize; + geo->dirblocksize =1 << (sbp->sb_blocklog + sbp->sb_dirblklog); + +if (struct_version <3 ) +return 0 ; + +if (xfs_sb_version_haslogv2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LOGV2 ; + + geo->logsunit = sbp->sb_logsunit; -memset (geo,0 ,sizeof (*geo)); - - geo->blocksize = mp->m_sb.sb_blocksize; - geo->rtextsize = mp->m_sb.sb_rextsize; - geo->agblocks = mp->m_sb.sb_agblocks; - geo->agcount = mp->m_sb.sb_agcount; - geo->logblocks = mp->m_sb.sb_logblocks; - geo->sectsize = mp->m_sb.sb_sectsize; - geo->inodesize = mp->m_sb.sb_inodesize; - geo->imaxpct = mp->m_sb.sb_imax_pct; - geo->datablocks = mp->m_sb.sb_dblocks; - geo->rtblocks = mp->m_sb.sb_rblocks; - geo->rtextents = mp->m_sb.sb_rextents; - geo->logstart = mp->m_sb.sb_logstart; -ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); -memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); -if (new_version >=2 ) { - geo->sunit = mp->m_sb.sb_unit; - geo->swidth = mp->m_sb.sb_width; - } -if (new_version >=3 ) { - geo->version =XFS_FSOP_GEOM_VERSION ; - geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | -XFS_FSOP_GEOM_FLAGS_DIRV2 | - (xfs_sb_version_hasattr (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | - (xfs_sb_version_hasquota (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | - (xfs_sb_version_hasalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | - (xfs_sb_version_hasdalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | - (xfs_sb_version_hasextflgbit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | - (xfs_sb_version_hassector (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | - (xfs_sb_version_hasasciici (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | - (xfs_sb_version_haslazysbcount (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | - (xfs_sb_version_hasattr2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | - (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | - (xfs_sb_version_hascrc (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | - (xfs_sb_version_hasftype (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | - (xfs_sb_version_hasfinobt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | - (xfs_sb_version_hassparseinodes (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | - (xfs_sb_version_hasrmapbt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | - (xfs_sb_version_hasreflink (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); - geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? - mp->m_sb.sb_logsectsize :BBSIZE ; - geo->rtsectsize = mp->m_sb.sb_blocksize; - geo->dirblocksize = mp->m_dir_geo->blksize; - } -if (new_version >=4 ) { - geo->flags |= - (xfs_sb_version_haslogv2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); - geo->logsunit = mp->m_sb.sb_logsunit; - }return 0 ; }
fs/xfs/libxfs/xfs_sb.h +3 -2
@@ -34,7 +34,8 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); -extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, -int nversion); +#define XFS_FS_GEOM_MAX_STRUCT_VER (4) +extern int xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +int struct_version);#endif /* __XFS_SB_H__ */
fs/xfs/xfs_ioctl.c +2 -2
@@ -810,7 +810,7 @@ xfs_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;
@@ -832,7 +832,7 @@ xfs_ioc_fsgeometry(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,4 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,4 );if (error)return error;
fs/xfs/xfs_ioctl32.c +1 -1
@@ -67,7 +67,7 @@ xfs_compat_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;/* The 32-bit variant simply has some padding at the end */
Re: [PATCH 3/3] xfs: refactor the geometry structure filling function
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Refactor the geometry structure filling function to use the superblock to fill the fields. While we're at it, make the function less indenty and use some whitespace to make the function easier to read.
Signed-off-by Darrick J. Wong <[email protected]>---
Nice cleanup...
Quoted 22 lines
fs/xfs/libxfs/xfs_sb.c | 167 ++++++++++++++++++++++++++++-------------------- fs/xfs/libxfs/xfs_sb.h | 5 + fs/xfs/xfs_ioctl.c | 4 + fs/xfs/xfs_ioctl32.c | 2 - 4 files changed, 103 insertions(+), 75 deletions(-)fs/xfs/libxfs/xfs_sb.c +3
-3@@ -879,77 +879,104 @@ xfs_sync_sb(int xfs_fs_geometry ( -xfs_mount_t *mp, -xfs_fsop_geom_t *geo, -int new_version) +struct xfs_sb *sbp, +struct xfs_fsop_geom *geo, +int struct_version) {
...
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 916
Quoted 5 lines
fs/xfs/libxfs/xfs_sb.c +5
-0+ geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 ; + +
One whitespace line too many here..?
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 919
Quoted 3 lines
fs/xfs/libxfs/xfs_sb.c +3
-0+if (xfs_sb_version_hasattr (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR ; +
Obviously just a nit... but IMO the extra whitespace between each of these feature checks is a bit much. It actually reads cleaner to me to kill off the extra lines between them. Just my .02 though..
...
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 972
Quoted 4 lines
fs/xfs/libxfs/xfs_sb.c +4
-0+ + geo->rtsectsize = sbp->sb_blocksize; + geo->dirblocksize =1 << (sbp->sb_blocklog + sbp->sb_dirblklog); +
Slightly unfortunate that we have the geo abstraction and can't use it for a simple reporting case. Is there a larger (userspace?) reason mp was dropped as a parameter or was that just a cleanup? If the latter, perhaps we could continue to pass mp and create a local sbp pointer. If the former, then oh well, not a big deal. :P
Brian
Quoted 132 lines
fs/xfs/libxfs/xfs_sb.c +7
-67+if (struct_version <3 ) +return 0 ; + +if (xfs_sb_version_haslogv2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LOGV2 ; + + geo->logsunit = sbp->sb_logsunit; -memset (geo,0 ,sizeof (*geo)); - - geo->blocksize = mp->m_sb.sb_blocksize; - geo->rtextsize = mp->m_sb.sb_rextsize; - geo->agblocks = mp->m_sb.sb_agblocks; - geo->agcount = mp->m_sb.sb_agcount; - geo->logblocks = mp->m_sb.sb_logblocks; - geo->sectsize = mp->m_sb.sb_sectsize; - geo->inodesize = mp->m_sb.sb_inodesize; - geo->imaxpct = mp->m_sb.sb_imax_pct; - geo->datablocks = mp->m_sb.sb_dblocks; - geo->rtblocks = mp->m_sb.sb_rblocks; - geo->rtextents = mp->m_sb.sb_rextents; - geo->logstart = mp->m_sb.sb_logstart; -ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); -memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); -if (new_version >=2 ) { - geo->sunit = mp->m_sb.sb_unit; - geo->swidth = mp->m_sb.sb_width; - } -if (new_version >=3 ) { - geo->version =XFS_FSOP_GEOM_VERSION ; - geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | -XFS_FSOP_GEOM_FLAGS_DIRV2 | - (xfs_sb_version_hasattr (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | - (xfs_sb_version_hasquota (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | - (xfs_sb_version_hasalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | - (xfs_sb_version_hasdalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | - (xfs_sb_version_hasextflgbit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | - (xfs_sb_version_hassector (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | - (xfs_sb_version_hasasciici (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | - (xfs_sb_version_haslazysbcount (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | - (xfs_sb_version_hasattr2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | - (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | - (xfs_sb_version_hascrc (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | - (xfs_sb_version_hasftype (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | - (xfs_sb_version_hasfinobt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | - (xfs_sb_version_hassparseinodes (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | - (xfs_sb_version_hasrmapbt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | - (xfs_sb_version_hasreflink (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); - geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? - mp->m_sb.sb_logsectsize :BBSIZE ; - geo->rtsectsize = mp->m_sb.sb_blocksize; - geo->dirblocksize = mp->m_dir_geo->blksize; - } -if (new_version >=4 ) { - geo->flags |= - (xfs_sb_version_haslogv2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); - geo->logsunit = mp->m_sb.sb_logsunit; - }return 0 ; }fs/xfs/libxfs/xfs_sb.h +3
-2@@ -34,7 +34,8 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); -extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, -int nversion); +#define XFS_FS_GEOM_MAX_STRUCT_VER (4) +extern int xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +int struct_version);#endif /* __XFS_SB_H__ */ fs/xfs/xfs_ioctl.c +2
-2@@ -810,7 +810,7 @@ xfs_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;@@ -832,7 +832,7 @@ xfs_ioc_fsgeometry(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,4 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,4 );if (error)return error;fs/xfs/xfs_ioctl32.c +1
-2@@ -67,7 +67,7 @@ xfs_compat_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;/* The 32-bit variant simply has some padding at the end */ --To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] xfs: refactor the geometry structure filling function
Quoted 35 lines · Brian Foster
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Refactor the geometry structure filling function to use the superblock to fill the fields. While we're at it, make the function less indenty and use some whitespace to make the function easier to read.
Signed-off-by Darrick J. Wong <[email protected]>---
Nice cleanup...
Quoted 22 lines
fs/xfs/libxfs/xfs_sb.c | 167 ++++++++++++++++++++++++++++-------------------- fs/xfs/libxfs/xfs_sb.h | 5 + fs/xfs/xfs_ioctl.c | 4 + fs/xfs/xfs_ioctl32.c | 2 - 4 files changed, 103 insertions(+), 75 deletions(-)fs/xfs/libxfs/xfs_sb.c +3
-3@@ -879,77 +879,104 @@ xfs_sync_sb(int xfs_fs_geometry ( -xfs_mount_t *mp, -xfs_fsop_geom_t *geo, -int new_version) +struct xfs_sb *sbp, +struct xfs_fsop_geom *geo, +int struct_version) {...
Quoted 7 lines
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 916
Quoted 5 lines
fs/xfs/libxfs/xfs_sb.c +5
-0+ geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 ; + +One whitespace line too many here..?
Yep, fixed.
Quoted 7 lines
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 919
Quoted 3 lines
fs/xfs/libxfs/xfs_sb.c +3
-0+if (xfs_sb_version_hasattr (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR ; +Obviously just a nit... but IMO the extra whitespace between each of these feature checks is a bit much. It actually reads cleaner to me to kill off the extra lines between them. Just my .02 though..
Yeah, I suppose since we proceed linearly through that section without branching outside the block that it needn't the additional whitespace. Fixed.
Quoted 11 lines
...
fs/xfs/libxfs/xfs_sb.c xfs_sync_sb( · line 972
Quoted 4 lines
fs/xfs/libxfs/xfs_sb.c +4
-0+ + geo->rtsectsize = sbp->sb_blocksize; + geo->dirblocksize =1 << (sbp->sb_blocklog + sbp->sb_dirblklog); +Slightly unfortunate that we have the geo abstraction and can't use it for a simple reporting case. Is there a larger (userspace?) reason mp was dropped as a parameter or was that just a cleanup? If the latter, perhaps we could continue to pass mp and create a local sbp pointer. If the former, then oh well, not a big deal. :P
At the point that mkfs wants to call this function, it has a fully built xfs_sb ready to go, but it hasn't called libxfs_init. Therefore, mp->m_dir_geo hasn't yet been built, and I wanted to preserve the behavior that mkfs can spit out the geometry even if libxfs initialization fails for some other reason.
That said, there isn't any reason why I couldn't just make this a helper in xfs_da_format.h and refactor all the opencoded instances:
/* Number of bytes in a directory block. */
static inline unsigned int xfs_dir2_dirblock_bytes(struct xfs_sb *sbp)
{
return 1 << (sbp->sb_blocklog + sbp->sb_dirblklog);
}--D
Quoted 138 lines
Brian
Quoted 129 lines
fs/xfs/libxfs/xfs_sb.c +7
-67+if (struct_version <3 ) +return 0 ; + +if (xfs_sb_version_haslogv2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LOGV2 ; + + geo->logsunit = sbp->sb_logsunit; -memset (geo,0 ,sizeof (*geo)); - - geo->blocksize = mp->m_sb.sb_blocksize; - geo->rtextsize = mp->m_sb.sb_rextsize; - geo->agblocks = mp->m_sb.sb_agblocks; - geo->agcount = mp->m_sb.sb_agcount; - geo->logblocks = mp->m_sb.sb_logblocks; - geo->sectsize = mp->m_sb.sb_sectsize; - geo->inodesize = mp->m_sb.sb_inodesize; - geo->imaxpct = mp->m_sb.sb_imax_pct; - geo->datablocks = mp->m_sb.sb_dblocks; - geo->rtblocks = mp->m_sb.sb_rblocks; - geo->rtextents = mp->m_sb.sb_rextents; - geo->logstart = mp->m_sb.sb_logstart; -ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); -memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); -if (new_version >=2 ) { - geo->sunit = mp->m_sb.sb_unit; - geo->swidth = mp->m_sb.sb_width; - } -if (new_version >=3 ) { - geo->version =XFS_FSOP_GEOM_VERSION ; - geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | -XFS_FSOP_GEOM_FLAGS_DIRV2 | - (xfs_sb_version_hasattr (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | - (xfs_sb_version_hasquota (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | - (xfs_sb_version_hasalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | - (xfs_sb_version_hasdalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | - (xfs_sb_version_hasextflgbit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | - (xfs_sb_version_hassector (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | - (xfs_sb_version_hasasciici (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | - (xfs_sb_version_haslazysbcount (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | - (xfs_sb_version_hasattr2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | - (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | - (xfs_sb_version_hascrc (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | - (xfs_sb_version_hasftype (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | - (xfs_sb_version_hasfinobt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | - (xfs_sb_version_hassparseinodes (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | - (xfs_sb_version_hasrmapbt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | - (xfs_sb_version_hasreflink (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); - geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? - mp->m_sb.sb_logsectsize :BBSIZE ; - geo->rtsectsize = mp->m_sb.sb_blocksize; - geo->dirblocksize = mp->m_dir_geo->blksize; - } -if (new_version >=4 ) { - geo->flags |= - (xfs_sb_version_haslogv2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); - geo->logsunit = mp->m_sb.sb_logsunit; - }return 0 ; }fs/xfs/libxfs/xfs_sb.h +3
-2@@ -34,7 +34,8 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); -extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, -int nversion); +#define XFS_FS_GEOM_MAX_STRUCT_VER (4) +extern int xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +int struct_version);#endif /* __XFS_SB_H__ */ fs/xfs/xfs_ioctl.c +2
-2@@ -810,7 +810,7 @@ xfs_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;@@ -832,7 +832,7 @@ xfs_ioc_fsgeometry(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,4 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,4 );if (error)return error;fs/xfs/xfs_ioctl32.c +1
-2@@ -67,7 +67,7 @@ xfs_compat_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;/* The 32-bit variant simply has some padding at the end */ --Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/3 xfs: refactor the geometry structure filling function
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Refactor the geometry structure filling function to use the superblock to fill the fields. While we're at it, make the function less indenty and use some whitespace to make the function easier to read.
---
v2: fix whitespacing, refactor the directory block size calculation
--- fs/xfs/libxfs/xfs_da_format.h | 6 ++ fs/xfs/libxfs/xfs_dir2.c | 5 + fs/xfs/libxfs/xfs_sb.c | 148 ++++++++++++++++++++++------------------- fs/xfs/libxfs/xfs_sb.h | 5 + fs/xfs/xfs_ioctl.c | 4 + fs/xfs/xfs_ioctl32.c | 2 - 6 files changed, 92 insertions(+), 78 deletions(-)
fs/xfs/libxfs/xfs_da_format.h +6 -0
@@ -875,4 +875,10 @@ struct xfs_attr3_rmt_hdr { ((bufsize) - (xfs_sb_version_hascrc (&(mp)->m_sb) ? \sizeof (struct xfs_attr3_rmt_hdr ) :0 )) +/* Number of bytes in a directory block. */ +static inline unsigned int xfs_dir2_dirblock_bytes (struct xfs_sb *sbp) +{ +return 1 << (sbp->sb_blocklog + sbp->sb_dirblklog); +} +#endif /* __XFS_DA_FORMAT_H__ */
fs/xfs/libxfs/xfs_dir2.c +2 -3
@@ -119,8 +119,7 @@ xfs_da_mount(ASSERT (mp->m_sb.sb_versionnum &XFS_SB_VERSION_DIRV2BIT ); -ASSERT ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <= -XFS_MAX_BLOCKSIZE ); +ASSERT (xfs_dir2_dirblock_bytes (&mp->m_sb) <=XFS_MAX_BLOCKSIZE ); mp->m_dir_inode_ops =xfs_dir_get_ops (mp,NULL ); mp->m_nondir_inode_ops =xfs_nondir_get_ops (mp,NULL );
@@ -140,7 +139,7 @@ xfs_da_mount( dageo = mp->m_dir_geo; dageo->blklog = mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog; dageo->fsblog = mp->m_sb.sb_blocklog; - dageo->blksize =1 << dageo->blklog; + dageo->blksize =xfs_dir2_dirblock_bytes (&mp->m_sb); dageo->fsbcount =1 << mp->m_sb.sb_dirblklog;/*
fs/xfs/libxfs/xfs_sb.c +78 -70
155 lines not on this page · raw message
fs/xfs/libxfs/xfs_sb.h +3 -2
@@ -34,7 +34,8 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); -extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, -int nversion); +#define XFS_FS_GEOM_MAX_STRUCT_VER (4) +extern int xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +int struct_version);#endif /* __XFS_SB_H__ */
fs/xfs/xfs_ioctl.c +2 -2
@@ -810,7 +810,7 @@ xfs_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;
@@ -832,7 +832,7 @@ xfs_ioc_fsgeometry(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,4 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,4 );if (error)return error;
fs/xfs/xfs_ioctl32.c +1 -1
@@ -67,7 +67,7 @@ xfs_compat_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;/* The 32-bit variant simply has some padding at the end */
Re: [PATCH v2 3/3] xfs: refactor the geometry structure filling function
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Refactor the geometry structure filling function to use the superblock to fill the fields. While we're at it, make the function less indenty and use some whitespace to make the function easier to read.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: fix whitespacing, refactor the directory block size calculation
---
Quoted 260 lines
fs/xfs/libxfs/xfs_da_format.h | 6 ++ fs/xfs/libxfs/xfs_dir2.c | 5 + fs/xfs/libxfs/xfs_sb.c | 148 ++++++++++++++++++++++------------------- fs/xfs/libxfs/xfs_sb.h | 5 + fs/xfs/xfs_ioctl.c | 4 + fs/xfs/xfs_ioctl32.c | 2 - 6 files changed, 92 insertions(+), 78 deletions(-)fs/xfs/libxfs/xfs_da_format.h +6
-0@@ -875,4 +875,10 @@ struct xfs_attr3_rmt_hdr { ((bufsize) - (xfs_sb_version_hascrc (&(mp)->m_sb) ? \sizeof (struct xfs_attr3_rmt_hdr ) :0 )) +/* Number of bytes in a directory block. */ +static inline unsigned int xfs_dir2_dirblock_bytes (struct xfs_sb *sbp) +{ +return 1 << (sbp->sb_blocklog + sbp->sb_dirblklog); +} +#endif /* __XFS_DA_FORMAT_H__ */ fs/xfs/libxfs/xfs_dir2.c +2
-3@@ -119,8 +119,7 @@ xfs_da_mount(ASSERT (mp->m_sb.sb_versionnum &XFS_SB_VERSION_DIRV2BIT ); -ASSERT ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <= -XFS_MAX_BLOCKSIZE ); +ASSERT (xfs_dir2_dirblock_bytes (&mp->m_sb) <=XFS_MAX_BLOCKSIZE ); mp->m_dir_inode_ops =xfs_dir_get_ops (mp,NULL ); mp->m_nondir_inode_ops =xfs_nondir_get_ops (mp,NULL );@@ -140,7 +139,7 @@ xfs_da_mount( dageo = mp->m_dir_geo; dageo->blklog = mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog; dageo->fsblog = mp->m_sb.sb_blocklog; - dageo->blksize =1 << dageo->blklog; + dageo->blksize =xfs_dir2_dirblock_bytes (&mp->m_sb); dageo->fsbcount =1 << mp->m_sb.sb_dirblklog;/* fs/xfs/libxfs/xfs_sb.c +78
-70@@ -879,77 +879,85 @@ xfs_sync_sb(int xfs_fs_geometry ( -xfs_mount_t *mp, -xfs_fsop_geom_t *geo, -int new_version) +struct xfs_sb *sbp, +struct xfs_fsop_geom *geo, +int struct_version) { +memset (geo,0 ,sizeof (struct xfs_fsop_geom )); + + geo->blocksize = sbp->sb_blocksize; + geo->rtextsize = sbp->sb_rextsize; + geo->agblocks = sbp->sb_agblocks; + geo->agcount = sbp->sb_agcount; + geo->logblocks = sbp->sb_logblocks; + geo->sectsize = sbp->sb_sectsize; + geo->inodesize = sbp->sb_inodesize; + geo->imaxpct = sbp->sb_imax_pct; + geo->datablocks = sbp->sb_dblocks; + geo->rtblocks = sbp->sb_rblocks; + geo->rtextents = sbp->sb_rextents; + geo->logstart = sbp->sb_logstart; +BUILD_BUG_ON (sizeof (geo->uuid) !=sizeof (sbp->sb_uuid)); +memcpy (geo->uuid, &sbp->sb_uuid,sizeof (sbp->sb_uuid)); + +if (struct_version <2 ) +return 0 ; + + geo->sunit = sbp->sb_unit; + geo->swidth = sbp->sb_width; + +if (struct_version <3 ) +return 0 ; + + geo->version =XFS_FSOP_GEOM_VERSION ; + geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | +XFS_FSOP_GEOM_FLAGS_DIRV2 ; +if (xfs_sb_version_hasattr (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR ; +if (xfs_sb_version_hasquota (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_QUOTA ; +if (xfs_sb_version_hasalign (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_IALIGN ; +if (xfs_sb_version_hasdalign (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_DALIGN ; +if (xfs_sb_version_hasextflgbit (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_EXTFLG ; +if (xfs_sb_version_hassector (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_SECTOR ; +if (xfs_sb_version_hasasciici (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_DIRV2CI ; +if (xfs_sb_version_haslazysbcount (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LAZYSB ; +if (xfs_sb_version_hasattr2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR2 ; +if (xfs_sb_version_hasprojid32bit (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_PROJID32 ; +if (xfs_sb_version_hascrc (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_V5SB ; +if (xfs_sb_version_hasftype (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_FTYPE ; +if (xfs_sb_version_hasfinobt (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_FINOBT ; +if (xfs_sb_version_hassparseinodes (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_SPINODES ; +if (xfs_sb_version_hasrmapbt (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_RMAPBT ; +if (xfs_sb_version_hasreflink (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_REFLINK ; +if (xfs_sb_version_hassector (sbp)) + geo->logsectsize = sbp->sb_logsectsize; +else + geo->logsectsize =BBSIZE ; + geo->rtsectsize = sbp->sb_blocksize; + geo->dirblocksize =xfs_dir2_dirblock_bytes (sbp); + +if (struct_version <3 ) +return 0 ; + +if (xfs_sb_version_haslogv2 (sbp)) + geo->flags |=XFS_FSOP_GEOM_FLAGS_LOGV2 ; + + geo->logsunit = sbp->sb_logsunit; -memset (geo,0 ,sizeof (*geo)); - - geo->blocksize = mp->m_sb.sb_blocksize; - geo->rtextsize = mp->m_sb.sb_rextsize; - geo->agblocks = mp->m_sb.sb_agblocks; - geo->agcount = mp->m_sb.sb_agcount; - geo->logblocks = mp->m_sb.sb_logblocks; - geo->sectsize = mp->m_sb.sb_sectsize; - geo->inodesize = mp->m_sb.sb_inodesize; - geo->imaxpct = mp->m_sb.sb_imax_pct; - geo->datablocks = mp->m_sb.sb_dblocks; - geo->rtblocks = mp->m_sb.sb_rblocks; - geo->rtextents = mp->m_sb.sb_rextents; - geo->logstart = mp->m_sb.sb_logstart; -ASSERT (sizeof (geo->uuid) ==sizeof (mp->m_sb.sb_uuid)); -memcpy (geo->uuid, &mp->m_sb.sb_uuid,sizeof (mp->m_sb.sb_uuid)); -if (new_version >=2 ) { - geo->sunit = mp->m_sb.sb_unit; - geo->swidth = mp->m_sb.sb_width; - } -if (new_version >=3 ) { - geo->version =XFS_FSOP_GEOM_VERSION ; - geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK | -XFS_FSOP_GEOM_FLAGS_DIRV2 | - (xfs_sb_version_hasattr (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR :0 ) | - (xfs_sb_version_hasquota (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_QUOTA :0 ) | - (xfs_sb_version_hasalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_IALIGN :0 ) | - (xfs_sb_version_hasdalign (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DALIGN :0 ) | - (xfs_sb_version_hasextflgbit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_EXTFLG :0 ) | - (xfs_sb_version_hassector (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SECTOR :0 ) | - (xfs_sb_version_hasasciici (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_DIRV2CI :0 ) | - (xfs_sb_version_haslazysbcount (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LAZYSB :0 ) | - (xfs_sb_version_hasattr2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_ATTR2 :0 ) | - (xfs_sb_version_hasprojid32bit (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_PROJID32 :0 ) | - (xfs_sb_version_hascrc (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_V5SB :0 ) | - (xfs_sb_version_hasftype (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FTYPE :0 ) | - (xfs_sb_version_hasfinobt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_FINOBT :0 ) | - (xfs_sb_version_hassparseinodes (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_SPINODES :0 ) | - (xfs_sb_version_hasrmapbt (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_RMAPBT :0 ) | - (xfs_sb_version_hasreflink (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_REFLINK :0 ); - geo->logsectsize =xfs_sb_version_hassector (&mp->m_sb) ? - mp->m_sb.sb_logsectsize :BBSIZE ; - geo->rtsectsize = mp->m_sb.sb_blocksize; - geo->dirblocksize = mp->m_dir_geo->blksize; - } -if (new_version >=4 ) { - geo->flags |= - (xfs_sb_version_haslogv2 (&mp->m_sb) ? -XFS_FSOP_GEOM_FLAGS_LOGV2 :0 ); - geo->logsunit = mp->m_sb.sb_logsunit; - }return 0 ; }fs/xfs/libxfs/xfs_sb.h +3
-2@@ -34,7 +34,8 @@ extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); -extern int xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo, -int nversion); +#define XFS_FS_GEOM_MAX_STRUCT_VER (4) +extern int xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +int struct_version);#endif /* __XFS_SB_H__ */ fs/xfs/xfs_ioctl.c +2
-2@@ -810,7 +810,7 @@ xfs_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;@@ -832,7 +832,7 @@ xfs_ioc_fsgeometry(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,4 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,4 );if (error)return error;fs/xfs/xfs_ioctl32.c +1
-2@@ -67,7 +67,7 @@ xfs_compat_ioc_fsgeometry_v1(xfs_fsop_geom_t fsgeo;int error; - error =xfs_fs_geometry (mp, &fsgeo,3 ); + error =xfs_fs_geometry (&mp->m_sb, &fsgeo,3 );if (error)return error;/* The 32-bit variant simply has some padding at the end */ --To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html