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
Cc: linux-fsdevel@vger.kernel.org
Subject: [RFC][PATCH 11/12]ext4: Add the EXT4_IOC_BLOCK_RELEASE ioctl
Date: Sat, 27 Sep 2008 16:27:19 +0900	[thread overview]
Message-ID: <48DDE057.4010703@rs.jp.nec.com> (raw)

ext4: online defrag -- Add the EXT4_IOC_BLOCK_RELEASE ioctl.

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

The EXT4_IOC_BLOCK_RELEASE releases the reserved blocks
which target inode holds.
This ioctl is used if defrag failed and it was after the block reservation.

The block reservation will be removed from defrag in the next version,
so this ioctl also will go away.

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

diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
index a2b17c5..bdfbb68 100644
--- a/fs/ext4/defrag.c
+++ b/fs/ext4/defrag.c
@@ -622,6 +622,10 @@ int ext4_defrag_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,

 		err = ext4_defrag_move_victim(filp, &ext_info);

+	} else if (cmd == EXT4_IOC_BLOCK_RELEASE) {
+		down_write(&EXT4_I(inode)->i_data_sem);
+		ext4_discard_reservation(inode);
+		up_write(&EXT4_I(inode)->i_data_sem);
 	} else if (cmd == EXT4_IOC_DEFRAG) {
 		struct ext4_ext_defrag_data defrag;
 		struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4e54eb4..6ad86f9 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -314,6 +314,7 @@ struct ext4_new_group_data {
 #define EXT4_IOC_FIEMAP_INO		_IOW('f', 19, struct fiemap_ino)
 #define EXT4_IOC_RESERVE_BLOCK		_IOW('f', 20, struct ext4_extents_info)
 #define EXT4_IOC_MOVE_VICTIM		_IOW('f', 21, struct ext4_extents_info)
+#define EXT4_IOC_BLOCK_RELEASE		_IO('f', 22)

 /*
  * ioctl commands in 32 bit emulation
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index a596785..329847f 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -262,7 +262,8 @@ setversion_out:
 	case EXT4_IOC_FREE_BLOCKS_INFO:
 	case EXT4_IOC_FIEMAP_INO:
 	case EXT4_IOC_RESERVE_BLOCK:
-	case EXT4_IOC_MOVE_VICTIM: {
+	case EXT4_IOC_MOVE_VICTIM:
+	case EXT4_IOC_BLOCK_RELEASE: {
 		return ext4_defrag_ioctl(inode, filp, cmd, arg);
 	}
 	case EXT4_IOC_GROUP_ADD: {


                 reply	other threads:[~2008-09-27  7:27 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=48DDE057.4010703@rs.jp.nec.com \
    --to=a-fujita@rs.jp.nec.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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.