public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Arkadiusz Miskiewicz <arekm@maven.pl>
To: xfs@oss.sgi.com
Subject: Re: [PATCH VER 6] xfsprogs: projid32bit handling
Date: Sun, 26 Sep 2010 08:13:59 +0200	[thread overview]
Message-ID: <201009260814.00111.arekm@maven.pl> (raw)
In-Reply-To: <1285481438-31799-1-git-send-email-arekm@maven.pl>

On Sunday 26 of September 2010, Arkadiusz Miśkiewicz wrote:
> Add projid32bit handling to userspace. mkfs.xfs is able to enable this
> feature for new filesystems. xfs_db knows what projid_lo/hi are.

... and xfs_admin if someone needs it anyway.

News:
- use 0x80 instead of 0x20 for PROJID32BIT superblock bit (as 0x20
  and 0x40 are reserved)

diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
index a7a3fdb..ec8424d 100755
--- a/db/xfs_admin.sh
+++ b/db/xfs_admin.sh
@@ -6,9 +6,43 @@
 status=0
 DB_OPTS=""
 REPAIR_OPTS=""
-USAGE="Usage: xfs_admin [-efjluV] [-c 0|1] [-L label] [-U uuid] device"
+USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
 
-while getopts "efjluc:L:U:V" c
+set_features2_bit() {
+	device="$1"
+	bit="$2"
+
+	if [ -z "$device" ]; then
+		echo "$0: device name is missing" >&2
+		return 1
+	fi
+
+	if [ -z "$bit" ]; then
+		echo "$0: bits to set are missing" >&2
+		return 1
+	fi
+
+	# read current bits
+	features2=$(xfs_db -p xfs_admin -x -r -c 'sb' -c 'print features2' "$device" | awk ' { print $3 } ')
+	if [ -z "$features2" ]; then
+		echo "$0: can't read features2 from superblock!" >&2
+		return 1
+	fi
+	bad_features2=$(xfs_db -p xfs_admin -x -r -c 'sb' -c 'print bad_features2' "$device" | awk ' { print $3 } ')
+	if [ -z "$bad_features2" ]; then
+		echo "$0: can't read bad_features2 from superblock!" >&2
+		return 1
+	fi
+
+	# set new bits
+	features2=$((features2 | bit))
+	bad_features2=$((bad_features2 | bit))
+	xfs_db -p xfs_admin -x -c 'sb' -c "write features2 $features2" "$device" && \
+		xfs_db -p xfs_admin -x -c 'sb' -c "write bad_features2 $bad_features2" "$device"
+	return $?
+}
+
+while getopts "efjlu3c:L:U:V" c
 do
 	case $c in
 	c)	REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;;
@@ -17,6 +51,7 @@ do
 	j)	DB_OPTS=$DB_OPTS" -c 'version log2'";;
 	l)	DB_OPTS=$DB_OPTS" -r -c label";;
 	L)	DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
+	3)	FEATURES_BIT="0x80";;
 	u)	DB_OPTS=$DB_OPTS" -r -c uuid";;
 	U)	DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
 	V)	xfs_db -p xfs_admin -V
@@ -31,7 +66,12 @@ done
 set -- extra $@
 shift $OPTIND
 case $# in
-	1)	if [ -n "$DB_OPTS" ]
+	1)	if [ -n "$FEATURES_BIT" ]
+		then
+			set_features2_bit "$1" "$FEATURES_BIT"
+			status=$?
+		fi
+		if [ -n "$DB_OPTS" ]
 		then
 			eval xfs_db -x -p xfs_admin $DB_OPTS $1
 			status=$?
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index 8e3155b..6b727f3 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -4,7 +4,7 @@ xfs_admin \- change parameters of an XFS filesystem
 .SH SYNOPSIS
 .B xfs_admin
 [
-.B \-eflu
+.B \-eflu3
 ] [
 .BR "\-c 0" | 1
 ] [
@@ -55,6 +55,9 @@ Print the current filesystem label.
 .B \-u
 Print the current filesystem UUID (Universally Unique IDentifier).
 .TP
+.B \-3
+Enable 32bit project identifier support (PROJID32BIT feature).
+.TP
 .BR "\-c 0" | 1
 Enable (1) or disable (0) lazy-counters in the filesystem.
 This operation may take quite a bit of time on large filesystems as the


-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2010-09-26  6:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26  6:10 [PATCH VER 6] Extend project quotas to support 32bit project identifiers Arkadiusz Miśkiewicz
2010-09-26  6:10 ` [PATCH VER 6] xfsprogs: projid32bit handling Arkadiusz Miśkiewicz
2010-09-26  6:10   ` [PATCH VER 6] xfstests: Quota project id setting overflow Arkadiusz Miśkiewicz
2010-10-01 13:57     ` Alex Elder
2010-09-26  6:13   ` Arkadiusz Miskiewicz [this message]
2010-10-01 13:57     ` [PATCH VER 6] xfsprogs: projid32bit handling Alex Elder
2010-10-01 13:57   ` Alex Elder
2010-09-28  1:43 ` [PATCH VER 6] Extend project quotas to support 32bit project identifiers Christoph Hellwig
2010-10-01 13:57 ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201009260814.00111.arekm@maven.pl \
    --to=arekm@maven.pl \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox