| 1 | Get rid of "page sizes must be a power-of-2" warning when loading a file. |
| 2 | |
| 3 | --- ../common/exf.c-dist 2007-11-18 10:41:42.000000000 -0600 |
| 4 | +++ ../common/exf.c 2010-08-21 16:19:45.000000000 -0500 |
| 5 | @@ -228,15 +228,17 @@ |
| 6 | /* |
| 7 | * XXX |
| 8 | * A seat of the pants calculation: try to keep the file in |
| 9 | - * 15 pages or less. Don't use a page size larger than 10K |
| 10 | + * 15 pages or less. Don't use a page size larger than 16K |
| 11 | * (vi should have good locality) or smaller than 1K. |
| 12 | */ |
| 13 | - psize = ((sb.st_size / 15) + 1023) / 1024; |
| 14 | - if (psize > 10) |
| 15 | - psize = 10; |
| 16 | - if (psize == 0) |
| 17 | - psize = 1; |
| 18 | - psize *= 1024; |
| 19 | + psize = (sb.st_size > 0) ? ffsl(sb.st_size - 1) + 1 : 0; |
| 20 | + /* Do these very low limits make sense anymore? */ |
| 21 | + if (psize < 10) |
| 22 | + psize = 10; /* 1K */ |
| 23 | + if (psize > 14) |
| 24 | + psize = 14; /* 16K */ |
| 25 | + /* Keep page size on power of 2 boundary to keep db4 happy. */ |
| 26 | + psize = 1 << psize; |
| 27 | |
| 28 | F_SET(ep, F_DEVSET); |
| 29 | ep->mdev = sb.st_dev; |