From: Arkadiusz Miskiewicz <arekm@maven.pl>
To: xfs@oss.sgi.com
Subject: Re: [PATCH VER 5] xfsprogs: projid32bit handling (xfs_admin patch)
Date: Fri, 24 Sep 2010 22:17:25 +0200 [thread overview]
Message-ID: <201009242217.26186.arekm@maven.pl> (raw)
In-Reply-To: <1285332748-13648-1-git-send-email-arekm@maven.pl>
On Friday 24 of September 2010, Arkadiusz Miśkiewicz wrote:
> Note - there is no xfs_admin support for setting projid32bit.
> It would be a mess when doing that in shell code, similar to this one:
> http://pastebin.com/WWy8m1x7.
>
> hch comments on this:
> 12:34 < hch> arekm: doesn't look too pretty indeed
> 12:34 < hch> arekm: let me think about hacking up some simple C code
> for toggling feature bits
> 12:35 < hch> alternatively we could just do it in kernelspace
> 12:35 < hch> which seems more useful anyway as we could do online upgrades
> 12:53 < hch> I think adding an ioctl for enabling features is the better
> way 12:53 < hch> alternatively we could overload remount, but that weels a
> bit clumsy
>
> Not sure if hch is going to implement that or only suggesting that
> solution. Anyway now projid32bit can be enabled at mkfs.xfs time (for new
> filesystems) or if you are smart enough via xfs_db (for existing
> filesystems).
But if someone really wants xfs_admin support in shell then here it is:
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="0x20";;
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
>
> So if there are no new comments I'm asking for a merge for all 3 patches.
> Thanks!
--
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
next prev parent reply other threads:[~2010-09-24 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 12:51 [PATCH VER 5] Extend project quotas to support 32bit project identifiers Arkadiusz Miśkiewicz
2010-09-24 12:52 ` [PATCH VER 5] xfsprogs: projid32bit handling Arkadiusz Miśkiewicz
2010-09-24 12:52 ` [PATCH VER 5] xfstests: Quota project id setting overflow Arkadiusz Miśkiewicz
2010-09-26 0:10 ` Christoph Hellwig
2010-09-24 20:17 ` Arkadiusz Miskiewicz [this message]
2010-09-26 0:06 ` [PATCH VER 5] xfsprogs: projid32bit handling Christoph Hellwig
2010-09-26 0:05 ` [PATCH VER 5] Extend project quotas to support 32bit project identifiers Christoph Hellwig
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=201009242217.26186.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