`three = 1` in the Linux sourcecode (2014)
1–10 of 105 posts
Re: `three = 1` in the Linux sourcecode (2014)
#2 705 /*
706 * Iterate through the groups which hold BACKUP superblock/GDT copies in an
707 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before
708 * calling this for the first time. In a sparse filesystem it will be the
709 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ...
710 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ...
711 */
712 static unsigned ext4_list_backups(struct super_block *sb, unsigned *three,
713 unsigned *five, unsigned *seven)Re: `three = 1` in the Linux sourcecode (2014)
#3705 /* 706 * Iterate through the groups which hold BACKUP superblock/GDT copies in an 707 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before 708 * calling this for the first time. In a sparse filesystem it will be the 709 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ... 710 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ... 711 */ 712 static unsigned…
Re: `three = 1` in the Linux sourcecode (2014)
#4705 /* 706 * Iterate through the groups which hold BACKUP superblock/GDT copies in an 707 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before 708 * calling this for the first time. In a sparse filesystem it will be the 709 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ... 710 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ... 711 */ 712 static unsigned…
Yeah, maybe calling them pow3, pow5, pow7 would be a bit clearer? But a 10s search for a comment cleared it up, so I don’t really see the problem...
Re: `three = 1` in the Linux sourcecode (2014)
#5Re: `three = 1` in the Linux sourcecode (2014)
#6Intended for fixed point arithmetic where 1 actually means 1/256.
Re: `three = 1` in the Linux sourcecode (2014)
#7Re: `three = 1` in the Linux sourcecode (2014)
#8705 /* 706 * Iterate through the groups which hold BACKUP superblock/GDT copies in an 707 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before 708 * calling this for the first time. In a sparse filesystem it will be the 709 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ... 710 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ... 711 */ 712 static unsigned…
Yeah, maybe calling them pow3, pow5, pow7 would be a bit clearer? But a 10s search for a comment cleared it up, so I don’t really see the problem...
The problem is that it is extremely clear in a way that makes you confidently think something totally wrong.
Re: `three = 1` in the Linux sourcecode (2014)
#9https://github.com/torvalds/linux/blob/d158fc7f36a25e19791d2...
Re: `three = 1` in the Linux sourcecode (2014)
#10705 /* 706 * Iterate through the groups which hold BACKUP superblock/GDT copies in an 707 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before 708 * calling this for the first time. In a sparse filesystem it will be the 709 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ... 710 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ... 711 */ 712 static unsigned…
Yeah, maybe calling them pow3, pow5, pow7 would be a bit clearer? But a 10s search for a comment cleared it up, so I don’t really see the problem...
Then you could put the relevant comment about the weirdness of "three = 1" there, and callers wouldn't have to remember the magic sequence.