continuous writing of same file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I am using kernel client based Ceph version 0.21.1 on linux kernel
2.6.35. I am using a six node cluster with 3 machines and 3 virtual
machines.
 I wrote a simple program to continuously write to a file. After a few
iterations, the test gets stuck. Sometimes i am unable to unmount the
ceph mountpt subsequently.
I am using the following code
--
int main()
{

    FILE *fp;
    int i;
    int written_before_stat;
    int ret_value;


    /* some junk buffer*/
    char buffer[1024* SIZEOF_ONE_NODE];

    char tbuffer[30];
    struct timeval tv;

    time_t curtime;

    gettimeofday(&tv, NULL);
    curtime=tv.tv_sec;

    strftime(tbuffer,30,"%m-%d-%Y  %T.",localtime(&curtime));
    printf("%s%ld\t|",tbuffer,tv.tv_usec);


    printf("starting....\n");
    printf("infinite loop. Ctrl+C when you wish !!\n");

    /* keep writing to the ceph file*/
    /* infinite loop. Ctrl+C when you wish*/
    while(1)
    {

        /* the frenetic writing phase */

        fp = fopen("/ceph/test_file1","w");
        if(fp == NULL)
        {
            printf("ceph dir write file open err\n");

            exit(-1);
        }
        for(i = 0; i < 1024 ;i++)
            fwrite(buffer, sizeof(buffer[0]),
sizeof(buffer)/sizeof(buffer[0]), fp);

        fclose(fp);
        gettimeofday(&tv, NULL);
        curtime=tv.tv_sec;

        strftime(tbuffer,30,"%m-%d-%Y  %T.",localtime(&curtime));
        printf("%s%ld\t|",tbuffer,tv.tv_usec);

        printf("120MB written..\n");
        fflush(stdout);
        usleep(1000);

    }


}
--------
Am i missing something?. Thanks for any help.

Thanks,
Mugunthan
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux