File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ static ssize_t simplefs_write(struct file *file,
413413 size_t bytes_to_write =
414414 min_t (size_t , len , SIMPLEFS_BLOCK_SIZE - pos % SIMPLEFS_BLOCK_SIZE );
415415
416- if (copy_from_user (bh_data -> b_data + pos % SIMPLEFS_BLOCK_SIZE , buf ,
416+ if (copy_from_user (bh_data -> b_data + pos % SIMPLEFS_BLOCK_SIZE , buf + bytes_write ,
417417 bytes_to_write )) {
418418 brelse (bh_data );
419419 bytes_write = - EFAULT ;
Original file line number Diff line number Diff line change @@ -123,6 +123,18 @@ test_op 'dd if=/dev/zero of=file bs=1M count=12 status=none'
123123filesize=$( sudo ls -lR | grep -e " $F_MOD 2" .* file | awk ' {print $5}' )
124124test $filesize -le $MAXFILESIZE || echo " Failed, file size over the limit"
125125
126+ # Write the file size larger than BLOCK_SIZE
127+ # test serial to write
128+ test_op ' bash -c "printf \"%.0s123456789\" {1..1600} > file.txt"'
129+ count=$( awk ' {count += gsub(/123456789/, "")} END {print count}' " file.txt" )
130+ echo " test $count "
131+ test " $count " -eq 1600 || echo " Failed, file size not matching"
132+ # test block to write
133+ test_op ' cat file.txt > checkfile.txt'
134+ count=$( awk ' {count += gsub(/123456789/, "")} END {print count}' " checkfile.txt" )
135+ echo " test $count "
136+ test " $count " -eq 1600 || echo " Failed, file size not matching"
137+
126138# test remove symbolic link
127139test_op ' ln -s file symlink_fake'
128140test_op ' rm -f symlink_fake'
You can’t perform that action at this time.
0 commit comments