Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752959AbYAPVbG (ORCPT ); Wed, 16 Jan 2008 16:31:06 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751326AbYAPVaw (ORCPT ); Wed, 16 Jan 2008 16:30:52 -0500 Received: from py-out-1112.google.com ([64.233.166.180]:30949 "EHLO py-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750986AbYAPVat (ORCPT ); Wed, 16 Jan 2008 16:30:49 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=J44Qsy8VLcyKC6Hjeh3PTR8kk4Qlmpfk3dHmes/7DvzCdar0QmWwWkinaIB4XBVpA0aD2YzX5EwqH/iI21qE41kRnE5Zu1trVcltVGBOSw4eGieB8U3gDteBLKaH6JG3shhSEz+UYByAZPzOEAe7Aa1geX50FQiIFar7kbHULyo= Message-ID: <70b6f0bf0801161330y46ec555m5d4994a1eea7d045@mail.gmail.com> Date: Wed, 16 Jan 2008 13:30:43 -0800 From: "Valerie Henson" Reply-To: val@vahconsulting.com To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC] Parallelize IO for e2fsck Cc: "Theodore Ts'o" , "Andreas Dilger" , "Ric Wheeler" In-Reply-To: <70b6f0bf0801161322k2740a8dch6a0d6e6e112cd2d0@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_9623_30099818.1200519043384" References: <70b6f0bf0801161322k2740a8dch6a0d6e6e112cd2d0@mail.gmail.com> X-Google-Sender-Auth: 68a43e590024dcaa Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 95601 Lines: 1283 ------=_Part_9623_30099818.1200519043384 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi y'all, This is a request for comments on the rewrite of the e2fsck IO parallelization patches I sent out a few months ago. The mechanism is totally different. Previously IO was parallelized by issuing IOs from multiple threads; now a single thread issues fadvise(WILLNEED) and then uses read() to complete the IO. Single disk performance doesn't change, but elapsed time drops by about 50% on a big RAID-5 box. Passes 1 and 2 are parallelized. Pass 5 is left as an exercise for the reader. Many thanks to the Lustre folks for their fadvise readahead patch which this patch uses and for comments and help in general. Our good friends at EMC Centera funded this work. Here are the top things I'd like feedback on: How to split up the patch? My take: * Indirect block only flag for iterate * IO manager readahead/release functions * Readahead infrastructure (readahead.c and related) * Readahead calls for pass 1 * Readahead calls for pass 2 Killing readahead properly is hard. I implemented it several ways and didn't like any of them. The current solution is still racy and completely untested. The whole thing needs to be autoconfed correctly. Bah. The user interface kinda sucks. It should at least take arguments of the form "128KB" or "52m" instead of number of file system blocks. Guessing the right amount of buffer cache to use and io requests to issue would also be good. ext2fs_get_next_inode_ptr() - With readahead, copying the inode in ext2fs_get_next_inode_full() costs about 2-3% of elapsed time. This is a hacked up version that just returns a pointer to the inode. The patch is against e2fsprogs 1.40.4 and is attached. Future patches will be split up and sent via quilt. Thanks! -VAL e2fsck/Makefile.in | 6 e2fsck/e2fsck.h | 5 e2fsck/pass1.c | 36 e2fsck/pass2.c | 12 e2fsck/unix.c | 18 lib/ext2fs/readahead.c | 1607 ++++++++++++++++++++++++++++++++ lib/ext2fs/Makefile.in | 1 lib/ext2fs/block.c | 20 lib/ext2fs/dosio.c | 2 lib/ext2fs/ext2_io.h | 10 lib/ext2fs/ext2fs.h | 42 lib/ext2fs/inode.c | 70 + lib/ext2fs/inode_io.c | 2 lib/ext2fs/io_manager.c | 12 lib/ext2fs/nt_io.c | 2 lib/ext2fs/test_io.c | 2 lib/ext2fs/unix_io.c | 41 17 files changed, 1873 insertions(+), 15 deletions(-) ------=_Part_9623_30099818.1200519043384 Content-Type: application/octet-stream; name=readahead Content-Transfer-Encoding: base64 X-Attachment-Id: f_fbidqst60 Content-Disposition: attachment; filename=readahead LS0tIGUyZnNwcm9ncy0xLjQwLjQub3JpZy9saWIvZXh0MmZzL2V4dDJfaW8uaAorKysgZTJmc3By b2dzLTEuNDAuNC9saWIvZXh0MmZzL2V4dDJfaW8uaApAQCAtNjMsNiArNjMsMTAgQEAgc3RydWN0 IHN0cnVjdF9pb19tYW5hZ2VyIHsKIAllcnJjb2RlX3QgKCpzZXRfYmxrc2l6ZSkoaW9fY2hhbm5l bCBjaGFubmVsLCBpbnQgYmxrc2l6ZSk7CiAJZXJyY29kZV90ICgqcmVhZF9ibGspKGlvX2NoYW5u ZWwgY2hhbm5lbCwgdW5zaWduZWQgbG9uZyBibG9jaywKIAkJCSAgICAgIGludCBjb3VudCwgdm9p ZCAqZGF0YSk7CisJZXJyY29kZV90ICgqcmVhZGFoZWFkKShpb19jaGFubmVsIGNoYW5uZWwsIHVu c2lnbmVkIGxvbmcgYmxvY2ssCisJCQkgICAgICAgaW50IGNvdW50KTsKKwllcnJjb2RlX3QgKCpj YWNoZV9yZWxlYXNlKShpb19jaGFubmVsIGNoYW5uZWwsIHVuc2lnbmVkIGxvbmcgYmxvY2ssCisJ CQkJICAgaW50IGNvdW50KTsKIAllcnJjb2RlX3QgKCp3cml0ZV9ibGspKGlvX2NoYW5uZWwgY2hh bm5lbCwgdW5zaWduZWQgbG9uZyBibG9jaywKIAkJCSAgICAgICBpbnQgY291bnQsIGNvbnN0IHZv aWQgKmRhdGEpOwogCWVycmNvZGVfdCAoKmZsdXNoKShpb19jaGFubmVsIGNoYW5uZWwpOwpAQCAt ODIsNiArODYsOCBAQCBzdHJ1Y3Qgc3RydWN0X2lvX21hbmFnZXIgewogI2RlZmluZSBpb19jaGFu bmVsX2Nsb3NlKGMpIAkJKChjKS0+bWFuYWdlci0+Y2xvc2UoKGMpKSkKICNkZWZpbmUgaW9fY2hh bm5lbF9zZXRfYmxrc2l6ZShjLHMpCSgoYyktPm1hbmFnZXItPnNldF9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CgmcmEtPmNh Y2hlX3dha2UpOworCX0KKwlwdGhyZWFkX211dGV4X3VubG9jaygmcmEtPmNhY2hlX211dGV4KTsK K30KKworLyoKKyAqIElPIHF1ZXVlIG1hbmFnZW1lbnQgcm91dGluZXMuCisgKi8KKworI2lmZGVm IEVYVDJGU19SRUFEQUhFQURfREVCVUcKKworLyoKKyAqIFNhbml0eSBjaGVjayB0aGUgaW8gcXVl dWUuCisgKi8KKworc3RhdGljIHZvaWQgY2hlY2tfcXVldWUoc3RydWN0IHJlYWRhaGVhZF9zdGF0 ZSAqcmEpCit7CisJc3RydWN0IGlvX2Rlc2MgKmlvOworCWludCBpOworCisJaWYgKHJhLT5pb3Nf cXVldWVkID4gcmEtPmlvX3F1ZXVlX3NpemUpIHsKKwkJZnByaW50ZihzdGRlcnIsICJCdWchICBJ T3MgcXVldWVkICV1ID4gSU8gcXVldWUgc2l6ZSAldVxuIiwKKwkJCXJhLT5pb3NfcXVldWVkLCBy YS0+aW9fcXVldWVfc2l6ZSk7CisJCWdvdG8gb3V0OworCX0KKworCWZvciAoaSA9IDA7IGkgPCBy YS0+aW9fcXVldWVfc2l6ZTsgaSsrKSB7CisJCWlvID0gJnJhLT5pb19xdWV1ZVtpXTsKKwkJLyog T25seSBwcmludCBub24temVybyBpb3MgZm9yIGJyZXZpdHkgKi8KKwkJaWYgKGlvLT5ibGspCisJ CQlkcHJpbnRmKCIgIGlvWyVkXSBibGsgJXUgY291bnQgJXVcbiIsIGksIGlvLT5ibGssCisJCQkg ICAgICAgaW8tPmNvdW50KTsKKwkJaWYgKChpby0+YmxrIHx8IGlvLT5jb3VudCkgJiYKKwkJICAg IChpID49IHJhLT5pb3NfcXVldWVkKSkgeworCQkJZnByaW50ZihzdGRlcnIsICJCdWchICBpb1sl ZF0gbG9zdCEgIgorCQkJCSIoYmxrICV1IGNvdW50ICV1KVxuIiwgaSwgaW8tPmJsaywgaW8tPmNv dW50KTsKKwkJCWdvdG8gb3V0OworCQl9CisJfQorCisJc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XNvcnQgdG8gbW92ZSB6ZXJvZXMgdG8gdGhlIGVu ZCAqLworCXFzb3J0KHJhLT5pb19xdWV1ZSwgcmEtPmlvc19xdWV1ZWQsIHNpemVvZihyYS0+aW9f cXVldWVbMF0pLAorCSAgICAgIGlvX2NvbXBhcmUpOworCisJY2hlY2tfcXVldWUocmEpOworCisJ cmEtPmlvc19xdWV1ZWQgPSBuZXdfaW9zOworfQorCisvKgorICogSW9zIGNhbiBiZSBiYWQgZm9y IGF0IGxlYXN0IHR3byByZWFzb25zOgorICoKKyAqIC0gY29ycnVwdGVkIG9uLWRpc2sgYmxvY2sg cG9pbnRlciAoY2FuJ3QgcHJldmVudCB0aGlzKQorICogLSBwcm9ncmFtbWluZyBlcnJvciAoYS5r LmEuICJidWciKQorICoKKyAqIENoZWNrIGZvciBhbmQgcmVqZWN0IG9idmlvdXNseSBiYWQgaW9z IGJlZm9yZSB0aGV5IGFyZSBpc3N1ZWQgb3IKKyAqIGNhY2hlIGlzIHJlc2VydmVkIGZvciB0aGVt LgorICovCisKK3N0YXRpYyBpbnQgcmVqZWN0X2lvKHN0cnVjdCByZWFkYWhlYWRfc3RhdGUgKnJh LCBibGtfdCBibGssIHVuc2lnbmVkIGludCBjb3VudCkKK3sKKwlibGtfdCBtYXhfYmxrID0gcmEt PmZzLT5zdXBlci0+c19ibG9ja3NfY291bnQgLSAxOworCisJLyogSXMgdGhlIGJsayBudW1iZXIg d2l0aGluIHRoZSBib3VuZHMgb2YgdGhlIGZpbGUgc3lzdGVtPyAqLworCWlmICgoYmxrID09IDAp IHx8IChibGsgKyBjb3VudCA+IG1heF9ibGspKSB7CisJCWZwcmludGYoc3RkZXJyLCAiQmFkIGlv OiBibGsgJXUgY291bnQgJXVcbiIsIGJsaywgY291bnQpOworI2lmZGVmIEVYVDJGU19SRUFEQUhF QURfREVCVUcKKwkJYWJvcnQoKTsKKyNlbmRpZgorCQlyZXR1cm4gMTsKKwl9CisKKwlyZXR1cm4g MDsKK30KKworLyoKK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4uLiBEb24ndCB3cml0ZSBpdC4gKi8KKwkqaW5vZGUgPSAoc3RydWN0IGV4dDJf aW5vZGUgKikgc2Nhbi0+cHRyOworCXNjYW4tPnB0ciArPSBzY2FuLT5pbm9kZV9zaXplOworCXNj YW4tPmJ5dGVzX2xlZnQgLT0gc2Nhbi0+aW5vZGVfc2l6ZTsKKwlpZiAoc2Nhbi0+c2Nhbl9mbGFn cyAmIEVYVDJfU0ZfQkFEX0lOT0RFX0JMSykKKwkJcmV0dmFsID0gRVhUMl9FVF9CQURfQkxPQ0tf SU5fSU5PREVfVEFCTEU7CisKKwlzY2FuLT5pbm9kZXNfbGVmdC0tOworCXNjYW4tPmN1cnJlbnRf aW5vZGUrKzsKKwkqaW5vID0gc2Nhbi0+Y3VycmVudF9pbm9kZTsKKwlyZXR1cm4gcmV0dmFsOwor fQorCiBlcnJjb2RlX3QgZXh0MmZzX2dldF9uZXh0X2lub2RlKGV4dDJfaW5vZGVfc2NhbiBzY2Fu LCBleHQyX2lub190ICppbm8sCiAJCQkJc3RydWN0IGV4dDJfaW5vZGUgKmlub2RlKQogewo= ------=_Part_9623_30099818.1200519043384-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/