Several style fixes in DoM tests and code from review debts.
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: I4ee011025a008cfa474db3d1c2f86b2c250483c4
Reviewed-on: https://review.whamcloud.com/29681
Tested-by: Jenkins
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
cl_lvb2attr(attr, &loi->loi_lvb);
/* DoM component size can be bigger than stripe size after
- * client's setattr RPC, so do not count anything beyound
+ * client's setattr RPC, so do not count anything beyond
* component end. Alternatively, check that limit on server
* and do not allow size overflow there. */
if (attr->cat_size > lle->lle_extent.e_end)
static int mdc_stats_seq_show(struct seq_file *seq, void *v)
{
- struct timeval now;
+ struct timespec64 now;
struct obd_device *dev = seq->private;
struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
- do_gettimeofday(&now);
+ ktime_get_real_ts64(&now);
- seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
- now.tv_sec, now.tv_usec);
+ seq_printf(seq, "snapshot_time: %lld.%09lu (secs.nsecs)\n",
+ (s64)now.tv_sec, now.tv_nsec);
seq_printf(seq, "lockless_write_bytes\t\t%llu\n",
stats->os_lockless_writes);
seq_printf(seq, "lockless_read_bytes\t\t%llu\n",
.o_del_conn = client_import_del_conn,
.o_connect = client_connect_import,
.o_reconnect = osc_reconnect,
- .o_disconnect = osc_disconnect,
+ .o_disconnect = osc_disconnect,
.o_iocontrol = mdc_iocontrol,
.o_set_info_async = mdc_set_info_async,
.o_statfs = mdc_statfs,
if (IS_ERR(mo))
GOTO(out_unlock, rc = PTR_ERR(mo));
+ /* Shouldn't happen on dirs */
+ if (S_ISDIR(lu_object_attr(&mo->mot_obj))) {
+ rc = -EPERM;
+ CERROR("%s: Truncate on dir "DFID": rc = %d\n",
+ exp->exp_obd->obd_name, PFID(&tsi->tsi_fid), rc);
+ GOTO(out_put, rc);
+ }
+
mdt_dom_write_lock(mo);
if (!mdt_object_exists(mo))
GOTO(out_put, rc = -ENOENT);
+
dob = mdt_obj2dt(mo);
la_from_obdo(la, oa, OBD_MD_FLMTIME | OBD_MD_FLATIME | OBD_MD_FLCTIME);
}
EXPORT_SYMBOL(tgt_grant_commit_cb_add);
-
/**
* Show estimate of total amount of dirty data on clients.
*
return count;
}
EXPORT_SYMBOL(tgt_grant_compat_disable_seq_write);
-
if [ "$dom_upgrade" != "no" ]; then
echo "Check DoM file can be created"
- $SETSTRIPE -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
+ $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
error_noexit "Verify DoM creation"
return 1
}
- [ $($GETSTRIPE -L $tmp/mnt/lustre/dom) == 100 ] || {
+ [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == 100 ] || {
error_noexit "Verify a DoM file"
return 1
}
}
run_test 3 "Truncate over DoM size on different nodes"
-# TODO: tests below are from sanityn but their adapted version should be
-# put here: 31 32 34 71 75
-
-test_sn16() {
+test_fsx() {
local file1=$DIR1/$tfile
local file2=$DIR2/$tfile
touch $file1
- fsx -c 50 -p 1 -N 1000 -l $(($DOM_SIZE*2)) -S 0 -d -d $file1 $file2
+ fsx -c 50 -p 100 -N 1000 -l $((DOM_SIZE*2)) -S 0 -d -d $file1 $file2
}
-run_test sn16 "$FSXNUM iterations of dual-mount fsx"
+run_test fsx "Dual-mount fsx with DoM files"
test_sanity()
{
mkdir -p $DIR/$tdir
# basic checks for DoM component creation
- $SETSTRIPE -E 1024K -E 1024K -L mdt $dom 2>/dev/null &&
+ $LFS setstripe -E 1024K -E 1024K -L mdt $dom 2>/dev/null &&
error "Can set MDT layout to non-first entry"
- $SETSTRIPE -E 1024K -L mdt -E 1024K -L mdt $dom 2>/dev/null &&
+ $LFS setstripe -E 1024K -L mdt -E 1024K -L mdt $dom 2>/dev/null &&
error "Can define multiple entries as MDT layout"
- $SETSTRIPE -E 1M -L mdt $dom ||
+ $LFS setstripe -E 1M -L mdt $dom ||
error "Can't create DoM layout"
- [ $($GETSTRIPE -L $dom) == 100 ] || error "bad pattern"
- [ $($GETSTRIPE -c $dom) == 0 ] || error "bad stripe count"
- [ $($GETSTRIPE -S $dom) == 1048576 ] || error "bad stripe size"
+ [ $($LFS getstripe -L $dom) == 100 ] || error "bad pattern"
+ [ $($LFS getstripe -c $dom) == 0 ] || error "bad stripe count"
+ [ $($LFS getstripe -S $dom) == 1048576 ] || error "bad stripe size"
local mdtidx=$($GETSTRIPE -M $dom)
local mdtname=MDT$(printf %04x $mdtidx)
fi
# combined striping
- $SETSTRIPE -E 1024K -L mdt -E EOF $dom ||
+ $LFS setstripe -E 1024K -L mdt -E EOF $dom ||
error "Can't create DoM + OST striping"
dd if=/dev/urandom of=$tmp bs=1024 count=2000
local max_size=1048576
mkdir -p $DIR/$tdir
- $SETSTRIPE -E $max_size -L mdt $dom
+ $LFS setstripe -E $max_size -L mdt $dom
# truncate over the limit
$TRUNCATE $dom $(($max_size + 1)) &&
test_270c() {
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt $DIR/$tdir
+ $LFS setstripe -E 1024K -L mdt $DIR/$tdir
# check files inherit DoM EA
touch $DIR/$tdir/first
[ $($GETSTRIPE -L $DIR/$tdir/first) == 100 ] ||
error "bad pattern"
- [ $($GETSTRIPE -c $DIR/$tdir/first) == 0 ] ||
+ [ $($LFS getstripe -c $DIR/$tdir/first) == 0 ] ||
error "bad stripe count"
- [ $($GETSTRIPE -S $DIR/$tdir/first) == 1048576 ] ||
+ [ $($LFS getstripe -S $DIR/$tdir/first) == 1048576 ] ||
error "bad stripe size"
# check directory inherits DoM EA and uses it as default
mkdir $DIR/$tdir/subdir
touch $DIR/$tdir/subdir/second
- [ $($GETSTRIPE -L $DIR/$tdir/subdir/second) == 100 ] ||
+ [ $($LFS getstripe -L $DIR/$tdir/subdir/second) == 100 ] ||
error "bad pattern in sub-directory"
- [ $($GETSTRIPE -c $DIR/$tdir/subdir/second) == 0 ] ||
+ [ $($LFS getstripe -c $DIR/$tdir/subdir/second) == 0 ] ||
error "bad stripe count in sub-directory"
- [ $($GETSTRIPE -S $DIR/$tdir/subdir/second) == 1048576 ] ||
+ [ $($LFS getstripe -S $DIR/$tdir/subdir/second) == 1048576 ] ||
error "bad stripe size in sub-directory"
return 0
}
test_270d() {
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt $DIR/$tdir
+ $LFS setstripe -E 1024K -L mdt $DIR/$tdir
# inherit default DoM striping
mkdir $DIR/$tdir/subdir
touch $DIR/$tdir/subdir/f1
# change default directory striping
- $SETSTRIPE -c 1 $DIR/$tdir/subdir
+ $LFS setstripe -c 1 $DIR/$tdir/subdir
touch $DIR/$tdir/subdir/f2
- [ $($GETSTRIPE -c $DIR/$tdir/subdir/f2) == 1 ] ||
+ [ $($LFS getstripe -c $DIR/$tdir/subdir/f2) == 1 ] ||
error "wrong default striping in file 2"
- [ $($GETSTRIPE -L $DIR/$tdir/subdir/f2) == 1 ] ||
+ [ $($LFS getstripe -L $DIR/$tdir/subdir/f2) == 1 ] ||
error "bad pattern in file 2"
return 0
}
mkdir -p $DIR/$tdir/norm
DOMFILES=20
NORMFILES=10
- $SETSTRIPE -E 1M -L mdt $DIR/$tdir/dom
- $SETSTRIPE -i 0 -S 2M $DIR/$tdir/norm
+ $LFS setstripe -E 1M -L mdt $DIR/$tdir/dom
+ $LFS setstripe -i 0 -S 2M $DIR/$tdir/norm
createmany -o $DIR/$tdir/dom/dom- $DOMFILES
createmany -o $DIR/$tdir/norm/norm- $NORMFILES
error "Cannot change per-MDT DoM stripe limit to $dom_limit"
$LFS mkdir -i 0 -c 1 $DIR/$tdir
- $SETSTRIPE -d $DIR/$tdir
- $SETSTRIPE -E $dom_limit -L mdt $DIR/$tdir ||
+ $LFS setstripe -d $DIR/$tdir
+ $LFS setstripe -E $dom_limit -L mdt $DIR/$tdir ||
error "Can't set directory default striping"
# exceed maximum stripe size
- $SETSTRIPE -E $(($dom_limit * 2)) -L mdt $dom &&
+ $LFS setstripe -E $(($dom_limit * 2)) -L mdt $dom &&
error "Able to create DoM component size more than LOD limit"
do_facet mds1 $LCTL set_param -n lod.$mdtname.dom_stripesize=0
do_facet mds1 $LCTL set_param -n \
lod.$mdtname.dom_stripesize=$((dom_limit * 2))
- $SETSTRIPE -E $((dom_limit * 2)) -L mdt $dom ||
+ $LFS setstripe -E $((dom_limit * 2)) -L mdt $dom ||
error "Can't create DoM component size after limit change"
do_facet mds1 $LCTL set_param -n \
lod.$mdtname.dom_stripesize=$((dom_limit / 2))
- $SETSTRIPE -E $dom_limit -L mdt ${dom}_big &&
+ $LFS setstripe -E $dom_limit -L mdt ${dom}_big &&
error "Can create big DoM component after limit decrease"
touch ${dom}_def ||
error "Can't create file with old default layout"
skip "Reserved for glimpse-ahead" && return
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt -E EOF $DIR/$tdir/dom
+ $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
lctl set_param -n mdc.*.stats=clear
dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
# first stat from server should return size data and save glimpse
- local reads=$(lctl get_param -n mdc.*.stats | \
+ local gls=$(lctl get_param -n mdc.*.stats | \
awk '/ldlm_glimpse/ {print $2}')
- [ -z $reads ] || error "Unexpected $reads glimpse RPCs"
+ [ -z $gls ] || error "Unexpected $gls glimpse RPCs"
# second stat to check size is NOT cached on client without IO lock
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
- local reads=$(lctl get_param -n mdc.*.stats | \
- awk '/ldlm_glimpse/ {print $2}')
- [ "1" == "$reads" ] || error "Expect 1 glimpse RPCs but got $reads"
+ local gls=$(lctl get_param -n mdc.*.stats | grep ldlm_glimpse | wc -l)
+ [ "1" == "$gls" ] || error "Expect 1 glimpse RPCs but got $gls"
rm -f $dom
}
run_test 100a "DoM: glimpse RPCs for stat without IO lock (DoM only file)"
test_100b() {
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt -E EOF $DIR/$tdir/dom
+ $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
lctl set_param -n mdc.*.stats=clear
dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
# second stat to check size is cached on client
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
- local reads=$(lctl get_param -n mdc.*.stats | \
- awk '/ldlm_glimpse/ {print $2}')
+ local gls=$(lctl get_param -n mdc.*.stats |
+ awk '/ldlm_glimpse/ {print $2}')
# both stats should cause no glimpse requests
- [ -z $reads ] || error "Unexpected $reads glimpse RPCs"
+ [ -z $gls ] || error "Unexpected $gls glimpse RPCs"
rm -f $dom
}
run_test 100b "DoM: no glimpse RPC for stat with IO lock (DoM only file)"
test_100c() {
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt -E EOF $DIR/$tdir/dom
+ $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
lctl set_param -n mdc.*.stats=clear
lctl set_param -n osc.*.stats=clear
$CHECKSTAT -t file -s 2097152 $DIR/$tdir/dom ||
error "Wrong size from stat #1"
- local reads=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
- [ $reads -eq 0 ] && error "Expect OST glimpse RPCs but got none"
+ local gls=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
+ [ $gls -eq 0 ] && error "Expect OST glimpse RPCs but got none"
rm -f $dom
}
test_100d() {
mkdir -p $DIR/$tdir
- $SETSTRIPE -E 1024K -L mdt -E EOF $DIR/$tdir/dom
+ $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
dd if=/dev/zero of=$DIR2/$tdir/dom bs=2048K count=1 || return 1
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom ||
error "Wrong size from stat #1"
- local reads=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
- [ $reads -eq 0 ] && error "Expect OST glimpse but got none"
+ local gls=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
+ [ $gls -eq 0 ] && error "Expect OST glimpse but got none"
rm -f $dom
}