Submitting patch
Hello,
The attached patch adds one more way of testing dataitegrity of files. The data integrity test is performed on fragmented files.
Thanks,
Jyoti
Added one more approach for data integrity.
Data integrity is performed on two fragmented files.
1. Creating two fragmented files each of size DiskSize/2.
2. Then comapring against the original file.
3. If not equal test case fails.
My ultimate goal in creating fragmented files is that,
1. It creates many extents (fragments for each file)
2. FS code may behave wrong at corner cases which may come into picture after many extents gets added to the file.
3. Data corruption chances are there
i. when file metadata updation is not proper(corner cases when fragments are more)
ii.If write and read is not matching (write operation might have updated the block number some where and read
may skip that block in some corner cases)
4. In reality fragments can occur only after much usage of the disk(create/delete file)
5. This is good test case for bigger size disk.(it can create more extents)
6. fsync() is called after every write, which makes it slow.
---
testcases/kernel/fs/fs_di/frag.c +109 -0
@@ -0,0 +1,109 @@ +/******************************************************************************/ +/* */ +/* Copyright (c) International Business Machines Corp., 2009 */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ +/* the GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* */ +/******************************************************************************/ + +/******************************************************************************/ +/* */ +/* File: frag.c */ +/* */ +/* Description: This piece of code creates two files, and writes 1k data to */ +/* each file in a loop from datafile. Loop continues till it */ +/* reaches EOF of data file. In a loop fsync, fclose is called, */ +/* to create fragmented files. */ +/* */ +/* Author: Jyoti Vantagodi [email protected] */ +/* */ +/* History: Created-Jul 22 2009-Jyoti Vantagodi [email protected] */ +/* */ +/******************************************************************************/ + +#include <stdio.h> +#include <fcntl.h> +#include <string.h> +#include <sys/types.h> +#include <unistd.h> + +FILE *fp_data;/* File pointer for data file */ +FILE *fp_frag1;/* File pointer for fragmented file 1 */ +FILE *fp_frag2;/* File pointer for fragmented file 2 */ + +int main (int argc,char *argv[]) +{ +int bytes_read =0 , bytes_written =0 , fd1 =-1 , fd2 =-1 ; +char buff[1024 ], frag_file1[100 ], frag_file2[100 ]; + +if (argc !=3 ) { +printf ("Needs to pass two arguments..\n" ); +return -1 ; + } + fp_data =fopen (argv[1 ],"r" ); +if (!fp_data) { +perror ("fopen:" ); +printf ("Error opening datafile \n" ); +return 1 ; + } +strcpy (frag_file1, argv[2 ]); +strcat (frag_file1,"/frag1" ); + +strcpy (frag_file2, argv[2 ]); +strcat (frag_file2,"/frag2" ); +do { + fp_frag1 =fopen (frag_file1,"a+" ); +if (!fp_frag1) { +printf ("Error opening fragfile \n" ); +return -1 ; + } + fp_frag2 =fopen (frag_file2,"a+" ); +if (!fp_frag2) { +printf ("Error opening fragfile \n" ); +perror ("fwrite:" ); +return -1 ; + } + bytes_read =fread (buff,1 ,1024 , fp_data); +if (bytes_read <0 ) { +printf ("Error reading data file\n" ); +perror ("fread:" ); +return -1 ; + } + bytes_written =fwrite (buff,1 , bytes_read, fp_frag1); +if (bytes_read != bytes_written) { +printf ("Error in writing data\n" ); +perror ("fwrite:" ); +return -1 ; + } + bytes_written =fwrite (buff,1 , bytes_read, fp_frag2); +if (bytes_read != bytes_written) { +printf ("Error in writing data\n" ); +perror ("fwrite:" ); +return -1 ; + } + fd1 =fileno (fp_frag1); + fd2 =fileno (fp_frag2); + +fsync (fd1); +fsync (fd2); +fclose (fp_frag1); +fclose (fp_frag2); + +if (bytes_read <1024 ) +break ; + }while (1 ); +fclose (fp_data); +return 0 ; +}
testcases/kernel/fs/fs_di/fs_di +65 -20
159 lines not on this page · raw message
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 1 line · Jyoti
Hello,
Please change the subject line accordingly. It should reflect the patch you are submitting.
Regards--
Subrata
Quoted 6 lines
The attached patch adds one more way of testing dataitegrity of files. The data integrity test is performed on fragmented files.
Thanks,
Jyoti
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
[LTP] patch for kernel/fs/fs_di fs_di.patch
Quoted 16 lines · Subrata Modak
Quoted 1 line · Jyoti
Hello,
Please change the subject line accordingly. It should reflect the patch you are submitting.
Regards--
SubrataQuoted 6 lines
The attached patch adds one more way of testing dataitegrity of files. The data integrity test is performed on fragmented files.
Thanks,
Jyoti
Added one more approach for data integrity.
Data integrity is performed on two fragmented files.
1. Creating two fragmented files each of size DiskSize/2.
2. Then comapring against the original file.
3. If not equal test case fails.
My ultimate goal in creating fragmented files is that,
1. It creates many extents (fragments for each file)
2. FS code may behave wrong at corner cases which may come into picture after many extents gets added to the file.
3. Data corruption chances are there
i. when file metadata updation is not proper(corner cases when fragments are more)
ii.If write and read is not matching (write operation might have updated the block number some where and read
may skip that block in some corner cases)
4. In reality fragments can occur only after much usage of the disk(create/delete file)
5. This is good test case for bigger size disk.(it can create more extents)
6. fsync() is called after every write, which makes it slow.
---
testcases/kernel/fs/fs_di/frag.c +109 -0
@@ -0,0 +1,109 @@ +/******************************************************************************/ +/* */ +/* Copyright (c) International Business Machines Corp., 2009 */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ +/* the GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* */ +/******************************************************************************/ + +/******************************************************************************/ +/* */ +/* File: frag.c */ +/* */ +/* Description: This piece of code creates two files, and writes 1k data to */ +/* each file in a loop from datafile. Loop continues till it */ +/* reaches EOF of data file. In a loop fsync, fclose is called, */ +/* to create fragmented files. */ +/* */ +/* Author: Jyoti Vantagodi [email protected] */ +/* */ +/* History: Created-Jul 22 2009-Jyoti Vantagodi [email protected] */ +/* */ +/******************************************************************************/ + +#include <stdio.h> +#include <fcntl.h> +#include <string.h> +#include <sys/types.h> +#include <unistd.h> + +FILE *fp_data;/* File pointer for data file */ +FILE *fp_frag1;/* File pointer for fragmented file 1 */ +FILE *fp_frag2;/* File pointer for fragmented file 2 */ + +int main (int argc,char *argv[]) +{ +int bytes_read =0 , bytes_written =0 , fd1 =-1 , fd2 =-1 ; +char buff[1024 ], frag_file1[100 ], frag_file2[100 ]; + +if (argc !=3 ) { +printf ("Needs to pass two arguments..\n" ); +return -1 ; + } + fp_data =fopen (argv[1 ],"r" ); +if (!fp_data) { +perror ("fopen:" ); +printf ("Error opening datafile \n" ); +return 1 ; + } +strcpy (frag_file1, argv[2 ]); +strcat (frag_file1,"/frag1" ); + +strcpy (frag_file2, argv[2 ]); +strcat (frag_file2,"/frag2" ); +do { + fp_frag1 =fopen (frag_file1,"a+" ); +if (!fp_frag1) { +printf ("Error opening fragfile \n" ); +return -1 ; + } + fp_frag2 =fopen (frag_file2,"a+" ); +if (!fp_frag2) { +printf ("Error opening fragfile \n" ); +perror ("fwrite:" ); +return -1 ; + } + bytes_read =fread (buff,1 ,1024 , fp_data); +if (bytes_read <0 ) { +printf ("Error reading data file\n" ); +perror ("fread:" ); +return -1 ; + } + bytes_written =fwrite (buff,1 , bytes_read, fp_frag1); +if (bytes_read != bytes_written) { +printf ("Error in writing data\n" ); +perror ("fwrite:" ); +return -1 ; + } + bytes_written =fwrite (buff,1 , bytes_read, fp_frag2); +if (bytes_read != bytes_written) { +printf ("Error in writing data\n" ); +perror ("fwrite:" ); +return -1 ; + } + fd1 =fileno (fp_frag1); + fd2 =fileno (fp_frag2); + +fsync (fd1); +fsync (fd2); +fclose (fp_frag1); +fclose (fp_frag2); + +if (bytes_read <1024 ) +break ; + }while (1 ); +fclose (fp_data); +return 0 ; +}
testcases/kernel/fs/fs_di/fs_di +65 -20
159 lines not on this page · raw message
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] patch for kernel/fs/fs_di fs_di.patch
Quoted 12 lines · Jyoti
Quoted 10 lines · Subrata Modak
Quoted 1 line · Jyoti
Hello,
Please change the subject line accordingly. It should reflect the patch you are submitting.
Regards--
SubrataQuoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
The attached patch adds one more way of testing dataitegrity of files. The data integrity test is performed on fragmented files.
Thanks,
Jyoti
And neither is this a good Subject heading. Better could be like:
Subject: [PATCH] Added one more approach for data integrity.
Nevertheless, checked in.
Regards--
Subrata
Quoted 1 line
Quoted 1 line
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list