All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Fujita <a-fujita@rs.jp.nec.com>
To: linux-ext4@vger.kernel.org, Theodore Tso <tytso@mit.edu>,
	Mingming Cao <cmm@us.ibm.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: [RFC][PATCH 5/9]ext4: Add the EXT4_IOC_SUPER_INFO ioctl
Date: Fri, 24 Oct 2008 19:09:51 +0900	[thread overview]
Message-ID: <49019EEF.1040608@rs.jp.nec.com> (raw)

ext4: online defrag -- Add the EXT4_IOC_SUPER_INFO ioctl

From: Akira Fujita <a-fujita@rs.jp.nec.com>

EXT4_IOC_SUPER_INFO gets super block information on disk.

Super block information is necessary for relevant (-r) and force (-f) defrag.
Non-root user can't get this information by opening the block device directly,
so implement this ioctl newly.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
--- fs/ext4/ext4.h  |    1 +
 fs/ext4/ioctl.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ccea421..94c4186 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -303,6 +303,7 @@ struct ext4_new_group_data {
 #define EXT4_IOC_MIGRATE		_IO('f', 9)
  /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */
 #define EXT4_IOC_DEFRAG			_IOW('f', 15, struct ext4_ext_defrag_data)
+#define EXT4_IOC_SUPER_INFO		_IOR('f', 16, struct ext4_super_block)

 /*
  * ioctl commands in 32 bit emulation
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index d5e1fe7..f8ce89b 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -246,6 +246,16 @@ setversion_out:
 		return err;
 	}

+	case EXT4_IOC_SUPER_INFO: {
+		struct ext4_super_block es;
+
+		if (copy_to_user((struct ext4_super_block __user *)arg,
+				EXT4_SB(inode->i_sb)->s_es, sizeof(es)))
+			return -EFAULT;
+		else
+			return 0;
+	}
+
 	case EXT4_IOC_GROUP_ADD: {
 		struct ext4_new_group_data input;
 		struct super_block *sb = inode->i_sb;

                 reply	other threads:[~2008-10-24 10:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=49019EEF.1040608@rs.jp.nec.com \
    --to=a-fujita@rs.jp.nec.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.