From 0993ba6915f7f6529526eb1672a345a10b86a02d Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Wed, 2 Jun 2010 13:19:33 +0400 Subject: [PATCH] b=22864 'som_preview' mount option for lustre client. i=adilger i=tappro a mount option 'som_preview' is added on the client side to send SOM_CONNECT flag only if specified. --- lustre/liblustre/super.c | 6 +++--- lustre/llite/llite_internal.h | 1 + lustre/llite/llite_lib.c | 16 +++++++++++++--- lustre/tests/sanity.sh | 10 +++++++--- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 969d633..caa4a6e 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -1999,8 +1999,8 @@ llu_fsswop_mount(const char *source, ocd.ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_VERSION | OBD_CONNECT_FID | OBD_CONNECT_AT | - OBD_CONNECT_VBR | OBD_CONNECT_SOM | - OBD_CONNECT_FULL20; + OBD_CONNECT_VBR | OBD_CONNECT_FULL20; + #ifdef LIBLUSTRE_POSIX_ACL ocd.ocd_connect_flags |= OBD_CONNECT_ACL; #endif @@ -2037,7 +2037,7 @@ llu_fsswop_mount(const char *source, ocd.ocd_connect_flags = OBD_CONNECT_SRVLOCK | OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_FID | OBD_CONNECT_AT | - OBD_CONNECT_SOM | OBD_CONNECT_FULL20; + OBD_CONNECT_FULL20; ocd.ocd_version = LUSTRE_VERSION_CODE; err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, &ocd, NULL); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index cb9f9ac..2f0ae29 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -311,6 +311,7 @@ enum stats_track_type { #define LL_SBI_LOCALFLOCK 0x200 /* Local flocks support by kernel */ #define LL_SBI_LRU_RESIZE 0x400 /* lru resize support */ #define LL_SBI_LAZYSTATFS 0x800 /* lazystatfs mount option */ +#define LL_SBI_SOM_PREVIEW 0x1000 /* SOM preview mount option */ /* default value for ll_sb_info->contention_time */ #define SBI_DEFAULT_CONTENTION_SECONDS 60 diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 8c0461f..66a57ee 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -198,8 +198,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_OSS_CAPA | OBD_CONNECT_CANCELSET| OBD_CONNECT_FID | OBD_CONNECT_AT | OBD_CONNECT_LOV_V3 | OBD_CONNECT_RMT_CLIENT | - OBD_CONNECT_VBR | OBD_CONNECT_SOM | - OBD_CONNECT_FULL20; + OBD_CONNECT_VBR | OBD_CONNECT_FULL20; + + if (sbi->ll_flags & LL_SBI_SOM_PREVIEW) + data->ocd_connect_flags |= OBD_CONNECT_SOM; #ifdef HAVE_LRU_RESIZE_SUPPORT if (sbi->ll_flags & LL_SBI_LRU_RESIZE) @@ -340,7 +342,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_SRVLOCK | OBD_CONNECT_TRUNCLOCK| OBD_CONNECT_AT | OBD_CONNECT_RMT_CLIENT | OBD_CONNECT_OSS_CAPA | OBD_CONNECT_VBR| - OBD_CONNECT_SOM | OBD_CONNECT_FULL20; + OBD_CONNECT_FULL20; + + if (sbi->ll_flags & LL_SBI_SOM_PREVIEW) + data->ocd_connect_flags |= OBD_CONNECT_SOM; if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_CKSUM)) { /* OBD_CONNECT_CKSUM should always be set, even if checksums are @@ -753,6 +758,11 @@ static int ll_options(char *options, int *flags) *flags &= ~tmp; goto next; } + tmp = ll_set_opt("som_preview", s1, LL_SBI_SOM_PREVIEW); + if (tmp) { + *flags |= tmp; + goto next; + } LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n", s1); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6b7d093..e4e55e0 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6351,9 +6351,11 @@ som_mode_switch() { if [ x$som = x"enabled" ]; then [ $((gl2 - gl1)) -gt 0 ] && error "no glimpse RPC is expected" + MOUNTOPT=`echo $MOUNTOPT | sed 's/som_preview//g'` do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=disabled" else [ $((gl2 - gl1)) -gt 0 ] || error "some glimpse RPC is expected" + MOUNTOPT="$MOUNTOPT,som_preview" do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=enabled" fi @@ -6365,8 +6367,9 @@ som_mode_switch() { } test_132() { #1028, SOM - local num=$(get_mds_dir $DIR) - local mymds=mds${num} + local num=$(get_mds_dir $DIR) + local mymds=mds${num} + local MOUNTOPT_SAVE=$MOUNTOPT dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null cancel_lru_locks osc @@ -6396,8 +6399,9 @@ test_132() { #1028, SOM gl1=$(get_ost_param "ldlm_glimpse_enqueue") stat $DIR/$tfile >/dev/null gl2=$(get_ost_param "ldlm_glimpse_enqueue") - echo "SOM is "$som2", "$((gl2 - gl1))" glimpse RPC occured" + echo "====> SOM is "$som2", "$((gl2 - gl1))" glimpse RPC occured" som_mode_switch $som2 $gl1 $gl2 + MOUNTOPT=$MOUNTOPT_SAVE } run_test 132 "som avoids glimpse rpc" -- 1.8.3.1