From: Akira Fujita Subject: Re: [PATCH 1/5] ext4 online defrag header file changes Date: Mon, 24 Mar 2008 21:31:03 +0900 Message-ID: <200803241231.AA00344@TNESG9526.rs.jp.nec.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="--------------------3010657016057801" Cc: Andreas Dilger , cmm@us.ibm.com, tytso@mit.edu, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org To: "Aneesh Kumar K.V" Return-path: Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:40331 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755372AbYCXMdV (ORCPT ); Mon, 24 Mar 2008 08:33:21 -0400 Sender: linux-ext4-owner@vger.kernel.org List-ID: This is multipart message. ----------------------3010657016057801 Content-Type: text/plain; charset=us-ascii Hi Aneesh, > On Mon, Mar 24, 2008 at 08:00:54PM +0900, Akira Fujita wrote: >>> >> Is EXT4_IOC_FIEMAP going to be added to the ext4 patch queue? >> I will try to use EXT4_IOC_FIEMAP instead of EXT4_IOC_EXTENTS_INFO >> in ext4 online defrag when kernel supports it. > > Can you also look at the sparse warnings with the patches ? > I have already released the fixed patch before, but it is not in the ext4 patch queue yet. Mingming, could you replace new ext4-online-defrag-free-space-fragmentation.patch with old one in the ext4 patch queue? Regards, Akira Signed-off-by: Akira Fujita --- defrag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -Nurp linux-2.6.25-rc6-full/fs/ext4/defrag.c linux-2.6.25-rc6-fix/fs/ext4/defrag.c --- linux-2.6.25-rc6-full/fs/ext4/defrag.c 2008-03-24 20:37:10.000000000 +0900 +++ linux-2.6.25-rc6-fix/fs/ext4/defrag.c 2008-03-24 20:40:22.000000000 +0900 @@ -454,7 +454,7 @@ static int ext4_defrag_move_victim(struc ext_info->ext[i].len, goal, DEFRAG_FORCE_VICTIM, &ext); if (ret < 0) { printk(KERN_ERR "ext4 defrag: " - "Moving victim file failed. ino [%lu]\n", + "Moving victim file failed. ino [%llu]\n", ext_info->ino); goto err; } ----------------------3010657016057801 Content-Type: application/octet-stream; name="ext4-online-defrag-free-space-fragmentation.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ext4-online-defrag-free-space-fragmentation.patch" RnJlZSBzcGFjZSBmcmFnbWVudGF0aW9uIGZ1bmN0aW9ucwoKRnJvbTogQWtpcmEgRnVqaXRh IDxhLWZ1aml0YUBycy5qcC5uZWMuY29tPgoKRGVmcmFnIHRyaWVzIHRvIG1vdmUgb3RoZXIg ZmlsZXMgdG8gbWFrZSBzdWZmaWNpZW50IHNwYWNlCmFuZCByZWFsbG9jYXRlcyB0aGUgY29u dGlndW91cyBibG9ja3MgZm9yIHRoZSB0YXJnZXQgZmlsZS4KClNpZ25lZC1vZmYtYnk6IEFr aXJhIEZ1aml0YSA8YS1mdWppdGFAcnMuanAubmVjLmNvbT4KU2lnbmVkLW9mZi1ieTogVGFr YXNoaSBTYXRvIDx0LXNhdG9AeWsuanAubmVjLmNvbT4KLS0tCiBiYWxsb2MuYyAgfCAgIDEy IC0KIGRlZnJhZy5jICB8ICA1NTQgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysKIGV4dGVudHMuYyB8ICAgNTIgKysrKy0K IDMgZmlsZXMgY2hhbmdlZCwgNjAyIGluc2VydGlvbnMoKyksIDE2IGRlbGV0aW9ucygtKQpk aWZmIC1OcnVwIGxpbnV4LTIuNi4yNS1yYzYvZnMvZXh0NC9iYWxsb2MuYyBsaW51eC0yLjYu MjUtcmM2LWZpeC9mcy9leHQ0L2JhbGxvYy5jCi0tLSBsaW51eC0yLjYuMjUtcmM2L2ZzL2V4 dDQvYmFsbG9jLmMJMjAwOC0wMy0yNCAyMDo1MDoyMy4wMDAwMDAwMDAgKzA5MDAKKysrIGxp bnV4LTIuNi4yNS1yYzYtZml4L2ZzL2V4dDQvYmFsbG9jLmMJMjAwOC0wMy0yNCAyMDozOT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