public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Sandeep K Sinha" <sandeepksinha@gmail.com>
To: "Rohit Sharma" <imreckless@gmail.com>
Cc: "Peter Teoh" <htmldeveloper@gmail.com>,
	ext4 <linux-ext4@vger.kernel.org>,
	Kernelnewbies <kernelnewbies@nl.linux.org>
Subject: Re: Copying Data Blocks
Date: Mon, 12 Jan 2009 12:26:42 +0530	[thread overview]
Message-ID: <37d33d830901112256g4aecafc0h9e5cdb08f268e6ab@mail.gmail.com> (raw)
In-Reply-To: <2d08ef090901112218v1c6820d7q98d39af1350a07a0@mail.gmail.com>

Hi Rohit,

On Mon, Jan 12, 2009 at 11:48 AM, Rohit Sharma <imreckless@gmail.com> wrote:
> Hi,
>
> I am having some issues in locking inode while copying data blocks.
> We are trying to keep file system live during this operation, so
> both read and write operations should work.
> In this case what type of lock on inode should be used, semaphore,
> mutex or spinlock?
>

Now here you need to do some homework first.
Each of the locks have its own meaning and particular uses cases.

The current inode struct has the following locks:
1. i_lock
2. i_alloc_sem
3. i_mutex
4. i_flock

 646        spinlock_t              i_lock; /* i_blocks, i_bytes,
maybe i_size */
 647        struct mutex            i_mutex;
 648        struct rw_semaphore     i_alloc_sem;
 649        const struct inode_operations   *i_op;
 650        const struct file_operations    *i_fop; /* former
->i_op->default_file_ops */
 651        struct super_block      *i_sb;
 652        struct file_lock        *i_flock;

Read the difference between spinlock, mutex, and semaphore.
You will be able to understand the semantics of each of these.

>
> On Sun, Jan 11, 2009 at 8:45 PM, Peter Teoh <htmldeveloper@gmail.com> wrote:
>> Sorry.....some mistakes...a resent:
>>
>> Here are some tips on the blockdevice API:
>>
>> http://lkml.org/lkml/2006/1/24/287
>> http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg09388.html
>>
>> as indicated, documentation is rather sparse in this area.
>>
>> not sure if anyone else have a summary list of blockdevice API and its
>> explanation?
>>
>> not wrt the following "cleanup patch", i am not sure how the API will change:
>>
>> http://lwn.net/Articles/304485/
>>
>> thanks.
>>
>> On Tue, Jan 6, 2009 at 6:36 PM, Rohit Sharma <imreckless@gmail.com> wrote:
>>>
>>> I want to read data blocks from one inode
>>> and copy it to other inode.
>>>
>>> I mean to copy data from data blocks associated with one inode
>>> to the data blocks associated with other inode.
>>>
>>> Is that possible in kernel space.?
>>> --
>>
>>
>>
>> --
>> Regards,
>> Peter Teoh
>>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@nl.linux.org
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Sandeep.





 	
"To learn is to change. Education is a process that changes the learner."

  reply	other threads:[~2009-01-12  6:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 10:36 Copying Data Blocks Rohit Sharma
2009-01-06 11:21 ` kanishk rastogi
2009-01-06 13:24 ` Manish Katiyar
2009-01-06 14:12   ` rishi agrawal
2009-01-06 16:45     ` Rohit Sharma
2009-01-06 17:13       ` Manish Katiyar
2009-01-06 17:16         ` Rohit Sharma
2009-01-06 17:25           ` Rohit Sharma
2009-01-06 17:28             ` Manish Katiyar
2009-01-06 17:36               ` Rohit Sharma
2009-01-11 15:11 ` Peter Teoh
2009-01-11 15:15 ` Peter Teoh
2009-01-12  6:18   ` Rohit Sharma
2009-01-12  6:56     ` Sandeep K Sinha [this message]
2009-01-12  7:41     ` Peter Teoh
2009-01-12  8:26       ` Sandeep K Sinha
2009-01-12  6:48   ` Sandeep K Sinha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37d33d830901112256g4aecafc0h9e5cdb08f268e6ab@mail.gmail.com \
    --to=sandeepksinha@gmail.com \
    --cc=htmldeveloper@gmail.com \
    --cc=imreckless@gmail.com \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox