Lustre e2fsprogs patch series
cover Lustre e2fsprogs patch series
The following series of emails will contain the large part of the e2fsprogs patch series that is used for Lustre. It will not contain the regression tests for EXTENTS nor the DIR_NLINK features, as those are very large and were previously submitted.
A full tarball that includes the patches, series, and regression tests will be uploaded to ftp://ftp.lustre.org/pub/lustre/other/e2fsprogs/
Patch series:
e2fsprogs-specdotin.patch
e2fsprogs-eacheck.patch
e2fsprogs-extended_ops.patch
e2fsprogs-tests-f_unsorted_EAs.patch
e2fsprogs-tests-f_ea_checks.patch
e2fsprogs-nlinks.patch
e2fsprogs-extents.patch
e2fsprogs-config-before-cmdline.patch
e2fsprogs-SLES10--m-support.patch
e2fsprogs-uninit.patch
e2fsprogs-nlinks-flag.patch
e2fsprogs-expand-extra-isize.patch
e2fsprogs-tests-f_expisize.patch
e2fsprogs-tests-f_expisize_ea_del.patch
e2fsprogs-ibadness-counter.patch
e2fsprogs-tests-f_ibadness.patch
e2fsprogs-tests-f_ibadness_bad_extents.patch
e2fsprogs-tests-f_random_corruption.patch
e2fsprogs-stride_option.patch
e2fsprogs-mmp.patch
e2fsprogs-journal_chksum.patch
e2fsprogs-tests-f_jchksum_bblk.patch
e2fsprogs-tests-f_jchksum_blast_trans.patch
e2fsprogs-tests-f_jchksum_remount.patch
e2fsprogs-i_size-corruption.patch
e2fsprogs-fiemap.patch
e2fsprogs-debugfs-supported_features.patch
e2fsprogs-lts-make_rpms.patch
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
PATCH 1/28 e2fsprogs-specdotin.patch
Add the distro type to the RPM release number, so that it is possible release multiple distro packages without having conflicting RPM package names.
Allow the RPM built from upstream to replace the split packages provided by the distros. At some point in the future it may be desirable to also split the RPM built by this spec file, but this is complicated by the fact that SLES and RHEL have different splits.
e2fsprogs.spec.in +10 -1
@@ -6,13 +6,22 @@ Summary: Utilities for managing the second extended (ext2) filesystem. Name: e2fsprogs Version: @E2FSPROGS_PKGVER@ -Release: 0 +Release: 0%{_vendor} License: GPLv2 Group: System Environment/Base Source: ftp://download.sourceforge.net/pub/sourceforge/e2fsprogs/e2fsprogs-%{version}.tar.gz Url: http://e2fsprogs.sourceforge.net/ Prereq: /sbin/ldconfig BuildRoot: %{_tmppath}/%{name}-root +%if %{_vendor} == "suse" +Group: System/Filesystems +Provides: e2fsbn ext2fs libcom_err = %{version} +Obsoletes: ext2fs libcom_err < %{version} +%else +Group: System Environment/Base +Obsoletes: e2fsprogs-libs < %{version} +Provides: e2fsprogs-libs = %{version} +%endif %description The e2fsprogs package contains a number of utilities for creating,
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
PATCH 2/28 e2fsprogs-eacheck.patch
In reply to Andreas DilgerVerify in-inode EA structure.
Allow in-inode EAs to have a checksum.
Connect zero-length inodes that have an EA to lost+found.
e2fsck/e2fsck.h +3 -0
@@ -478,6 +478,9 @@ extern void init_resource_track(struct rextern int inode_has_valid_blocks (struct ext2_inode *inode);extern void e2fsck_read_inode (e2fsck_t ctx,unsigned long ino,struct ext2_inode * inode,const char * proc); +extern void e2fsck_read_inode_full (e2fsck_t ctx,unsigned long ino, +struct ext2_inode *inode, +const int bufsize,const char *proc);extern void e2fsck_write_inode (e2fsck_t ctx,unsigned long ino,struct ext2_inode * inode,const char * proc); extern void e2fsck_write_inode_full(e2fsck_t ctx, unsigned long ino,
e2fsck/pass1.c +28 -9
@@ -264,6 +264,7 @@ static void check_ea_in_inode(e2fsck_t c remain = storage_size -sizeof (__u32);while (!EXT2_EXT_IS_LAST_ENTRY (entry)) { +__u32 hash;/* header eats this space */ remain -=sizeof (struct ext2_ext_attr_entry );
@@ -291,9 +292,12 @@ static void check_ea_in_inode(e2fsck_t c problem =PR_1_ATTR_VALUE_BLOCK ; goto fix; } - -/* e_hash must be 0 in inode's ea */ -if (entry->e_hash !=0 ) { + + hash =ext2fs_ext_attr_hash_entry (entry, + start + entry->e_value_offs); + +/* e_hash may be 0 in older inode's ea */ +if (entry->e_hash !=0 && entry->e_hash != hash) { pctx->num = entry->e_hash; problem =PR_1_ATTR_HASH ; goto fix;
@@ -308,15 +312,12 @@ fix:* it seems like a corruption. it's very unlikely we could repair * EA(s) in automatic fashion -bzzz */ -#if 0 - problem =PR_1_ATTR_HASH ; -#endif if (problem ==0 || !fix_problem (ctx, problem, pctx))return ; -/* simple remove all possible EA(s) */ +/* simply remove all remaining EA(s) */ *((__u32 *)start) =0UL ; -e2fsck_write_inode_full (ctx, pctx->ino, pctx->inode, +e2fsck_write_inode_full (ctx, pctx->ino,(struct ext2_inode *)pctx->inode,EXT2_INODE_SIZE (sb),"pass1" ); }
@@ -1360,10 +1361,13 @@ static int check_ext_attr(e2fsck_t ctx, entry = (struct ext2_ext_attr_entry *)(header+1 ); end = block_buf + fs->blocksize;while ((char *)entry < end && *(__u32 *)entry) { +__u32 hash; +if (region_allocate (region, (char *)entry - (char *)header,EXT2_EXT_ATTR_LEN (entry->e_name_len))) {if (fix_problem (ctx,PR_1_EA_ALLOC_COLLISION , pctx)) goto clear_extattr; +break ; } if ((ctx->ext_attr_ver == 1 && (entry->e_name_len == 0 || entry->e_name_index != 0)) ||
@@ -1371,6 +1375,7 @@ static int check_ext_attr(e2fsck_t ctx, entry->e_name_index == 0)) {if (fix_problem (ctx,PR_1_EA_BAD_NAME , pctx)) goto clear_extattr; +break ; }if (entry->e_value_block !=0 ) {if (fix_problem (ctx,PR_1_EA_BAD_VALUE , pctx))
@@ -1387,6 +1392,17 @@ static int check_ext_attr(e2fsck_t ctx,if (fix_problem (ctx,PR_1_EA_ALLOC_COLLISION , pctx)) goto clear_extattr; } + + hash =ext2fs_ext_attr_hash_entry (entry, block_buf + + entry->e_value_offs); + +if (entry->e_hash != hash) { + pctx->num = entry->e_hash; +if (fix_problem (ctx,PR_1_ATTR_HASH , pctx)) + goto clear_extattr; + entry->e_hash = hash; + } + entry =EXT2_EXT_ATTR_NEXT (entry); }if (region_allocate (region, (char *)entry - (char *)header,4 )) {
@@ -1508,8 +1524,11 @@ static void check_blocks(e2fsck_t ctx, s } } -if (inode->i_file_acl &&check_ext_attr (ctx, pctx, block_buf)) +if (inode->i_file_acl &&check_ext_attr (ctx, pctx, block_buf)) { +if (ctx->flags &E2F_FLAG_SIGNAL_MASK ) + goto out; pb.num_blocks++; + }if (ext2fs_inode_has_valid_blocks (inode)) pctx->errcode = ext2fs_block_iterate2(fs, ino,
e2fsck/pass4.c +34 -18
122 lines not on this page · raw message
e2fsck/problem.c +1 -1
@@ -776,7 +776,7 @@ static struct e2fsck_problem problem_tab/* invalid ea entry->e_hash */ {PR_1_ATTR_HASH , -N_ ("@a in @i %i has a hash (%N) which is @n (must be 0)\n" ), +N_ ("@a in @i %i has a hash (%N) which is @n\n" ), PROMPT_CLEAR, PR_PREEN_OK },/* inode appears to be a directory */
e2fsck/util.c +14 -0
@@ -393,6 +393,20 @@ void e2fsck_read_inode(e2fsck_t ctx, uns } } +void e2fsck_read_inode_full (e2fsck_t ctx,unsigned long ino, +struct ext2_inode *inode,int bufsize, +const char *proc) +{ +int retval; + + retval =ext2fs_read_inode_full (ctx->fs, ino, inode, bufsize); +if (retval) { +com_err ("ext2fs_read_inode_full" , retval, +_ ("while reading inode %ld in %s" ), ino, proc); +fatal_error (ctx,0 ); + } +} +extern void e2fsck_write_inode_full (e2fsck_t ctx,unsigned long ino,struct ext2_inode * inode,int bufsize,const char *proc)
lib/ext2fs/ext2_ext_attr.h +1 -1
@@ -30,7 +30,7 @@ struct ext2_ext_attr_entry {__u32 e_value_block;/* disk block attribute is stored on (n/i) */ __u32 e_value_size;/* size of attribute value */ __u32 e_hash;/* hash value of name and value */ -#if 0 +#if 1 char e_name[0 ];/* attribute name */ #endif };
lib/ext2fs/ext2fs.h +8 -0
@@ -75,10 +75,12 @@ typedef __u32 ext2_dirhash_t;#include "com_err.h" #include "ext2_io.h" #include "ext2_err.h" +#include "ext2_ext_attr.h" #else #include <et/com_err.h> #include <ext2fs/ext2_io.h> #include <ext2fs/ext2_err.h> +#include <ext2fs/ext2_ext_attr.h> #endif /*
@@ -711,6 +713,8 @@ extern errcode_t ext2fs_dup_handle(ext2_extern errcode_t ext2fs_expand_dir (ext2_filsys fs,ext2_ino_t dir);/* ext_attr.c */ +extern __u32 ext2fs_ext_attr_hash_entry (struct ext2_ext_attr_entry *entry, +void *data);extern errcode_t ext2fs_read_ext_attr (ext2_filsys fs,blk_t block,void *buf);extern errcode_t ext2fs_write_ext_attr (ext2_filsys fs,blk_t block,void *buf);
@@ -961,6 +965,10 @@ extern errcode_t ext2fs_create_resize_in/* swapfs.c */ extern void ext2fs_swap_ext_attr (char *to,char *from,int bufsize,int has_header); +extern void ext2fs_swap_ext_attr_header (struct ext2_ext_attr_header *to_header, +struct ext2_ext_attr_header *from_hdr); +extern void ext2fs_swap_ext_attr_entry (struct ext2_ext_attr_entry *to_entry, +struct ext2_ext_attr_entry *from_entry);extern void ext2fs_swap_super (struct ext2_super_block * super);extern void ext2fs_swap_group_desc (struct ext2_group_desc *gdp); extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
lib/ext2fs/ext_attr.c +37 -0
@@ -23,6 +23,43 @@#include "ext2fs.h" +#define NAME_HASH_SHIFT 5 +#define VALUE_HASH_SHIFT 16 + +/* +* ext2_xattr_hash_entry() +* +* Compute the hash of an extended attribute. +*/ +__u32 ext2fs_ext_attr_hash_entry (struct ext2_ext_attr_entry *entry,void *data) +{ +__u32 hash =0 ; +char *name = entry->e_name; +int n; + +for (n =0 ; n < entry->e_name_len; n++) { + hash = (hash <<NAME_HASH_SHIFT ) ^ + (hash >> (8 *sizeof (hash) -NAME_HASH_SHIFT )) ^ + *name++; + } + +/* The hash needs to be calculated on the data in little-endian. */ +if (entry->e_value_block ==0 && entry->e_value_size !=0 ) { +__u32 *value = (__u32 *)data; +for (n = (entry->e_value_size +EXT2_EXT_ATTR_ROUND ) >> +EXT2_EXT_ATTR_PAD_BITS ; n; n--) { + hash = (hash <<VALUE_HASH_SHIFT ) ^ + (hash >> (8 *sizeof (hash) -VALUE_HASH_SHIFT )) ^ +ext2fs_le32_to_cpu (*value++); + } + } + +return hash; +} + +#undef NAME_HASH_SHIFT +#undef VALUE_HASH_SHIFT +errcode_t ext2fs_read_ext_attr (ext2_filsys fs,blk_t block,void *buf) {errcode_t retval;
lib/ext2fs/swapfs.c +29 -16
67 lines not on this page · raw message
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.
PATCH 3/28 e2fsprogs-extended_ops.patch
In reply to Andreas DilgerMinor reformatting patch to make applying later patches easier.
e2fsck/unix.c +6 -6
@@ -537,14 +537,13 @@ static void parse_extended_opts(e2fsck_tcontinue ; } ea_ver =strtoul (arg, &p,0 ); -if (*p || - ((ea_ver !=1 ) && (ea_ver !=2 ))) { -fprintf (stderr, -_ ("Invalid EA version.\n" )); +if (*p =='\0' && (ea_ver ==1 || ea_ver ==2 )) { + ctx->ext_attr_ver = ea_ver; + }else { +fprintf (stderr,_ ("Invalid EA version.\n" )); extended_usage++;continue ; } - ctx->ext_attr_ver = ea_ver; }else {fprintf (stderr,_ ("Unknown extended option: %s\n" ), token);
@@ -558,7 +557,8 @@ static void parse_extended_opts(e2fsck_t"and may take an argument which\n" "is set off by an equals ('=') sign. " "Valid extended options are:\n" - "\tea_ver=<ea_version (1 or 2)>\n\n"), stderr); +"\tea_ver=<ea_version (1 or 2)>\n" + "\n"), stderr);exit (1 ); } }
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
Re: [PATCH][4/28] e2fsprogs-tests-f_unsorted_EAs.patch
In reply to Andreas DilgerAttached binary patch.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
Test case for allowing unsorted EAs in the fast in-inode space.
tests/f_unsorted_EAs/expect.1 new file +11 -0
@@ -0,0 +1,11 @@ +Adding dirhash hint to filesystem. + +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information + +test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** +test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks +Exit status is 1
tests/f_unsorted_EAs/expect.2 new file +7 -0
@@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks +Exit status is 0
tests/f_unsorted_EAs/name new file +1 -0
@@ -0,0 +1 @@ +unsorted EAs in inode should not be deleted
*** /dev/null 2007-04-21 00:13:05.585391708 +0530
--- e2fsprogs-1.39/tests/f_unsorted_EAs/image.gz 2007-04-21 01:14:51.000000000 +0530
***************
*** 0 ****
--- 1,3 ----
+ �3)Fimage ��y�eA���@f@Q�M��v�.�(���$� ��˸�T�� &Yn����$ni�J����h���
+ I���s���������z}�9��{�sϹ�\����ʏ�ZX�b���UK-��Ts�w������N�lqaqa>la�K��,.�䚥���kl�N�������}�9��m�?��~����g���.���~�s¹�>��U��c��yMZ��H�Җi��u�q�I�&�4m�xݩ�i �zm��|�����MWY% �[���ww��/? �:l�� �m�|��o{���
ƥw�/[�����/�����Lc� �7�ħ�3�����p��߱�u������_�ޢ�n��v��q���F��䌻�O�����j�Z���Mr>�Q�4��5��}����O�o�_u��յ�v���4����b��j���x���^�����?��jV�����o{��m;dx�K���v�l����w���)�a�=kắU5ݬ��]>
����+ۮ��]8_�~^U���G�__���ꡫ˾��a(�ix]͚���>����Um�Ue��uY�CY�E_4u�6��n�*�-�"��l�GMV5}7=����Rvu;�~�d�e�a]�X5EWN����5�, �ƭJkW����U�v�����,l����{��G��qG����r�ţ֯�� ���5��b���? �[f+� �� �� ��Mg�1�4?6��i���.^3��t������nsb�����,= ����������o��<ly�&K?7��\\������&[����. \?�|��� �
����C�W]��*� �o�3�_�\X8�;��c���U;^�q�,.,�(m�V���cc����6������v���4����b��j���x���^�����?��jV�����o{��m;dx�K���v�l����w���)�!��l��V�t�zw�4l�k?�l�jw�|\�yUYt����~}9�ꪫ��.�������u5k�k��~�rV�uW�]_�eQeU}��}����i�h2���Rt�YY4yX�����a6+3$K���|�m���m�uyb�]9
ϫΪ~�r� ܀���7���[�������k_����G� �Y'>-������w���7��5�/
+ ��n��? ]�pykm��5��<oMZ��H�Җi��u�q�I�&�4mkc��0�}����v[���U��k��m6_u���=~ף�?�#����-7Z<j�z+ ���A��o�� �>����ʏ+V-,�x�@��=O\j�5?lqa��\�8�}����{�����f��7Z���IW=���_��6'�O���'|�or�]���ۥ���o|�cN8wק��ZGm\����q��� ��ܪ�����������/����Mi���z��{���Y��l>�iZ�n?���Ջ_�����t�O�z�4|Vv�O�n_�78
�f�����3�����V�ڼ���t��:q�>=}�S����?~��#�e��lV�u.Y�|����;|x�
E�i�x�ˏN9w�7�t?����������m��i�A��v�}��C5�r5���#����~4
o����[^���!���6[�k���l�g��OQ������<=7����4W��|����|��{��a����.Ok���n5���v>�i>�KG�{����f6���]������K�{uɚ�q�l��mKߗ5}�T�eZ��I�{�o�ǵ��k~~e�ޱӡ�ηs�οg��iz����q��㚶���fy��p�#�7����,V���
g�g�vM1�;}�q�C�O���K���Ӹ+V�}}���0߷�j>/�����ї���i\���˷��}��s��4nh��k�ny������ڴ_��|^N�byz����quYΗ�r���^074�q��,��.z������|�v+�;�G�;��������V���q�7�qm_��]�������
��Xz�����p�����z>�����
�}�4����>q���G�C/,߲4�*�q����y��>�)���{��2>�A��4n(��:�������[��k+����\���.���g��z���>�{]4�L��
��ݑ]��Ϧ-�v������Ne_4UUU]�|_���UΛ}N�}�w�,ofu�uCr��窯�<���j����X�E�˽��z�Ű�=�u�w��əB�ߦ��_tycʫϪr�f�r)�w���Y�wϼi�}Q5y\��ڥ�2�y��0�����*�v�EFWՙ����߯�2K����V�Y�Y�u9.e�f�a6.�,S�rm6��~6��P����β��ܗM���l�Kζ(��n�Y��e;~Cg�d�ʾ��uY�fMf�j�j6~�f[6]YC�w�qCdJ}9��Y�)WtCSft�(+��6�!s8��P�_����!/�W�l>��.۫'1�u6S��k�a���*��g��Lp膪��-��m�t����h�-�G��7�f'���/�3�a�.Ҧ��Mó`YIY����_��%�ɏ[!�oh���m\����vwåq�3�YV�5��v�z�%D_����f��kY�U^<��Yu�
���m5n��{V]f�js1P�*x�3WB=n���F��+r�U��%�"?��m���:�\6M5,����6k��eh�a\Q�d]��vVg�֤���˵Mf(���嚹������6�q�};���5K�y��3���r\�}���xfAʮ��{{#��쳖��f����KW�:{^?^M۠�o3�y�ta:m���?v���Y5�|[��i���0���z<���_묥,H1�0r�2�s���d�7�8$��
U��7+:uhsQ_��m���2��Y��]��)�sdֳ�������,\?t9�}f:&ƳB����cs،GQ���� �e��|r|�h'9�d����#RN�I�CM0/�K������͚���*g�f���>��iG��>�!S�5�a���֍?���7G�p�<*�u�U2w�"K;��l���Yh�_� ���=�,'�q�Ϲ��Y^+;Q;��xͩ����r/ڏ�L3��&����-?T�xu=���ٸ���W��'ݜ@�����x�|�P�6�]�x����k�,oNbUΠY����Ɠ����g���"狺�2b�-����҅k��>