Date: Thu, 11 Feb 2010 03:00:05 GMT From: "Pedro F. Giffuni" <giffunip@tutopia.com> To: freebsd-fs@FreeBSD.org Subject: Re: kern/142597: [ext2fs] ext2fs does not work on filesystems with really big directories Message-ID: <201002110300.o1B305B3055671@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/142597; it has been noted by GNATS. From: "Pedro F. Giffuni" <giffunip@tutopia.com> To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/142597: [ext2fs] ext2fs does not work on filesystems with really big directories Date: Wed, 10 Feb 2010 18:56:28 -0800 (PST) --0-1240140841-1265856988=:21423 Content-Type: text/plain; charset=us-ascii The previous patch was incomplete. There is now a complete fix for UFS available as SVN Revision 203763. Translating it to ext2fs gives the attached patch. (I kept the file system --> filesystem corrections) Please note that ext2_blkpref is very different to ffs1_blkpref. We probably have to review that function for (un)signed issues too. --0-1240140841-1265856988=:21423 Content-Type: application/octet-stream; name="patch-ext2_alloc.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="patch-ext2_alloc.c" LS0tIC4uL2V4dDJmcy5ic2QvZXh0Ml9hbGxvYy5jCTIwMTAtMDEtMTcgMTk6 MDA6NDcuMDAwMDAwMDAwICswMDAwCisrKyBleHQyX2FsbG9jLmMJMjAxMC0w Mi0xMCAyMTo0MDoyNS4wMDAwMDAwMDAgKzAwMDAKQEAgLTUxLDE2ICs1MSwx NiBAQAogI2luY2x1ZGUgPGZzL2V4dDJmcy9mcy5oPgogI2luY2x1ZGUgPGZz L2V4dDJmcy9leHQyX2V4dGVybi5oPgogCi1zdGF0aWMgZGFkZHJfdAlleHQy X2FsbG9jY2coc3RydWN0IGlub2RlICosIGludCwgZGFkZHJfdCwgaW50KTsK K3N0YXRpYyBkYWRkcl90CWV4dDJfYWxsb2NjZyhzdHJ1Y3QgaW5vZGUgKiwg dV9pbnQsIGRhZGRyX3QsIGludCk7CiBzdGF0aWMgdV9sb25nCWV4dDJfZGly cHJlZihzdHJ1Y3Qg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9pbnQgY2c7CisJaW50IGVycm9yOwogCWNoYXIgKmJicDsK IAogCWZzID0gaXAtPmlfZTJmczsKQEAgLTk0Miw3ICs5NDQsNyBAQAogfQog CiAvKgotICogRnNlcnIgcHJpbnRzIHRoZSBuYW1lIG9mIGEgZmlsZSBzeXN0 ZW0gd2l0aCBhbiBlcnJvciBkaWFnbm9zdGljLgorICogRnNlcnIgcHJpbnRz IHRoZSBuYW1lIG9mIGEgZmlsZXN5c3RlbSB3aXRoIGFuIGVycm9yIGRpYWdu b3N0aWMuCiAgKiAKICAqIFRoZSBmb3JtIG9mIHRoZSBlcnJvciBtZXNzYWdl IGlzOgogICoJZnM6IGVycm9yIG1lc3NhZ2UK --0-1240140841-1265856988=:21423--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002110300.o1B305B3055671>