From patchwork Tue Jun 23 08:26:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akira Fujita X-Patchwork-Id: 29039 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 360AEB7104 for ; Tue, 23 Jun 2009 18:29:05 +1000 (EST) Received: by ozlabs.org (Postfix) id 27CFBDDDE1; Tue, 23 Jun 2009 18:29:05 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id A6529DDDD4 for ; Tue, 23 Jun 2009 18:29:04 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758076AbZFWI2D (ORCPT ); Tue, 23 Jun 2009 04:28:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758068AbZFWI2C (ORCPT ); Tue, 23 Jun 2009 04:28:02 -0400 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:38752 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758076AbZFWI17 (ORCPT ); Tue, 23 Jun 2009 04:27:59 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.197]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n5N8Rxmh005647; Tue, 23 Jun 2009 17:27:59 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n5N8RxJ17314; Tue, 23 Jun 2009 17:27:59 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv.nec.co.jp (8.13.8/8.13.4) with ESMTP id n5N8Rwch027389; Tue, 23 Jun 2009 17:27:58 +0900 (JST) Received: from matabe.jp.nec.com ([10.26.220.20] [10.26.220.20]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-38366; Tue, 23 Jun 2009 17:26:18 +0900 Received: from [10.64.168.93] ([10.64.168.93] [10.64.168.93]) by mail.jp.nec.com with ESMTP; Tue, 23 Jun 2009 17:26:18 +0900 Message-ID: <4A4091AA.2040405@rs.jp.nec.com> Date: Tue, 23 Jun 2009 17:26:18 +0900 From: Akira Fujita User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: Theodore Tso , linux-ext4@vger.kernel.org CC: linux-fsdevel@vger.kernel.org Subject: [RFC][PATCH 7/7]ext4: Add EXT4_IOC_PRINT_INODE_ARULE for debug inode preferred range of blocks Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ext4: Add EXT4_IOC_PRINT_INODE_ARULE for debug inode preferred range of blocks From: Akira Fujita # This is a debug ioctl for inode preferred range of blocks. EXT4_IOC_PRINT_INODE_ARULE ioctl prints the information of preferred block allocation for specified inode to syslog. #define EXT4_IOC_PRINT_INODE_ARULE _IO('f', 20 ) This information consist of following four entries. - inode number (e.g. ino=11) - start physical offset of this rule - block length this rule covers - flag (0: mandatory, 1: advisory) e.g. ARULE: ino=11 start=6000 len=1000 flag=0 The above means the inode (ino=11) is set preferred block allocation from 6000 to 6999 with mandatory. Therefore block allocator is forced to use blocks from 6000 to 6999 and if could not use this range, return -ENOSPC. Note: Preferred block allocation is disabled when inode reference counter is 0 or umount FS. Signed-off-by: Akira Fujita Signed-off-by: Kazuya Mio --- fs/ext4/ext4.h | 2 ++ fs/ext4/ioctl.c | 5 +++++ fs/ext4/mballoc.c | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4ed4b27..4e94960 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -363,6 +363,7 @@ struct ext4_new_group_data { #define EXT4_IOC_CLR_GLOBAL_ALLOC_RULE _IOW('f', 17, struct ext4_alloc_rule) #define EXT4_IOC_ADD_INODE_ALLOC_RULE _IOW('f', 18, struct ext4_alloc_rule) #define EXT4_IOC_PRINT_GLOBAL_ARULE _IO('f', 19) +#define EXT4_IOC_PRINT_INODE_ARULE _IO('f', 20) /* * ioctl commands in 32 bit emulation @@ -1406,6 +1407,7 @@ extern int ext4_mb_add_inode_arule(struct inode *inode, extern void ext4_mb_del_inode_arule(struct inode *inode); extern void ext4_mb_dec_inode_arule(struct inode *inode, unsigned int len); extern void ext4_mb_print_global_arule(struct inode *inode); +extern void ext4_mb_print_inode_arule(struct inode *inode); /* inode.c */ int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 323e3d2..9808dd4 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -323,6 +323,11 @@ setversion_out: return 0; } + case EXT4_IOC_PRINT_INODE_ARULE: { + ext4_mb_print_inode_arule(inode); + return 0; + } + case EXT4_IOC_GROUP_ADD: { struct ext4_new_group_data input; struct super_block *sb = inode->i_sb; diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index cd5b833..bfe633e 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5859,3 +5859,23 @@ void ext4_mb_print_global_arule(struct inode *inode) return; } + +void ext4_mb_print_inode_arule(struct inode *inode) +{ + struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_alloc_rule *arule = NULL; + + if (ei->i_alloc_rule == NULL) + printk(KERN_ERR "ARULE: ino=%lu alloc_rule is empty\n", + inode->i_ino); + else { + arule = &(ei->i_alloc_rule)->alloc_rule; + printk(KERN_ERR "ARULE: ino=%lu start=%llu len=%llu " + "flag=%u\n", inode->i_ino, + (ext4_fsblk_t)arule->start, + (ext4_fsblk_t)arule->len, + (unsigned)arule->alloc_flag); + } + + return; +}